summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Martínez <kaeza@users.noreply.github.com>2017-01-24 00:40:48 -0300
committerDiego Martínez <kaeza@users.noreply.github.com>2017-01-24 00:48:19 -0300
commit172a4e127c72c60c8be63b747e05fb6c04d1e5da (patch)
tree3249cc494ebbb2f37d7f180180dba021496e09d8
parentb2551f6a2209b8a11b42834cb0d63f5c03a2b95f (diff)
Add minimal example mod.
-rw-r--r--intltest/README.md10
-rw-r--r--intltest/depends.txt1
-rw-r--r--intltest/init.lua28
-rw-r--r--intltest/intllib.lua3
-rw-r--r--intltest/locale/es.po40
-rw-r--r--intltest/locale/template.pot41
6 files changed, 123 insertions, 0 deletions
diff --git a/intltest/README.md b/intltest/README.md
new file mode 100644
index 0000000..9122d9e
--- /dev/null
+++ b/intltest/README.md
@@ -0,0 +1,10 @@
+
+# Intllib example
+
+This is a simple mod showing how to use intllib.
+
+It defines a test `intltest:test` item whose description is translated
+according to the user's language.
+
+Additionally, it demonstrates how to use plural forms by counting the
+number of times the item has been used.
diff --git a/intltest/depends.txt b/intltest/depends.txt
new file mode 100644
index 0000000..77e8d97
--- /dev/null
+++ b/intltest/depends.txt
@@ -0,0 +1 @@
+intllib?
diff --git a/intltest/init.lua b/intltest/init.lua
new file mode 100644
index 0000000..e855621
--- /dev/null
+++ b/intltest/init.lua
@@ -0,0 +1,28 @@
+
+-- Load support for intllib.
+local MP = minetest.get_modpath(minetest.get_current_modname())
+local S, NS = dofile(MP.."/intllib.lua")
+
+local use_count = 0
+
+minetest.log("action", S("Hello, world!"))
+
+minetest.register_craftitem("intltest:test", {
+ -- Example use of replacements.
+ -- Translators: @1 is color, @2 is object.
+ description = S("Test: @1 @2", S("Blue"), S("Car")),
+
+ inventory_image = "default_sand.png",
+
+ on_use = function(stack, user, pt)
+ use_count = use_count + 1
+ -- Example use of `ngettext` function.
+ -- First `use_count` is `n` for ngettext;
+ -- Second one is actual replacement.
+ -- Translators: @1 is use count.
+ local message = NS("Item has been used @1 time.",
+ "Item has been used @1 times.",
+ use_count, use_count)
+ minetest.chat_send_player(user:get_player_name(), message)
+ end,
+})
diff --git a/intltest/intllib.lua b/intltest/intllib.lua
new file mode 100644
index 0000000..c2eb8dc
--- /dev/null
+++ b/intltest/intllib.lua
@@ -0,0 +1,3 @@
+
+-- This file should be replaced by `intllib/lib/intllib.lua`.
+return dofile(minetest.get_modpath("intllib").."/lib/intllib.lua")
diff --git a/intltest/locale/es.po b/intltest/locale/es.po
new file mode 100644
index 0000000..4638ff9
--- /dev/null
+++ b/intltest/locale/es.po
@@ -0,0 +1,40 @@
+# I18N Test Mod.
+# Copyright (C) 2013-2017 Diego Martínez <kaeza@users.sf.net>
+# This file is distributed under the same license as the intllib mod.
+# Diego Martínez <kaeza@users.sf.net>, 2013-2017.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: I18N Test Mod 0.1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-01-24 00:46-0300\n"
+"PO-Revision-Date: 2017-01-23 17:36-0300\n"
+"Last-Translator: Diego Martnez <kaeza@users.sf.net>\n"
+"Language-Team: Spanish\n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ASCII\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: init.lua:8
+msgid "Hello, world!"
+msgstr "¡Hola, mundo!"
+
+#: init.lua:13
+msgid "Blue"
+msgstr "Azul"
+
+#: init.lua:13
+msgid "Car"
+msgstr "Carro"
+
+#: init.lua:13
+msgid "Test: @1 @2"
+msgstr "Prueba: @2 @1"
+
+#: init.lua:23
+msgid "Item has been used @1 time."
+msgid_plural "Item has been used @1 times."
+msgstr[0] "El objeto ha sido usado @1 vez."
+msgstr[1] "El objeto ha sido usado @1 veces."
diff --git a/intltest/locale/template.pot b/intltest/locale/template.pot
new file mode 100644
index 0000000..39a9cbd
--- /dev/null
+++ b/intltest/locale/template.pot
@@ -0,0 +1,41 @@
+# 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-01-24 00:46-0300\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"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: init.lua:8
+msgid "Hello, world!"
+msgstr ""
+
+#: init.lua:13
+msgid "Blue"
+msgstr ""
+
+#: init.lua:13
+msgid "Car"
+msgstr ""
+
+#: init.lua:13
+msgid "Test: @1 @2"
+msgstr ""
+
+#: init.lua:23
+msgid "Item has been used @1 time."
+msgid_plural "Item has been used @1 times."
+msgstr[0] ""
+msgstr[1] ""