localized chatcommands, added de language

This commit is contained in:
Alexander Weber 2018-02-15 08:17:54 +01:00 committed by sofar
parent e619bc8d83
commit 1a5400f83a
3 changed files with 28 additions and 9 deletions

View File

@ -1,3 +1,5 @@
local S = skins.S
local function show_selection_formspec(player) local function show_selection_formspec(player)
local context = skins.ui_context[player:get_player_name()] local context = skins.ui_context[player:get_player_name()]
local name = player:get_player_name() local name = player:get_player_name()
@ -10,11 +12,11 @@ end
minetest.register_chatcommand("skinsdb", { minetest.register_chatcommand("skinsdb", {
params = "[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]", params = "[set] <skin key> | show [<skin key>] | list | list private | list public | [ui]",
description = "Set, show or list player's skin", description = S("Show, list or set player's skin"),
func = function(name, param) func = function(name, param)
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
if not player then if not player then
return false, "Player not found" return false, S("Player not found")
end end
-- parse command line -- parse command line
@ -30,15 +32,15 @@ minetest.register_chatcommand("skinsdb", {
elseif not word then elseif not word then
command = 'ui' command = 'ui'
else else
return false, "unknown command "..word.." see /help skinsdb for supported parameters" return false, S("unknown command").." "..word..", "..S("see /help skinsdb for supported parameters")
end end
if command == "set" then if command == "set" then
local success = skins.set_player_skin(player, parameter) local success = skins.set_player_skin(player, parameter)
if success then if success then
return true, "skin set to "..parameter return true, S("skin set to").." "..parameter
else else
return false, "invalid skin "..parameter return false, S("invalid skin").." "..parameter
end end
elseif command == "list" then elseif command == "list" then
local list local list
@ -49,13 +51,15 @@ minetest.register_chatcommand("skinsdb", {
elseif not parameter then elseif not parameter then
list = skins.get_skinlist_for_player(name) list = skins.get_skinlist_for_player(name)
else else
return false, "unknown parameter", parameter return false, S("unknown parameter"), parameter
end end
local current_skin_key = skins.get_player_skin(player):get_key() local current_skin_key = skins.get_player_skin(player):get_key()
for _, skin in ipairs(list) do for _, skin in ipairs(list) do
local info = skin:get_key()..": name="..skin:get_meta_string("name").." author=" local info = skin:get_key().." - "
..skin:get_meta_string("author").." license="..skin:get_meta_string("license") ..S("Name").."="..skin:get_meta_string("name").." "
..S("Author").."="..skin:get_meta_string("author").." "
..S("License").."="..skin:get_meta_string("license")
if skin:get_key() == current_skin_key then if skin:get_key() == current_skin_key then
info = minetest.colorize("#00FFFF", info) info = minetest.colorize("#00FFFF", info)
end end
@ -69,7 +73,7 @@ minetest.register_chatcommand("skinsdb", {
skin = skins.get_player_skin(player) skin = skins.get_player_skin(player)
end end
if not skin then if not skin then
return false, "unknown skin" return false, S("invalid skin")
end end
local formspec = "size[8,3]"..skins.get_skin_info_formspec(skin) local formspec = "size[8,3]"..skins.get_skin_info_formspec(skin)
minetest.show_formspec(name, 'skinsdb_show_skin', formspec) minetest.show_formspec(name, 'skinsdb_show_skin', formspec)

View File

@ -7,3 +7,10 @@ Change = Wechseln
Page = Seite Page = Seite
License = Lizenz License = Lizenz
Description = Beschreibung Description = Beschreibung
Show, list or set player's skin = Anzeigen oder setzen der Spieler-Skins
Player not found = Spieler nicht da
unknown command = unbekannter Befehl
see /help skinsdb for supported parameters = Lese /help für erlaubte Parameter
skin set to = Skin ist jetzt
invalid skin = unbekannter Skin
unknown parameter = unbekannter Parameter

View File

@ -7,3 +7,11 @@ Change =
Page = Page =
License = License =
Description = Description =
Show, list or set player's skin =
Player not found =
unknown command =
see /help skinsdb for supported parameters =
skin set to =
invalid skin =
unknown parameter =
unknown skin =