mirror of
https://github.com/minetest-mods/intllib.git
synced 2025-01-23 16:30:18 +01:00
Add minimal example mod.
This commit is contained in:
parent
b2551f6a22
commit
172a4e127c
10
intltest/README.md
Normal file
10
intltest/README.md
Normal file
@ -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.
|
1
intltest/depends.txt
Normal file
1
intltest/depends.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
intllib?
|
28
intltest/init.lua
Normal file
28
intltest/init.lua
Normal file
@ -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,
|
||||||
|
})
|
3
intltest/intllib.lua
Normal file
3
intltest/intllib.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
-- This file should be replaced by `intllib/lib/intllib.lua`.
|
||||||
|
return dofile(minetest.get_modpath("intllib").."/lib/intllib.lua")
|
40
intltest/locale/es.po
Normal file
40
intltest/locale/es.po
Normal file
@ -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."
|
41
intltest/locale/template.pot
Normal file
41
intltest/locale/template.pot
Normal file
@ -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] ""
|
Loading…
Reference in New Issue
Block a user