diff options
Diffstat (limited to 'quartz')
-rw-r--r-- | quartz/depends.txt | 1 | ||||
-rw-r--r-- | quartz/init.lua | 26 | ||||
-rw-r--r-- | quartz/intllib.lua | 45 | ||||
-rw-r--r-- | quartz/locale/es.po | 59 | ||||
-rw-r--r-- | quartz/locale/template.pot | 57 |
5 files changed, 177 insertions, 11 deletions
diff --git a/quartz/depends.txt b/quartz/depends.txt index 4451908..c2a3e1b 100644 --- a/quartz/depends.txt +++ b/quartz/depends.txt @@ -1,3 +1,4 @@ default stairs moreblocks? +intllib?
\ No newline at end of file diff --git a/quartz/init.lua b/quartz/init.lua index 63be0c5..c2870a7 100644 --- a/quartz/init.lua +++ b/quartz/init.lua @@ -1,16 +1,20 @@ local settings = Settings(minetest.get_modpath("quartz").."/settings.txt") +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + -- -- Item Registration -- -- Quartz Crystal minetest.register_craftitem("quartz:quartz_crystal", { - description = "Quartz Crystal", + description = S("Quartz Crystal"), inventory_image = "quartz_crystal_full.png", }) minetest.register_craftitem("quartz:quartz_crystal_piece", { - description = "Quartz Crystal Piece", + description = S("Quartz Crystal Piece"), inventory_image = "quartz_crystal_piece.png", }) @@ -20,7 +24,7 @@ minetest.register_craftitem("quartz:quartz_crystal_piece", { -- Ore minetest.register_node("quartz:quartz_ore", { - description = "Quartz Ore", + description = S("Quartz Ore"), tiles = {"default_stone.png^quartz_ore.png"}, groups = {cracky=3, stone=1}, drop = 'quartz:quartz_crystal', @@ -40,7 +44,7 @@ minetest.register_ore({ -- Quartz Block minetest.register_node("quartz:block", { - description = "Quartz Block", + description = S("Quartz Block"), tiles = {"quartz_block.png"}, groups = {cracky=3, oddly_breakable_by_hand=1}, sounds = default.node_sound_glass_defaults(), @@ -48,7 +52,7 @@ minetest.register_node("quartz:block", { -- Chiseled Quartz minetest.register_node("quartz:chiseled", { - description = "Chiseled Quartz", + description = S("Chiseled Quartz"), tiles = {"quartz_chiseled.png"}, groups = {cracky=3, oddly_breakable_by_hand=1}, sounds = default.node_sound_glass_defaults(), @@ -56,7 +60,7 @@ minetest.register_node("quartz:chiseled", { -- Quartz Pillar minetest.register_node("quartz:pillar", { - description = "Quartz Pillar", + description = S("Quartz Pillar"), paramtype2 = "facedir", tiles = {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"}, groups = {cracky=3, oddly_breakable_by_hand=1}, @@ -68,15 +72,15 @@ minetest.register_node("quartz:pillar", { stairs.register_stair_and_slab("quartzblock", "quartz:block", {cracky=3, oddly_breakable_by_hand=1}, {"quartz_block.png"}, - "Quartz stair", - "Quartz slab", + S("Quartz stair"), + S("Quartz slab"), default.node_sound_glass_defaults()) -stairs.register_slab("quartzstair", "quartz:pillar", +stairs.register_stair_and_slab("quartzstair", "quartz:pillar", {cracky=3, oddly_breakable_by_hand=1}, {"quartz_pillar_top.png", "quartz_pillar_top.png", "quartz_pillar_side.png"}, - "Quartz Pillar stair", - "Quartz Pillar slab", + S("Quartz Pillar stair"), + S("Quartz Pillar slab"), default.node_sound_glass_defaults()) -- diff --git a/quartz/intllib.lua b/quartz/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/quartz/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense <http://unlicense.org>. + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/quartz/locale/es.po b/quartz/locale/es.po new file mode 100644 index 0000000..ee67dc3 --- /dev/null +++ b/quartz/locale/es.po @@ -0,0 +1,59 @@ +# Spanish translations for PACKAGE package +# Traducciones al español para el paquete PACKAGE. +# Copyright (C) 2017 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Diego Martínez <kaeza@users.noreply.github.com>, 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-19 21:50-0700\n" +"PO-Revision-Date: 2017-02-20 15:03-0300\n" +"Last-Translator: Diego Martínez <kaeza@users.noreply.github.com>\n" +"Language-Team: Spanish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: init.lua:13 +msgid "Quartz Crystal" +msgstr "Cristal de cuarzo" + +#: init.lua:17 +msgid "Quartz Crystal Piece" +msgstr "Trozo de cristal de cuarzo" + +#: init.lua:27 +msgid "Quartz Ore" +msgstr "Mineral de cuarzo" + +#: init.lua:47 +msgid "Quartz Block" +msgstr "Bloque de cuarzo" + +#: init.lua:55 +msgid "Chiseled Quartz" +msgstr "Cuarzo cincelado" + +#: init.lua:63 +msgid "Quartz Pillar" +msgstr "Pilar de cuarzo" + +#: init.lua:75 +msgid "Quartz stair" +msgstr "Escaleras de cuarzo" + +#: init.lua:76 +msgid "Quartz slab" +msgstr "Losa de cuarzo" + +#: init.lua:82 +msgid "Quartz Pillar stair" +msgstr "Escaleras de pilar de cuarzo" + +#: init.lua:83 +msgid "Quartz Pillar slab" +msgstr "Losa de pilar de cuarzo" diff --git a/quartz/locale/template.pot b/quartz/locale/template.pot new file mode 100644 index 0000000..9c78dda --- /dev/null +++ b/quartz/locale/template.pot @@ -0,0 +1,57 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-19 21:50-0700\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: init.lua:13 +msgid "Quartz Crystal" +msgstr "" + +#: init.lua:17 +msgid "Quartz Crystal Piece" +msgstr "" + +#: init.lua:27 +msgid "Quartz Ore" +msgstr "" + +#: init.lua:47 +msgid "Quartz Block" +msgstr "" + +#: init.lua:55 +msgid "Chiseled Quartz" +msgstr "" + +#: init.lua:63 +msgid "Quartz Pillar" +msgstr "" + +#: init.lua:75 +msgid "Quartz stair" +msgstr "" + +#: init.lua:76 +msgid "Quartz slab" +msgstr "" + +#: init.lua:82 +msgid "Quartz Pillar stair" +msgstr "" + +#: init.lua:83 +msgid "Quartz Pillar slab" +msgstr "" |