added translation support + added language DE
This commit is contained in:
parent
e48a8455f3
commit
77c702b1cf
@ -1,5 +1,6 @@
|
||||
character_editor = {}
|
||||
character_editor.characters = {}
|
||||
character_editor.language = {}
|
||||
character_editor.mesh = {}
|
||||
|
||||
character_editor.shirts = {"character_editor_red_shirt.png", "character_editor_blue_shirt.png", "character_editor_yellow_shirt.png"}
|
||||
@ -32,6 +33,18 @@ function character_editor.set_texture(player, pos, texture)
|
||||
character_editor.update_character(player)
|
||||
end
|
||||
|
||||
character_editor.window = "size[8,7.5;]"
|
||||
character_editor.window = character_editor.window .. default.gui_colors
|
||||
character_editor.window = character_editor.window .. default.gui_bg
|
||||
character_editor.window = character_editor.window .. "label[0,0;Select your language! All dialogs will be translated\nin this language. Items are not translated.\nIf you cant find your language in this list,\n pls send a private message to cd2 on the minetest forums.]"
|
||||
character_editor.window = character_editor.window .. "button[3,2;2,1;lang_EN;EN]"
|
||||
character_editor.window = character_editor.window .. "button[3,3;2,1;lang_DE;DE]"
|
||||
|
||||
function character_editor.show_window(player)
|
||||
local name = player:get_player_name()
|
||||
minetest.show_formspec(name, "character_editor:language", character_editor.window)
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("shirt", {
|
||||
params = "<name>",
|
||||
description = "[TEST CMD] Select your shirt",
|
||||
@ -53,4 +66,21 @@ minetest.register_on_joinplayer(function(player)
|
||||
character_editor.set_texture(player, 1, "character.png")
|
||||
end)
|
||||
|
||||
minetest.register_on_newplayer(function(player)
|
||||
character_editor.show_window(player)
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname == "character_editor:language" then
|
||||
print("FORM")
|
||||
print("Player "..player:get_player_name().." submitted fields "..dump(fields))
|
||||
local name = player:get_player_name()
|
||||
if fields["lang_EN"] then
|
||||
print("EN")
|
||||
character_editor.language[name] = ""
|
||||
elseif fields["lang_DE"] then
|
||||
print("DE")
|
||||
character_editor.language[name] = "de/"
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
@ -151,7 +151,7 @@ function story.generator.get_part(name)
|
||||
if name == "" then return end
|
||||
if not story.generator.parts[name] then
|
||||
print("[story] loading part : " .. name)
|
||||
local file = io.open(minetest.get_modpath("story").."/parts/"..name..".quest", "r")
|
||||
local file = io.open(minetest.get_modpath("story").."/parts/" ..name..".quest", "r")
|
||||
story.generator.parts[name] = file:read("*all")
|
||||
io.close(file)
|
||||
return story.generator.parts[name]
|
||||
@ -161,9 +161,9 @@ function story.generator.get_part(name)
|
||||
end
|
||||
end
|
||||
|
||||
function story.generator.get_dialog(name)
|
||||
function story.generator.get_dialog(name, player)
|
||||
if not story.generator.dialogs[name] then
|
||||
local file = io.open(minetest.get_modpath("story").."/parts/"..name..".dialog", "r")
|
||||
local file = io.open(minetest.get_modpath("story").."/parts/" .. (character_editor.language[player:get_player_name()] or "") ..name..".dialog", "r")
|
||||
story.generator.dialogs[name] = file:read("*all")
|
||||
io.close(file)
|
||||
return story.generator.dialogs[name]
|
||||
@ -216,8 +216,8 @@ function story.generator.run(part, player, line_pos)
|
||||
if cmd[1] then
|
||||
print("[INFO] run line... " .. v)
|
||||
if cmd[1] == "$dialog" and cmd[2] then
|
||||
if story.generator.get_dialog(cmd[2]) then
|
||||
story.generator.players_storys[player:get_player_name()].text = story.generator.get_dialog(cmd[2])
|
||||
if story.generator.get_dialog(cmd[2], player) then
|
||||
story.generator.players_storys[player:get_player_name()].text = story.generator.get_dialog(cmd[2], player)
|
||||
end
|
||||
end
|
||||
if cmd[1] == "$create" then
|
||||
|
@ -2,3 +2,4 @@ default
|
||||
places
|
||||
quests
|
||||
pets
|
||||
character_editor
|
||||
|
4
mods/story/parts/de/quest_1.dialog
Normal file
4
mods/story/parts/de/quest_1.dialog
Normal file
@ -0,0 +1,4 @@
|
||||
Bauer : Hallo
|
||||
Bauer : Könntest du mir helfen
|
||||
Du : Ja warum nicht?
|
||||
Bauer : Holo mir bitte 20 Weizen (Wheat)
|
4
mods/story/parts/de/quest_1_done.dialog
Normal file
4
mods/story/parts/de/quest_1_done.dialog
Normal file
@ -0,0 +1,4 @@
|
||||
Bauer : Danke!
|
||||
Bauer : Könntetst du das Weizen wieder Anpflanzen?
|
||||
Du : ok
|
||||
Bauer : Danke, Ich bin zur Zeit sehr beschäftingt.
|
3
mods/story/parts/de/quest_1_done_2.dialog
Normal file
3
mods/story/parts/de/quest_1_done_2.dialog
Normal file
@ -0,0 +1,3 @@
|
||||
Bauer : Danke
|
||||
Bauer : Du kannst das Weizen behalten und dir Brot daraus machen :)
|
||||
Du : Tschüss
|
8
mods/story/parts/de/quest_2.dialog
Normal file
8
mods/story/parts/de/quest_2.dialog
Normal file
@ -0,0 +1,8 @@
|
||||
??? : Hallo
|
||||
Du : Hi
|
||||
??? : Jeder Abenteurer braucht gute Ausrüstung.
|
||||
??? : Und für gute Ausrüstung braucht man Eisen.
|
||||
??? : Du solltest etwas Eisen minen.
|
||||
Du : Warte... wer bist du??
|
||||
??? : -
|
||||
Du : Huh, was war das?
|
Loading…
x
Reference in New Issue
Block a user