Add intllib support and German translation
authororwell96 <mono96.mml@gmail.com>
Mon, 23 Jan 2017 20:29:59 +0000 (21:29 +0100)
committerorwell96 <mono96.mml@gmail.com>
Mon, 23 Jan 2017 20:29:59 +0000 (21:29 +0100)
19 files changed:
advtrains/advtrains/atc.lua
advtrains/advtrains/couple.lua
advtrains/advtrains/init.lua
advtrains/advtrains/locale/de.txt [new file with mode: 0644]
advtrains/advtrains/misc_nodes.lua
advtrains/advtrains/settingtypes.txt
advtrains/advtrains/signals.lua
advtrains/advtrains/trackplacer.lua
advtrains/advtrains/tracks.lua
advtrains/advtrains/trainhud.lua
advtrains/advtrains/wagons.lua
advtrains/advtrains_train_industrial/init.lua
advtrains/advtrains_train_industrial/locale/de.txt [new file with mode: 0644]
advtrains/advtrains_train_japan/init.lua
advtrains/advtrains_train_japan/locale/de.txt [new file with mode: 0644]
advtrains/advtrains_train_steam/init.lua
advtrains/advtrains_train_steam/locale/de.txt [new file with mode: 0644]
advtrains/advtrains_train_subway/init.lua
advtrains/advtrains_train_subway/locale/de.txt [new file with mode: 0644]

index 7117a9a..63ea3fd 100644 (file)
@@ -62,7 +62,7 @@ local apn_func=function(pos, node)
        advtrains.ndb.update(pos, node)
        local meta=minetest.get_meta(pos)
        if meta then
-               meta:set_string("infotext", "ATC controller, unconfigured.")
+               meta:set_string("infotext", attrans("ATC controller, unconfigured."))
                meta:set_string("formspec", atc.get_atc_controller_formspec(pos, meta))
        end
 end
@@ -73,7 +73,7 @@ advtrains.register_tracks("default", {
        models_prefix="advtrains_dtrack_detector",
        models_suffix=".b3d",
        shared_texture="advtrains_dtrack_rail_atc.png",
-       description="ATC controller",
+       description=attrans("ATC controller"),
        formats={},
        get_additional_definiton = function(def, preset, suffix, rotation)
                return {
@@ -86,7 +86,7 @@ advtrains.register_tracks("default", {
                        end,
                        on_receive_fields = function(pos, formname, fields, player)
                                if minetest.is_protected(pos, player:get_player_name()) then
-                                       minetest.chat_send_player(player:get_player_name(), "This position is protected!")
+                                       minetest.chat_send_player(player:get_player_name(), attrans("This position is protected!"))
                                        return
                                end
                                local meta=minetest.get_meta(pos)
@@ -95,7 +95,11 @@ advtrains.register_tracks("default", {
                                                --maybe only the dropdown changed
                                                if fields.mode then
                                                        meta:set_string("mode", idxtrans[fields.mode])
-                                                       meta:set_string("infotext", "ATC controller, mode "..fields.mode.."\n"..( fields.mode=="digiline" and "Channel: "..meta:get_string("channel") or "Command: "..meta:get_string("command") ) )
+                                                       if fields.mode=="digiline" then
+                                                               meta:set_string("infotext", attrans("ATC controller, mode @1\nChannel: @2", fields.mode, meta:get_string("command")) )
+                                                       else
+                                                               meta:set_string("infotext", attrans("ATC controller, mode @1\nCommand: @2", fields.mode, meta:get_string("command")) )
+                                                       end
                                                        meta:set_string("formspec", atc.get_atc_controller_formspec(pos, meta))
                                                end
                                                return
@@ -104,7 +108,11 @@ advtrains.register_tracks("default", {
                                        meta:set_string("command", fields.command)
                                        meta:set_string("command_on", fields.command_on)
                                        meta:set_string("channel", fields.channel)
-                                       meta:set_string("infotext", "ATC controller, mode "..fields.mode.."\n"..( fields.mode=="digiline" and "Channel: "..meta:get_string("channel") or "Command: "..meta:get_string("command") ) )
+                                       if fields.mode=="digiline" then
+                                               meta:set_string("infotext", attrans("ATC controller, mode @1\nChannel: @2", fields.mode, meta:get_string("command")) )
+                                       else
+                                               meta:set_string("infotext", attrans("ATC controller, mode @1\nCommand: @2", fields.mode, meta:get_string("command")) )
+                                       end
                                        meta:set_string("formspec", atc.get_atc_controller_formspec(pos, meta))
                                        
                                        local pts=minetest.pos_to_string(pos)
@@ -126,14 +134,14 @@ function atc.get_atc_controller_formspec(pos, meta)
        local formspec="size[8,6]"..
                "dropdown[0,0;3;mode;static,mesecon,digiline;"..mode.."]"
        if mode<3 then
-               formspec=formspec.."field[0.5,1.5;7,1;command;Command;"..minetest.formspec_escape(command).."]"
+               formspec=formspec.."field[0.5,1.5;7,1;command;"..attrans("Command")..";"..minetest.formspec_escape(command).."]"
                if tonumber(mode)==2 then
-                       formspec=formspec.."field[0.5,3;7,1;command_on;Command (on);"..minetest.formspec_escape(command_on).."]"
+                       formspec=formspec.."field[0.5,3;7,1;command_on;"..attrans("Command (on)")..";"..minetest.formspec_escape(command_on).."]"
                end
        else
-               formspec=formspec.."field[0.5,1.5;7,1;channel;Digiline channel;"..minetest.formspec_escape(channel).."]"
+               formspec=formspec.."field[0.5,1.5;7,1;channel;"..attrans("Digiline channel")..";"..minetest.formspec_escape(channel).."]"
        end
-       return formspec.."button_exit[0.5,4.5;7,1;save;Save]"
+       return formspec.."button_exit[0.5,4.5;7,1;save;"..attrans("Save").."]"
 end
 
 --from trainlogic.lua train step
@@ -142,7 +150,7 @@ local matchptn={
                train.tarvelocity=train.max_speed
                return 2
        end,
-       ["S([0-9]+)"]=function(id, train, match)
+       ["attrans([0-9]+)"]=function(id, train, match)
                train.tarvelocity=tonumber(match)
                return #match+1
        end,
@@ -168,7 +176,7 @@ local matchptn={
                        train.movedir=train.movedir*-1
                        train.atc_arrow = not train.atc_arrow
                else
-                       minetest.chat_send_all("ATC Reverse command warning: didn't reverse train!")
+                       minetest.chat_send_all(attrans("ATC Reverse command warning: didn't reverse train, train moving!"))
                end
                return 1
        end,
@@ -227,7 +235,7 @@ function atc.execute_atc_command(id, train)
                local nest, pos, elsepos=0, 1
                while nest>=0 do
                        if pos>#rest then
-                               minetest.chat_send_all("ATC command syntax error: I statement not closed: "..command)
+                               minetest.chat_send_all(attrans("ATC command syntax error: I statement not closed: @1",command))
                                atc.train_reset_command(id)
                                return
                        end
@@ -270,7 +278,7 @@ function atc.execute_atc_command(id, train)
                        end
                end
        end
-       minetest.chat_send_all("ATC command parse error: "..command)
+       minetest.chat_send_all(attrans("ATC command parse error: Unknown command: @1", command))
        atc.train_reset_command(id)
 end
 
index c0dea84..b50eec9 100644 (file)
@@ -38,7 +38,7 @@ minetest.register_entity("advtrains:discouple", {
                                if le and le.is_wagon then
                                        if le.unique_id==nextwgn_id then
                                                if le.owner and le.owner~=own then
-                                                       minetest.chat_send_player(own, "You need to own at least one neighboring wagon to destroy this couple.")
+                                                       minetest.chat_send_player(own, attrans("You need to own at least one neighboring wagon to destroy this couple."))
                                                        return
                                                end
                                        end
@@ -47,7 +47,7 @@ minetest.register_entity("advtrains:discouple", {
                        advtrains.split_train_at_wagon(self.wagon)--found in trainlogic.lua
                        self.object:remove()
                else
-                       minetest.chat_send_player(own, "You need to own at least one neighboring wagon to destroy this couple.")
+                       minetest.chat_send_player(own, attrans("You need to own at least one neighboring wagon to destroy this couple."))
                end
        end,
        on_step=function(self, dtime)
index 11824f7..15b9b08 100644 (file)
@@ -1,3 +1,10 @@
+-- Boilerplate to support localized strings if intllib mod is installed.
+if minetest.get_modpath("intllib") then
+    attrans = intllib.Getter()
+else
+    attrans = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
+end
+
 --advtrains
 
 advtrains = {trains={}, wagon_save={}}
@@ -176,7 +183,3 @@ advtrains.save = function()
        file:close()
 end
 minetest.register_on_shutdown(advtrains.save)
-
-
-
-
diff --git a/advtrains/advtrains/locale/de.txt b/advtrains/advtrains/locale/de.txt
new file mode 100644 (file)
index 0000000..5d67cd2
--- /dev/null
@@ -0,0 +1,41 @@
+This wagon is owned by @1, you can't destroy it. = Dieser Waggon gehört @1, du kannst ihn nicht abbauen.
+Warning: If you destroy this wagon, you only get some steel back! If you are sure, shift-leftclick the wagon. = Warnung: Du erhältst nur etwas Stahl zurück. Wenn du sicher bist, dass du den Waggon zerstören willst, halte 'Schleichen' und klicke links.
+Show Inventory = Zeige Inventar
+Select seat: = Wähle einen Sitzplatz aus:
+ATC controller, unconfigured. = Zugbeeinflussungsschiene, nicht konfiguiert.
+ATC controller = Zugbeeinflussungsschiene
+ATC controller, mode @1\nChannel: @2 = Zugbeeinflussungsschiene in Betriebsart "@1"\nKanal: @2
+ATC controller, mode @1\nCommand: @2 = Zugbeeinflussungsschiene in Betriebsart "@1"\nBefehl: @2
+Command = Befehl
+Command (on) = Befehl (wenn ein)
+Digiline channel = Digiline-Kanal
+Save = Speichern
+ATC Reverse command warning: didn't reverse train, train moving! = Zugbeeinflussung - Warnung: Befehl 'R' nicht ausgeführt, Zug in Bewegung!
+ATC command syntax error: I statement not closed: @1 = Zugbeeinflussung - Syntaxfehler: I-Anweisung nicht geschlossen: @1
+ATC command parse error: Unknown command: @1 = Zugbeeinflussung - Fehler: Unbekannter Befehl: @1
+This position is protected! = Diese Position ist geschützt!
+You need to own at least one neighboring wagon to destroy this couple. = Du musst Besitzer eines angrenzenden Waggons sein, um hier abzukuppeln.
+@1 Platform (low) = Niedriger @1-Bahnsteig
+@1 Platform (high) = Hoher @1-Bahnsteig
+off = aus
+on = ein
+Lampless Signal (@1) = Mechanisches Signal (@1)
+Signal (@1) = Lichtsignal (@1)
+Track Worker Tool\n\nLeft-click: change rail type (straight/curve/switch)\nRight-click: rotate rail/bumper/signal/etc. = Schienenwerkzeug\n\nLinksklick: Schienentyp ändern, Rechtsklick: Objekt drehen.
+This node can't be rotated using the trackworker! = Kann diesen Block nicht mit dem Schienenwerkzeug drehen.
+This node can't be changed using the trackworker! = Kann diesen Block nicht mit dem Schienenwerkzeug bearbeiten.
+Can't place: not pointing at node = Kann nicht platzieren: Du zeigst nicht auf einen Block.
+Can't place: space occupied! = Kann nicht platzieren: Platz besetzt.
+Can't place: protected position! = Kann nicht platzieren: Position geschützt.
+Can't place: Not enough slope items left (@1 required) = Kann nicht platzieren: nicht genug Steigungsblöcke, es werden insgesamt @1 benötigt.
+Can't place: There's no slope of length @1 = Kann nicht platzieren: Keine Steigung der Länge @1 definiert.
+Can't place: no supporting node at upper end. = Kann nicht platzieren: kein unterstützender Block am Ende der Steigung.
+Deprecated Track = ausrangierte Schiene, nicht verwenden.
+Track = Schiene
+Bumper = Prellbock
+Detector Rail = Detektorschiene
+Speed: = Geschw.:
+Target: = Zielges.:
+@1 Slope = @1 Steigung
+
+
index 70b18fb..37f535d 100644 (file)
@@ -13,7 +13,7 @@ function advtrains.register_platform(preset)
        local desc=ndef.description or ""
        local nodename=string.match(preset, ":(.+)$")
        minetest.register_node("advtrains:platform_low_"..nodename, {
-               description = desc.." Platform (low)",
+               description = attrans("@1 Platform (low)", desc),
                tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex},
                groups = {cracky = 1, not_blocking_trains = 1, platform=1},
                sounds = default.node_sound_stone_defaults(),
@@ -30,7 +30,7 @@ function advtrains.register_platform(preset)
                sunlight_propagates = true,
        })
        minetest.register_node("advtrains:platform_high_"..nodename, {
-               description = desc.." Platform (high)",
+               description = attrans("@1 Platform (high)", desc),
                tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex},
                groups = {cracky = 1, not_blocking_trains = 1, platform=2},
                sounds = default.node_sound_stone_defaults(),
index 74a775e..537451b 100644 (file)
@@ -1,2 +1,3 @@
 #    Whether to print debug information on advtrains to chat and debug.txt
+#    Ob Debuginformationen in die Chatkonsole und debug.txt ausgegeben werden sollen
 advtrains_debug (Print advtrains debug messages) bool false
\ No newline at end of file
index 1a5a2b0..d521c8a 100644 (file)
@@ -22,7 +22,7 @@ for r,f in pairs({on="off", off="on"}) do
                        tiles = {"advtrains_retrosignal.png"},
                        inventory_image="advtrains_retrosignal_inv.png",
                        drop="advtrains:retrosignal_off",
-                       description="Lampless Signal ("..r..rotation..")",
+                       description=attrans("Lampless Signal (@1)", attrans(r..rotation)),
                        on_rightclick=switchfunc,
                        sunlight_propagates=true,
                        groups = {
@@ -54,7 +54,7 @@ for r,f in pairs({on="off", off="on"}) do
                        tiles = {"advtrains_signal_"..r..".png"},
                        inventory_image="advtrains_signal_inv.png",
                        drop="advtrains:signal_off",
-                       description="Signal ("..r..rotation..")",
+                       description=attrans("Signal (@1)", attrans(r..rotation)),
                        on_rightclick=switchfunc,
                        groups = {
                                choppy=3,
index 1cb7680..d1045aa 100644 (file)
@@ -212,7 +212,7 @@ end
 
 
 minetest.register_craftitem("advtrains:trackworker",{
-       description = "Track Worker Tool\n\nLeft-click: change rail type (straight/curve/switch)\nRight-click: rotate rail/bumper/signal/etc.",
+       description = attrans("Track Worker Tool\n\nLeft-click: change rail type (straight/curve/switch)\nRight-click: rotate rail/bumper/signal/etc."),
        groups = {cracky=1}, -- key=name, value=rating; rating=1..3.
        inventory_image = "advtrains_trackworker.png",
        wield_image = "advtrains_trackworker.png",
@@ -238,7 +238,7 @@ minetest.register_craftitem("advtrains:trackworker",{
                                nnprefix, suffix=string.match(node.name, "^(.+)_([^_]+)$")
                                rotation = ""
                                if not tp.tracks[nnprefix] or not tp.tracks[nnprefix].twrotate[suffix] then
-                                       minetest.chat_send_player(placer:get_player_name(), "This node can't be rotated using the trackworker!")
+                                       minetest.chat_send_player(placer:get_player_name(), attrans("This node can't be rotated using the trackworker!"))
                                        return
                                end
                        end
@@ -251,7 +251,7 @@ minetest.register_craftitem("advtrains:trackworker",{
                                local modpos
                                for k,v in pairs(modext) do if v==rotation then modpos=k end end
                                        if not modpos then
-                                               minetest.chat_send_player(placer:get_player_name(), "This node can't be rotated using the trackworker!")
+                                               minetest.chat_send_player(placer:get_player_name(), attrans("This node can't be rotated using the trackworker!"))
                                        return
                                end
                                advtrains.ndb.swap_node(pos, {name=nnprefix.."_"..suffix..modext[modpos+1], param2=node.param2})
@@ -279,7 +279,7 @@ minetest.register_craftitem("advtrains:trackworker",{
                          nnprefix, suffix=string.match(node.name, "^(.+)_([^_]+)$")
                          rotation = ""
                          if not tp.tracks[nnprefix] or not tp.tracks[nnprefix].twcycle[suffix] then
-                           minetest.chat_send_player(user:get_player_name(), "This node can't be changed using the trackworker!")
+                           minetest.chat_send_player(user:get_player_name(), attrans("This node can't be changed using the trackworker!"))
                            return
                          end
                    end
index 1108a06..3f170f5 100644 (file)
@@ -483,7 +483,7 @@ end
 local sl={}\r
 function sl.register_placer(def, preset)\r
        minetest.register_craftitem(def.nodename_prefix.."_slopeplacer",{\r
-               description = def.description.." Slope",\r
+               description = attrans("@1 Slope", def.description),\r
                inventory_image = def.texture_prefix.."_slopeplacer.png",\r
                wield_image = def.texture_prefix.."_slopeplacer.png",\r
                groups={},\r
@@ -494,21 +494,21 @@ end
 function sl.create_slopeplacer_on_place(def, preset)\r
        return function(istack, player, pt)\r
                if not pt.type=="node" then \r
-                       minetest.chat_send_player(player:get_player_name(), "Can't place: not pointing at node")\r
+                       minetest.chat_send_player(player:get_player_name(), attrans("Can't place: not pointing at node"))\r
                        return istack \r
                end\r
                local pos=pt.above\r
                if not pos then \r
-                       minetest.chat_send_player(player:get_player_name(), "Can't place: not pointing at node")\r
+                       minetest.chat_send_player(player:get_player_name(), attrans("Can't place: not pointing at node"))\r
                        return istack\r
                end\r
                local node=minetest.get_node(pos)\r
                if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].buildable_to then\r
-                       minetest.chat_send_player(player:get_player_name(), "Can't place: space occupied!")\r
+                       minetest.chat_send_player(player:get_player_name(), attrans("Can't place: space occupied!"))\r
                        return istack\r
                end\r
                if minetest.is_protected(pos, player:get_player_name()) then \r
-                       minetest.chat_send_player(player:get_player_name(), "Can't place: protected position!")\r
+                       minetest.chat_send_player(player:get_player_name(), attrans("Can't place: protected position!"))\r
                        return istack\r
                end\r
                --determine player orientation (only horizontal component)\r
@@ -557,17 +557,17 @@ function sl.create_slopeplacer_on_place(def, preset)
                                                        pos=vector.subtract(pos, dirvec)\r
                                                end\r
                                        else\r
-                                               minetest.chat_send_player(player:get_player_name(), "Can't place: Not enough slope items left ("..step.." required)")\r
+                                               minetest.chat_send_player(player:get_player_name(), attrans("Can't place: Not enough slope items left (@1 required)", step))\r
                                        end\r
                                else\r
-                                       minetest.chat_send_player(player:get_player_name(), "Can't place: There's no slope of length "..step)\r
+                                       minetest.chat_send_player(player:get_player_name(), attrans("Can't place: There's no slope of length @1",step))\r
                                end\r
                                return istack\r
                        end\r
                        step=step+1\r
                        pos=vector.add(pos, dirvec)\r
                end\r
-               minetest.chat_send_player(player:get_player_name(), "Can't place: no supporting node at upper end.")\r
+               minetest.chat_send_player(player:get_player_name(), attrans("Can't place: no supporting node at upper end."))\r
                return itemstack\r
        end\r
 end\r
@@ -594,7 +594,7 @@ advtrains.register_tracks("regular", {
        nodename_prefix="advtrains:track",\r
        texture_prefix="advtrains_track",\r
        shared_model="trackplane.b3d",\r
-       description="Deprecated Track",\r
+       description=attrans("Deprecated Track"),\r
        formats={vst1={}, vst2={}},\r
 }, ap.t_45deg)\r
 \r
@@ -605,7 +605,7 @@ advtrains.register_tracks("default", {
        models_prefix="advtrains_dtrack",\r
        models_suffix=".b3d",\r
        shared_texture="advtrains_dtrack_rail.png",\r
-       description="Track",\r
+       description=attrans("Track"),\r
        formats={vst1={true, false, true}, vst2={true, false, true}, vst31={true}, vst32={true}, vst33={true}},\r
 }, ap.t_30deg)\r
 \r
@@ -616,7 +616,7 @@ advtrains.register_tracks("default", {
        models_prefix="advtrains_dtrack_bumper",\r
        models_suffix=".b3d",\r
        shared_texture="advtrains_dtrack_rail.png",\r
-       description="Bumper",\r
+       description=attrans("Bumper"),\r
        formats={},\r
 }, ap.t_30deg_straightonly)\r
 --legacy bumpers\r
@@ -631,7 +631,7 @@ if mesecon then
                models_prefix="advtrains_dtrack_detector",\r
                models_suffix=".b3d",\r
                shared_texture="advtrains_dtrack_rail.png",\r
-               description="Detector Rail",\r
+               description=attrans("Detector Rail"),\r
                formats={},\r
                get_additional_definiton = function(def, preset, suffix, rotation)\r
                        return {\r
index 3830b65..637fce2 100644 (file)
@@ -117,8 +117,8 @@ function advtrains.hud_train_format(train, flip)
        local topLine, firstLine, secondLine
        
        topLine="  ["..mletter[fct*train.movedir].."]  "..doorstr[(train.door_open or 0) * train.movedir].."  "..(train.brake and "="..( train.brake_hold_state==2 and "^" or "" ).."B=" or "")
-       firstLine="Speed: |"..string.rep("+", vel)..string.rep("_", max-vel)..">"
-       secondLine="Target: |"..string.rep("+", tvel)..string.rep("_", max-tvel)..">"
+       firstLine=attrans("Speed:").." |"..string.rep("+", vel)..string.rep("_", max-vel)..">"
+       secondLine=attrans("Target:").." |"..string.rep("+", tvel)..string.rep("_", max-tvel)..">"
        
        return topLine.."\n"..firstLine.."\n"..secondLine
 end
index b46ed81..2729fd0 100644 (file)
@@ -184,7 +184,7 @@ function wagon:on_punch(puncher, time_from_last_punch, tool_capabilities, direct
                return\r
        end\r
        if self.owner and puncher:get_player_name()~=self.owner and (not minetest.check_player_privs(puncher, {train_remove = true })) then\r
-          minetest.chat_send_player(puncher:get_player_name(), "This wagon is owned by "..self.owner..", you can't destroy it.");\r
+          minetest.chat_send_player(puncher:get_player_name(), attrans("This wagon is owned by @1, you can't destroy it.", self.owner));\r
           return\r
        end\r
        \r
@@ -198,7 +198,7 @@ function wagon:on_punch(puncher, time_from_last_punch, tool_capabilities, direct
        else\r
                local pc=puncher:get_player_control()\r
                if not pc.sneak then\r
-                       minetest.chat_send_player(puncher:get_player_name(), "Warning: If you destroy this wagon, you only get some steel back! If you are sure, shift-leftclick the wagon.")\r
+                       minetest.chat_send_player(puncher:get_player_name(), attrans("Warning: If you destroy this wagon, you only get some steel back! If you are sure, shift-leftclick the wagon."))\r
                        return\r
                end\r
 \r
@@ -523,7 +523,7 @@ function wagon:show_get_on_form(pname)
                end\r
                return\r
        end\r
-       local form, comma="size[5,8]label[0.5,0.5;Select seat:]textlist[0.5,1;4,6;seat;", ""\r
+       local form, comma="size[5,8]label[0.5,0.5;"..attrans("Select seat:").."]textlist[0.5,1;4,6;seat;", ""\r
        for seatno, seattbl in ipairs(self.seats) do\r
                local addtext, colorcode="", ""\r
                if self.seatp and self.seatp[seatno] then\r
@@ -535,7 +535,7 @@ function wagon:show_get_on_form(pname)
        end\r
        form=form..";0,false]"\r
        if self.has_inventory and self.get_inventory_formspec then\r
-               form=form.."button_exit[1,7;3,1;inv;Show Inventory]"\r
+               form=form.."button_exit[1,7;3,1;inv;"..attrans("Show Inventory").."]"\r
        end\r
        minetest.show_formspec(pname, "advtrains_geton_"..self.unique_id, form)\r
 end\r
index 379832c..8b13cfe 100644 (file)
@@ -1,3 +1,11 @@
+-- Boilerplate to support localized strings if intllib mod is installed.
+local S
+if minetest.get_modpath("intllib") then
+    S = intllib.Getter()
+else
+    S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
+end
+
 advtrains.register_wagon("engine_industrial", {
        mesh="advtrains_engine_industrial.b3d",
        textures = {"advtrains_engine_industrial.png"},
@@ -5,13 +13,13 @@ advtrains.register_wagon("engine_industrial", {
        max_speed=20,
        seats = {
                {
-                       name="Driver Stand (left)",
+                       name=S("Driver Stand (left)"),
                        attach_offset={x=-5, y=10, z=-10},
                        view_offset={x=0, y=10, z=0},
                        driving_ctrl_access=true,
                },
                {
-                       name="Driver Stand (right)",
+                       name=S("Driver Stand (right)"),
                        attach_offset={x=5, y=10, z=-10},
                        view_offset={x=0, y=10, z=0},
                        driving_ctrl_access=true,
@@ -22,7 +30,7 @@ advtrains.register_wagon("engine_industrial", {
        is_locomotive=true,
        collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
        drops={"default:steelblock 4"},
-}, "Industrial Train Engine", "advtrains_engine_industrial_inv.png")
+}, S("Industrial Train Engine"), "advtrains_engine_industrial_inv.png")
 advtrains.register_wagon("wagon_tank", {
        mesh="advtrains_wagon_tank.b3d",
        textures = {"advtrains_wagon_tank.png"},
@@ -43,7 +51,7 @@ advtrains.register_wagon("wagon_tank", {
        inventory_list_sizes = {
                box=8*6,
        },
-}, "Industrial tank wagon", "advtrains_wagon_tank_inv.png")
+}, S("Industrial tank wagon"), "advtrains_wagon_tank_inv.png")
 advtrains.register_wagon("wagon_wood", {
        mesh="advtrains_wagon_wood.b3d",
        textures = {"advtrains_wagon_wood.png"},
@@ -64,4 +72,4 @@ advtrains.register_wagon("wagon_wood", {
        inventory_list_sizes = {
                box=8*6,
        },
-}, "Industrial wood wagon", "advtrains_wagon_wood_inv.png")
+}, S("Industrial wood wagon"), "advtrains_wagon_wood_inv.png")
diff --git a/advtrains/advtrains_train_industrial/locale/de.txt b/advtrains/advtrains_train_industrial/locale/de.txt
new file mode 100644 (file)
index 0000000..a45ca27
--- /dev/null
@@ -0,0 +1,5 @@
+Driver Stand (left) = Führerstand Links
+Driver Stand (right) = Führerstand Rechts
+Industrial Train Engine = Industrielle Lokomotive
+Industrial tank wagon = Tankwaggon
+Industrial wood wagon = Holztransportwaggon
\ No newline at end of file
index 47f50cf..a0c82cd 100644 (file)
@@ -1,3 +1,10 @@
+local S
+if minetest.get_modpath("intllib") then
+    S = intllib.Getter()
+else
+    S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
+end
+
 advtrains.register_wagon("engine_japan", {
        mesh="advtrains_engine_japan.b3d",
        textures = {"advtrains_engine_japan.png"},
@@ -5,7 +12,7 @@ advtrains.register_wagon("engine_japan", {
        max_speed=20,
        seats = {
                {
-                       name="Default Seat (driver stand)",
+                       name=S("Driver stand"),
                        attach_offset={x=0, y=10, z=0},
                        view_offset={x=0, y=6, z=0},
                        driving_ctrl_access=true,
@@ -16,7 +23,7 @@ advtrains.register_wagon("engine_japan", {
        is_locomotive=true,
        collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
        drops={"default:steelblock 4"},
-}, "Japanese Train Engine", "advtrains_engine_japan_inv.png")
+}, S("Japanese Train Engine"), "advtrains_engine_japan_inv.png")
 
 advtrains.register_wagon("wagon_japan", {
        mesh="advtrains_wagon_japan.b3d",
@@ -25,7 +32,7 @@ advtrains.register_wagon("wagon_japan", {
        max_speed=20,
        seats = {
                {
-                       name="Default Seat",
+                       name=S("Default Seat"),
                        attach_offset={x=0, y=10, z=0},
                        view_offset={x=0, y=6, z=0},
                },
@@ -34,5 +41,5 @@ advtrains.register_wagon("wagon_japan", {
        wagon_span=2.3,
        collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
        drops={"default:steelblock 4"},
-}, "Japanese Train Wagon", "advtrains_wagon_japan_inv.png")
+}, S("Japanese Train Wagon"), "advtrains_wagon_japan_inv.png")
 
diff --git a/advtrains/advtrains_train_japan/locale/de.txt b/advtrains/advtrains_train_japan/locale/de.txt
new file mode 100644 (file)
index 0000000..63d7a97
--- /dev/null
@@ -0,0 +1,4 @@
+Driver Stand = Führerstand
+Japanese Train Engine = Japanische Personenzug-Lokomotive
+Default Seat = Standardsitzplatz
+Japanese Train Wagon = Japanischer Personenzug-Passagierwaggon
\ No newline at end of file
index 22f525f..ca366db 100644 (file)
@@ -1,3 +1,10 @@
+local S
+if minetest.get_modpath("intllib") then
+    S = intllib.Getter()
+else
+    S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
+end
+
 advtrains.register_wagon("newlocomotive", {
        mesh="advtrains_engine_steam.b3d",
        textures = {"advtrains_engine_steam.png"},
@@ -6,13 +13,13 @@ advtrains.register_wagon("newlocomotive", {
        max_speed=10,
        seats = {
                {
-                       name="Driver Stand (left)",
+                       name=S("Driver Stand (left)"),
                        attach_offset={x=-5, y=10, z=-10},
                        view_offset={x=0, y=6, z=0},
                        driving_ctrl_access=true,
                },
                {
-                       name="Driver Stand (right)",
+                       name=S("Driver Stand (right)"),
                        attach_offset={x=5, y=10, z=-10},
                        view_offset={x=0, y=6, z=0},
                        driving_ctrl_access=true,
@@ -55,7 +62,7 @@ advtrains.register_wagon("newlocomotive", {
                })
        end,
        drops={"default:steelblock 4"},
-}, "Steam Engine", "advtrains_engine_steam_inv.png")
+}, S("Steam Engine"), "advtrains_engine_steam_inv.png")
 
 advtrains.register_wagon("detailed_steam_engine", {
        mesh="advtrains_detailed_steam_engine.b3d",
@@ -65,13 +72,13 @@ advtrains.register_wagon("detailed_steam_engine", {
        max_speed=10,
        seats = {
                {
-                       name="Driver Stand (left)",
+                       name=S("Driver Stand (left)"),
                        attach_offset={x=-5, y=10, z=-10},
                        view_offset={x=0, y=6, z=0},
                        driving_ctrl_access=true,
                },
                {
-                       name="Driver Stand (right)",
+                       name=S("Driver Stand (right)"),
                        attach_offset={x=5, y=10, z=-10},
                        view_offset={x=0, y=6, z=0},
                        driving_ctrl_access=true,
@@ -114,7 +121,7 @@ advtrains.register_wagon("detailed_steam_engine", {
                })
        end,
        drops={"default:steelblock 4"},
-}, "Detailed Steam Engine", "advtrains_engine_steam_inv.png")
+}, S("Detailed Steam Engine"), "advtrains_engine_steam_inv.png")
 
 advtrains.register_wagon("wagon_default", {
        mesh="advtrains_passenger_wagon.b3d",
@@ -147,7 +154,7 @@ advtrains.register_wagon("wagon_default", {
        wagon_span=3.1,
        collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
        drops={"default:steelblock 4"},
-}, "Passenger Wagon", "advtrains_wagon_inv.png")
+}, S("Passenger Wagon"), "advtrains_wagon_inv.png")
 advtrains.register_wagon("wagon_box", {
        mesh="advtrains_wagon.b3d",
        textures = {"advtrains_wagon_box.png"},
@@ -168,7 +175,7 @@ advtrains.register_wagon("wagon_box", {
        inventory_list_sizes = {
                box=8*6,
        },
-}, "Box Wagon", "advtrains_wagon_box_inv.png")
+}, S("Box Wagon"), "advtrains_wagon_box_inv.png")
 
 minetest.register_craft({
        output = 'advtrains:newlocomotive',
diff --git a/advtrains/advtrains_train_steam/locale/de.txt b/advtrains/advtrains_train_steam/locale/de.txt
new file mode 100644 (file)
index 0000000..ac06e20
--- /dev/null
@@ -0,0 +1,6 @@
+Driver Stand (left) = Führerstand Links
+Driver Stand (right) = Führerstand Rechts
+Steam Engine = Dampflokomotive
+Detailed Steam Engine = detaillierte Dampflokomotive
+Passenger Wagon = Passagierwaggon
+Box wagon = Güterwaggon
\ No newline at end of file
index 85bd28f..53e0a70 100644 (file)
@@ -1,3 +1,9 @@
+local S
+if minetest.get_modpath("intllib") then
+    S = intllib.Getter()
+else
+    S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
+end
 
 advtrains.register_wagon("subway_wagon", {
        mesh="advtrains_subway_wagon.b3d",
@@ -31,7 +37,7 @@ advtrains.register_wagon("subway_wagon", {
        --      atprint("subway custom_on_activate")
        --      self.object:set_animation({x=1,y=80}, 15, 0, true)
        --end,
-}, "Subway Passenger Wagon", "advtrains_subway_wagon_inv.png")
+}, S("Subway Passenger Wagon"), "advtrains_subway_wagon_inv.png")
 
 --wagons
 minetest.register_craft({
diff --git a/advtrains/advtrains_train_subway/locale/de.txt b/advtrains/advtrains_train_subway/locale/de.txt
new file mode 100644 (file)
index 0000000..4aceebd
--- /dev/null
@@ -0,0 +1,2 @@
+Default Seat (driver stand) = Standardsitzplatz (Führerstand)
+Subway Passenger Wagon = U-Bahn-Waggon
\ No newline at end of file