summaryrefslogtreecommitdiff
path: root/intltest/init.lua
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 /intltest/init.lua
parentb2551f6a2209b8a11b42834cb0d63f5c03a2b95f (diff)
Add minimal example mod.
Diffstat (limited to 'intltest/init.lua')
-rw-r--r--intltest/init.lua28
1 files changed, 28 insertions, 0 deletions
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,
+})