Update intllib to Git commit 6ebdc53...
https://github.com/minetest-mods/intllib/tree/6ebdc53master
parent
8e7b1e11e9
commit
9c20b7dfac
|
@ -50,7 +50,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||
* [trampoline][] ([GPL][lic.gpl3.0]) -- version: [0.2 (41366ac Git)][ver.trampoline] *2017-08-30*
|
||||
* [trash_can][] ([MIT][lic.trash_can]) -- version: [423b0f2 Git][ver.trash_can] *2020-08-12*
|
||||
* [waffles][] ([MIT][lic.waffles]) -- version [15bcdce Git][ver.waffles] *2018-05-13*
|
||||
* [intllib][] ([Unlicense][lic.unlicense]) -- version: [20180811][ver.intllib] *2018-08-11*
|
||||
* [intllib][] ([Unlicense][lic.unlicense]) -- version: [6ebdc53][ver.intllib] *2021-02-23* ***DEPRECATED***
|
||||
* inventory/
|
||||
* [bags][] ([BSD 3-Clause][lic.bags]) -- version: [bc87b45 Git][ver.bags] *2018-04-11*
|
||||
* [sfinv_buttons][] ([MIT][lic.mit]) -- version [1.1.0 (ebb1f7c Git)][ver.sfinv_buttons] *2021-01-14*
|
||||
|
@ -431,7 +431,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||
[ver.hudbars]: http://repo.or.cz/minetest_hudbars.git/tree/ba21f47
|
||||
[ver.hudmap]: https://github.com/stujones11/hudmap/tree/3b8bdc0
|
||||
[ver.ilights]: https://gitlab.com/VanessaE/ilights/tags/2021-02-25-01
|
||||
[ver.intllib]: https://github.com/minetest-mods/intllib/releases/tag/20180811
|
||||
[ver.intllib]: https://github.com/minetest-mods/intllib/tree/6ebdc53
|
||||
[ver.invisibility]: https://notabug.org/TenPlus1/invisibility/src/e3f04a25c22fa6f9ac044de0bf2f5978c0a95cdf
|
||||
[ver.invisible]: https://github.com/AiTechEye/invisible/tree/a2a6504
|
||||
[ver.jukebox]: https://github.com/minetest-mods/jukebox/tree/0d871f2
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
read_globals = {
|
||||
"minetest",
|
||||
}
|
||||
|
||||
globals = {
|
||||
"intllib",
|
||||
}
|
||||
|
||||
files["intltest/init.lua"] = {
|
||||
ignore = {
|
||||
"212", -- Unused argument.
|
||||
},
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
# Bilioteca de internacionalización para Minetest
|
||||
|
||||
Por Diego Martínez (kaeza).
|
||||
Lanzada bajo Unlicense. Véase `LICENSE.md` para más detalles.
|
||||
|
||||
Éste mod es un intento por proveer soporte para internacionalización
|
||||
de los mods (algo que a Minetest le falta de momento).
|
||||
|
||||
Si tienes alguna duda/comentario, por favor publica en el
|
||||
[tema del foro][topic]. Por reporte de errores, use el
|
||||
[bugtracker][bugtracker] en Github.
|
||||
|
||||
## Cómo usar
|
||||
|
||||
Si eres un jugador regular en busca de textos traducidos, simplemente
|
||||
[instala][installing_mods] éste mod como cualquier otro.
|
||||
|
||||
El mod trata de detectar tu idioma, pero ya que no hay una forma portable de
|
||||
hacerlo, prueba varias alternativas:
|
||||
|
||||
* `language` setting in `minetest.conf`.
|
||||
* `LANGUAGE` environment variable.
|
||||
* `LANG` environment variable.
|
||||
|
||||
En cualquier caso, el resultado final debería ser el
|
||||
[Código de idioma ISO 639-1][ISO639-1] del idioma deseado.
|
||||
|
||||
### Desarrolladores
|
||||
|
||||
Si desarrollas mods y estás buscando añadir soporte de internacionalización
|
||||
a tu mod, ve el fichero `doc/developer.md`.
|
||||
|
||||
### Traductores
|
||||
|
||||
Si eres un traductor, ve el fichero `doc/translator.md`.
|
||||
|
||||
[topic]: https://forum.minetest.net/viewtopic.php?id=4929
|
||||
[bugtracker]: https://github.com/minetest-mods/intllib/issues
|
||||
[installing_mods]: https://wiki.minetest.net/Installing_mods/es
|
||||
[ISO639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
# Libreria di internazionalizzazione per Minetest
|
||||
|
||||
Di Diego Martínez (kaeza).
|
||||
Rilasciata sotto licenza Unlicense. Si veda `LICENSE.md` per i dettagli.
|
||||
|
||||
Questo modulo è un tentativo per fornire il supporto di internazionalizzazione
|
||||
per i moduli (cosa che attualmente manca a Minetest).
|
||||
|
||||
Se aveste qualunque commento o suggerimento, per piacere scriveteli nella
|
||||
[discussione sul forum][topic]. Per i rapporti sui bug, usate il
|
||||
[tracciatore di bug][bugtracker] su Github.
|
||||
|
||||
## Come usarla
|
||||
|
||||
Se siete un* giocatrice/tore che vuole i testi tradotti,
|
||||
[installate][installing_mods] questo modulo come qualunque altro,
|
||||
poi abilitatelo tramite l'interfaccia grafica.
|
||||
|
||||
Il modulo tenta di rilevare la vostra lingua, ma dato che al momento non c'è
|
||||
un metodo portabile per farlo, prova diverse alternative:
|
||||
|
||||
* `language` impostazione in `minetest.conf`.
|
||||
* `LANGUAGE` variabile d'ambiente.
|
||||
* `LANG` variabile d'ambiente.
|
||||
* Se nessuna funziona, usa `en`.
|
||||
|
||||
In ogni caso, il risultato finale dovrebbe essere il
|
||||
[codice di lingua ISO 639-1][ISO639-1] del linguaggio desiderato.
|
||||
|
||||
### Sviluppatrici/tori di moduli
|
||||
|
||||
Se siete un* sviluppatrice/tore di moduli desideros* di aggiungere il supporto
|
||||
per l'internazionalizzazione al vostro modulo, leggete `doc/developer-it.md`.
|
||||
|
||||
### Traduttrici/tori
|
||||
|
||||
Se siete un* traduttrice/tore, leggete `doc/translator-it.md`.
|
||||
|
||||
[topic]: https://forum.minetest.net/viewtopic.php?id=4929
|
||||
[bugtracker]: https://github.com/minetest-mods/intllib/issues
|
||||
[installing_mods]: https://wiki.minetest.net/Installing_mods
|
||||
[ISO639-1]: https://it.wikipedia.org/wiki/ISO_639-1
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
# Pustaka Pengantarabangsaan untuk Minetest
|
||||
|
||||
Oleh Diego Martínez (kaeza).
|
||||
Diterbitkan bawah Unlicense. Lihat `LICENSE.md` untuk maklumat lanjut.
|
||||
|
||||
Mods ini ialah suatu usaha untuk menyediakan sokongan pengantarabangsaan
|
||||
kepada mods (sesuatu yang Minetest tiada ketika ini).
|
||||
|
||||
Jika anda mempunyai sebarang komen/cadangan, sila tulis ke dalam [topik forum][topik].
|
||||
Untuk melaporkan pepijat, sila gunakan [penjejak pepijat][pepijat] Github.
|
||||
|
||||
## Bagaimanakah cara untuk menggunakannya?
|
||||
|
||||
Jika anda pemain biasa yang mencari teks terjemahan, hanya [pasangkan][pasang_mods]
|
||||
mods ini seperti mods lain, kemudian bolehkannya melalui GUI.
|
||||
|
||||
Mods ini cuba untuk mengesan bahasa anda, tetapi oleh kerana tiada
|
||||
cara mudah alih untuk melakukannya, ia cuba beberapa cara yang lain:
|
||||
|
||||
* Tetapan `language` di dalam fail `minetest.conf`.
|
||||
* Pembolehubah sekitaran `LANGUAGE`.
|
||||
* Pembolehubah sekitaran `LANG`.
|
||||
* Jika semua di atas gagal, ia gunakan `en`.
|
||||
|
||||
Dalam apa jua keadaan, hasil akhirnya sepatutnya menjadi
|
||||
[Kod Bahasa ISO 639-1][ISO639-1] untuk bahasa yang dikehendaki.
|
||||
|
||||
### Pembangun mods
|
||||
|
||||
Jika anda seorang pembangun mods yang ingin menambah sokongan
|
||||
pengantarabangsaan kepada mods anda, sila lihat `doc/developer.md`.
|
||||
|
||||
### Penterjemah
|
||||
|
||||
Jika anda seorang penterjemah, sila lihat `doc/translator.md`.
|
||||
|
||||
[topik]: https://forum.minetest.net/viewtopic.php?id=4929
|
||||
[pepijat]: https://github.com/minetest-mods/intllib/issues
|
||||
[pasang_mods]: https://wiki.minetest.net/Installing_Mods/ms
|
||||
[ISO639-1]: https://ms.wikipedia.org/wiki/Senarai_kod_ISO_639-1
|
|
@ -0,0 +1,50 @@
|
|||
# Lib de Internacionalização para Minetest
|
||||
|
||||
Por Diego Martínez (kaeza).
|
||||
Lançado sob Unlicense. Veja `LICENSE.md` para detalhes.
|
||||
|
||||
Este mod é uma tentativa de fornecer suporte de internacionalização para mods
|
||||
(algo que Minetest atualmente carece).
|
||||
|
||||
|
||||
Se você tiver algum comentário/sugestão, favor postar no
|
||||
[tópico do fórum][topico]. Para reportar bugs, use o
|
||||
[rastreador de bugs][bugtracker] no GitHub.
|
||||
|
||||
|
||||
## Como usar
|
||||
|
||||
Se você é um jogador regular procurando por textos traduzidos,
|
||||
basta instalar este mod como qualquer outro, e então habilite-lo na GUI.
|
||||
|
||||
O mod tenta detectar o seu idioma, mas como não há atualmente nenhuma
|
||||
maneira portátil de fazer isso, ele tenta várias alternativas:
|
||||
|
||||
Para usar este mod, basta [instalá-lo][instalando_mods]
|
||||
e habilita-lo na GUI.
|
||||
|
||||
O modificador tenta detectar o idioma do usuário, mas já que não há atualmente
|
||||
nenhuma maneira portátil para fazer isso, ele tenta várias alternativas, e usa
|
||||
o primeiro encontrado:
|
||||
|
||||
* `language` definido em `minetest.conf`.
|
||||
* Variável de ambiente `LANGUAGE`.
|
||||
* Variável de ambiente `LANG`.
|
||||
* Se todos falharem, usa `en` (inglês).
|
||||
|
||||
Em todo caso, o resultado final deve ser um
|
||||
[Código de Idioma ISO 639-1][ISO639-1] do idioma desejado.
|
||||
|
||||
### Desenvolvedores de mods
|
||||
|
||||
Se você é um desenvolvedor de mod procurando adicionar suporte de
|
||||
internacionalização ao seu mod, consulte `doc/developer.md`.
|
||||
|
||||
### Tradutores
|
||||
|
||||
Se você é um tradutor, consulte `doc/translator.md`.
|
||||
|
||||
[topico]: https://forum.minetest.net/viewtopic.php?id=4929
|
||||
[bugtracker]: https://github.com/minetest-mods/intllib/issues
|
||||
[instalando_mods]: http://wiki.minetest.net/Installing_Mods/pt-br
|
||||
[ISO639-1]: https://pt.wikipedia.org/wiki/ISO_639
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
# Internationalization Lib for Minetest
|
||||
|
||||
## DEPRECATED - Use Minetest's new translation API instead!
|
||||
|
||||
You should not use this mod when writing new mods, and you should update mods to no longer depend on this mod.
|
||||
|
||||
Minetest 5.0 has builtin support for client-side translation, accessed by `minetest.get_translator()`
|
||||
|
||||
## Aboud
|
||||
|
||||
By Diego Martínez (kaeza).
|
||||
Released under Unlicense. See `LICENSE.md` for details.
|
||||
|
||||
This mod is an attempt at providing internationalization support for mods
|
||||
(something Minetest currently lacks).
|
||||
|
||||
Should you have any comments/suggestions, please post them in the
|
||||
[forum topic][topic]. For bug reports, use the [bug tracker][bugtracker]
|
||||
on Github.
|
||||
|
||||
## How to use
|
||||
|
||||
If you are a regular player looking for translated texts, just
|
||||
[install][installing_mods] this mod like any other one, then enable it
|
||||
in the GUI.
|
||||
|
||||
The mod tries to detect your language, but since there's currently no
|
||||
portable way to do this, it tries several alternatives:
|
||||
|
||||
* `language` setting in `minetest.conf`.
|
||||
* `LANGUAGE` environment variable.
|
||||
* `LANG` environment variable.
|
||||
* If all else fails, uses `en`.
|
||||
|
||||
In any case, the end result should be the [ISO 639-1 Language Code][ISO639-1]
|
||||
of the desired language.
|
||||
|
||||
### Mod developers
|
||||
|
||||
If you are a mod developer looking to add internationalization support to
|
||||
your mod, see `doc/developer.md`.
|
||||
|
||||
### Translators
|
||||
|
||||
If you are a translator, see `doc/translator.md`.
|
||||
|
||||
[topic]: https://forum.minetest.net/viewtopic.php?id=4929
|
||||
[bugtracker]: https://github.com/minetest-mods/intllib/issues
|
||||
[installing_mods]: https://wiki.minetest.net/Installing_mods
|
||||
[ISO639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
# Intllib - documentazione per sviluppatrici/tori
|
||||
|
||||
## Abilitare l'internazionalizzazione
|
||||
|
||||
Per abilitare l'internazionalizzazione del vostro modulo, dovete copiare il file
|
||||
`lib/intllib.lua` nella cartella principale del vostro modulo, poi inserite
|
||||
questo codice standard nei file che necessitano la traduzione:
|
||||
|
||||
-- Load support for intllib.
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
Dovrete anche aggiungere la dipendenza facoltativa da intllib per il vostro
|
||||
modulo, per farlo aggiungete `intllib?` su una riga vuota nel vostro
|
||||
`depends.txt`. Si noti anche che se intllib non è installata, le funzioni di
|
||||
acquisizione del testo sono fatte in modo da restituire la stringa di testo
|
||||
originale. Questo è stato fatto in modo che non dobbiate spargere tonnellate
|
||||
di `if` (o costrutti simili) per controllare se la libreria è installata.
|
||||
|
||||
Dopo avere messo il codice, dovete marcare le stringhe di testo che necessitano
|
||||
una traduzione. Per ciascuna stringa traducibile nei vostri codici sorgenti,
|
||||
usate la funzione `S` (si veda sopra) per restituire la stringa tradotta.
|
||||
Per esempio:
|
||||
|
||||
minetest.register_node("miomod:mionodo", {
|
||||
-- Stringa semplice:
|
||||
description = S("Il mio fantastico nodo"),
|
||||
-- Stringa con inserti:
|
||||
description = S("Macchina @1", "Blu"),
|
||||
-- ...
|
||||
})
|
||||
|
||||
La funzione `NS` è l'equivalente di `ngettext`. Dovrebbe essere usata quando la
|
||||
stringa da tradurre ha forma singolare e plurale. Per esempio:
|
||||
|
||||
-- Il primo `count` è per consentire a `ngettext` di stabilire quale forma
|
||||
-- usare. Il secondo `count` è per il sostituto effettivo.
|
||||
|
||||
print(NS("Avete un oggetto.", "Avete @1 oggetti.", count, count))
|
||||
|
||||
## Generare e aggiornare cataloghi
|
||||
|
||||
Questo è il procedimento di base per lavorare con [gettext][gettext]
|
||||
|
||||
Ogni volta che avete nuove stringhe da tradurre, dovreste fare quanto segue:
|
||||
|
||||
cd /percorso/del/modulo
|
||||
/percorso/degli/strumenti/intllib/xgettext.sh file1.lua file2.lua ...
|
||||
|
||||
Lo script creerà una cartella chiamata `locale` se non esiste già, e genererà
|
||||
il file `template.pot` (un modello con tutte le stringhe traducibili). Se avete
|
||||
già delle traduzioni, lo script provvederà al loro aggiornamento con le nuove
|
||||
stringhe.
|
||||
|
||||
Lo script fornisce alcune opzioni al vero `xgettext` che dovrebbero essere
|
||||
sufficienti per la maggior parte dei casi. Se lo desiderate potete specificare
|
||||
altre opzioni:
|
||||
|
||||
xgettext.sh -o file.pot --keyword=blaaaah:4,5 a.lua b.lua ...
|
||||
|
||||
NOTA: C'è anche un file batch di Windows `xgettext.bat` per gli utenti di
|
||||
Windows, ma dovrete installare separatamente gli strumenti di gettext per la
|
||||
riga di comando. Si veda la parte superiore del file per la configurazione.
|
||||
|
||||
[gettext]: https://www.gnu.org/software/gettext/
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
# Intllib developer documentation
|
||||
|
||||
## Enabling internationalization
|
||||
|
||||
In order to enable internationalization for your mod, you will need to copy the
|
||||
file `lib/intllib.lua` into the root directory of your mod, then include this
|
||||
boilerplate code in files needing localization:
|
||||
|
||||
-- Load support for intllib.
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
You will also need to optionally depend on intllib, to do so add `intllib?`
|
||||
to an empty line in your `depends.txt`. Also note that if intllib is not
|
||||
installed, the getter functions are defined so they return the string
|
||||
unchanged. This is done so you don't have to sprinkle tons of `if`s (or
|
||||
similar constructs) to check if the lib is actually installed.
|
||||
|
||||
Once you have the code in place, you need to mark strings that need
|
||||
translation. For each translatable string in your sources, use the `S`
|
||||
function (see above) to return the translated string. For example:
|
||||
|
||||
minetest.register_node("mymod:mynode", {
|
||||
-- Simple string:
|
||||
description = S("My Fabulous Node"),
|
||||
-- String with insertions:
|
||||
description = S("@1 Car", "Blue"),
|
||||
-- ...
|
||||
})
|
||||
|
||||
The `NS` function is the equivalent of `ngettext`. It should be used when the
|
||||
string to be translated has singular and plural forms. For example:
|
||||
|
||||
-- The first `count` is for `ngettext` to determine which form to use.
|
||||
-- The second `count` is the actual replacement.
|
||||
print(NS("You have one item.", "You have @1 items.", count, count))
|
||||
|
||||
## Generating and updating catalogs
|
||||
|
||||
This is the basic workflow for working with [gettext][gettext]
|
||||
|
||||
Each time you have new strings to be translated, you should do the following:
|
||||
|
||||
cd /path/to/mod
|
||||
/path/to/intllib/tools/xgettext.sh file1.lua file2.lua ...
|
||||
|
||||
The script will create a directory named `locale` if it doesn't exist yet,
|
||||
and will generate the file `template.pot` (a template with all the translatable
|
||||
strings). If you already have translations, the script will proceed to update
|
||||
all of them with the new strings.
|
||||
|
||||
The script passes some options to the real `xgettext` that should be enough
|
||||
for most cases. You may specify other options if desired:
|
||||
|
||||
xgettext.sh -o file.pot --keyword=blargh:4,5 a.lua b.lua ...
|
||||
|
||||
NOTE: There's also a Windows batch file `xgettext.bat` for Windows users,
|
||||
but you will need to install the gettext command line tools separately. See
|
||||
the top of the file for configuration.
|
||||
|
||||
[gettext]: https://www.gnu.org/software/gettext/
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
# Formato del file di traduzione
|
||||
|
||||
*Nota: Questo documento spiega il vecchio formato in stile conf/ini.
|
||||
La nuova interfaccia usa file [gettext][gettext] `.po`.
|
||||
Si veda [Il formato dei file PO][PO-Files] per ulteriori informazioni.*
|
||||
|
||||
Questo è un esempio per un file di traduzione in Italiano (`it.txt`):
|
||||
|
||||
# Un commento.
|
||||
# Un altro commento.
|
||||
Questa riga viene ignorata dato che non ha il segno di uguale.
|
||||
Hello, World! = Ciao, Mondo!
|
||||
String with\nnewlines = Stringa con\na capo
|
||||
String with an \= equals sign = Stringa con un segno di uguaglianza \=
|
||||
|
||||
I file "locale" (o di traduzione) sono file di testo semplice formati da righe
|
||||
nel formato `testo originale = testo tradotto`. Il file deve stare nella
|
||||
sottocartella `locale` del modulo, e il suo nome deve essere lo stesso del
|
||||
[codice di lingua ISO 639-1][ISO639-1] della lingua che volete fornire.
|
||||
|
||||
I file di traduzione dovrebbero usare la codifica UTF-8.
|
||||
|
||||
Le righe che iniziano con un cancelletto sono commenti e vengono ignorate dal
|
||||
lettore. Si noti che i commenti si estendono solo fino al termine della riga;
|
||||
non c'è nessun supporto per i commenti multiriga. Le righe senza un segno di
|
||||
uguale sono anch'esse ignorate.
|
||||
|
||||
I caratteri che sono considerati "speciali" possono essere "escaped" di modo
|
||||
che siano presi letteralmente. Inoltre esistono molte sequenze di escape che
|
||||
possono essere utilizzate:
|
||||
|
||||
* Qualsiasi `#`, `=` può essere escaped di modo da essere preso letteralmente.
|
||||
La sequenza `\#` è utile se il vostro testo sorgente inizia con `#`.
|
||||
* Le sequenze di escape comuni `\n` e `\t`, significano rispettivamente
|
||||
newline (a capo) e tabulazione orizzontale.
|
||||
* La sequenza speciale di escape`\s` rappresenta il carattere di spazio.
|
||||
È utile principalmente per aggiungere spazi prefissi o suffissi ai testi
|
||||
originali o tradotti, perché altrimenti quegli spazi verrebbero rimossi.
|
||||
|
||||
[gettext]: https://www.gnu.org/software/gettext
|
||||
[PO-Files]: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html
|
||||
[ISO639-1]: https://it.wikipedia.org/wiki/ISO_639-1
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
# Locale file format
|
||||
|
||||
*Note: This document explains the old conf/ini-like file format.
|
||||
The new interface uses [gettext][gettext] `.po` files.
|
||||
See [The Format of PO Files][PO-Files] for more information.*
|
||||
|
||||
Here's an example for a Spanish locale file (`es.txt`):
|
||||
|
||||
# A comment.
|
||||
# Another comment.
|
||||
This line is ignored since it has no equals sign.
|
||||
Hello, World! = Hola, Mundo!
|
||||
String with\nnewlines = Cadena con\nsaltos de linea
|
||||
String with an \= equals sign = Cadena con un signo de \= igualdad
|
||||
|
||||
Locale (or translation) files are plain text files consisting of lines of the
|
||||
form `source text = translated text`. The file must reside in the mod's `locale`
|
||||
subdirectory, and must be named after the two-letter
|
||||
[ISO 639-1 Language Code][ISO639-1] of the language you want to support.
|
||||
|
||||
The translation files should use the UTF-8 encoding.
|
||||
|
||||
Lines beginning with a pound sign are comments and are effectively ignored
|
||||
by the reader. Note that comments only span until the end of the line;
|
||||
there's no support for multiline comments. Lines without an equals sign are
|
||||
also ignored.
|
||||
|
||||
Characters that are considered "special" can be "escaped" so they are taken
|
||||
literally. There are also several escape sequences that can be used:
|
||||
|
||||
* Any of `#`, `=` can be escaped to take them literally. The `\#`
|
||||
sequence is useful if your source text begins with `#`.
|
||||
* The common escape sequences `\n` and `\t`, meaning newline and
|
||||
horizontal tab respectively.
|
||||
* The special `\s` escape sequence represents the space character. It
|
||||
is mainly useful to add leading or trailing spaces to source or
|
||||
translated texts, as these spaces would be removed otherwise.
|
||||
|
||||
[gettext]: https://www.gnu.org/software/gettext
|
||||
[PO-Files]: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html
|
||||
[ISO639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
# Intllib - documentazione per traduttrici/tori
|
||||
|
||||
#### Nuova interfaccia
|
||||
|
||||
Usate i vostri strumenti preferiti per modificare i file `.po`.
|
||||
|
||||
#### Vecchia interfaccia
|
||||
|
||||
Per tradurre nella lingua che desiderate un modulo che supporta intllib,
|
||||
copiate il file `locale/template.txt` come `locale/LINGUA.txt` (dove `LINGUA` è
|
||||
il [codice di lingua ISO 639-1][ISO639-1] del vostro linguaggio.
|
||||
|
||||
Aprite il nuovo file nel vostro editor preferito, e traducete ciascuna riga
|
||||
inserendo il testo tradotto dopo il segno di uguale.
|
||||
|
||||
Si veda `localefile-it.md` per ulteriori informazioni sul formato del file.
|
||||
|
||||
[gettext]: https://www.gnu.org/software/gettext/
|
||||
[ISO639-1]: https://it.wikipedia.org/wiki/ISO_639-1
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
# Intllib translator documentation
|
||||
|
||||
#### New interface
|
||||
|
||||
Use your favorite tools to edit the `.po` files.
|
||||
|
||||
#### Old interface
|
||||
|
||||
To translate an intllib-supporting mod to your desired language, copy the
|
||||
`locale/template.txt` file to `locale/LANGUAGE.txt` (where `LANGUAGE` is the
|
||||
[ISO 639-1 Language Code][ISO639-1] of your language.
|
||||
|
||||
Open up the new file in your favorite editor, and translate each line putting
|
||||
the translated text after the equals sign.
|
||||
|
||||
See `localefile.md` for more information about the file format.
|
||||
|
||||
[gettext]: https://www.gnu.org/software/gettext/
|
||||
[ISO639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
|
@ -201,7 +201,8 @@ function intllib.get_strings(modname, langcode)
|
|||
local modpath = minetest.get_modpath(modname)
|
||||
msgstr = { }
|
||||
for _, l in ipairs(get_locales(langcode)) do
|
||||
local t = intllib.load_strings(modpath.."/locale/"..l..".txt") or { }
|
||||
local t = intllib.load_strings(modpath.."/locale/"..modname.."."..l..".tr")
|
||||
or intllib.load_strings(modpath.."/locale/"..l..".txt") or { }
|
||||
for k, v in pairs(t) do
|
||||
msgstr[k] = msgstr[k] or v
|
||||
end
|
||||
|
|
|
@ -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.
|
|
@ -0,0 +1 @@
|
|||
intllib?
|
|
@ -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,
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
-- This file should be replaced by `intllib/lib/intllib.lua`.
|
||||
return dofile(minetest.get_modpath("intllib").."/lib/intllib.lua")
|
|
@ -0,0 +1,43 @@
|
|||
# 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-02-25 20:40-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=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: init.lua
|
||||
msgid "Hello, world!"
|
||||
msgstr "¡Hola, mundo!"
|
||||
|
||||
#. Translators: @1 is color, @2 is object.
|
||||
#: init.lua
|
||||
msgid "Blue"
|
||||
msgstr "Azul"
|
||||
|
||||
#: init.lua
|
||||
msgid "Car"
|
||||
msgstr "Carro"
|
||||
|
||||
#. Translators: @1 is color, @2 is object.
|
||||
#: init.lua
|
||||
msgid "Test: @1 @2"
|
||||
msgstr "Prueba: @2 @1"
|
||||
|
||||
#. Translators: @1 is use count.
|
||||
#: init.lua
|
||||
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."
|
|
@ -0,0 +1,44 @@
|
|||
# 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-25 20:40-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
|
||||
msgid "Hello, world!"
|
||||
msgstr ""
|
||||
|
||||
#. Translators: @1 is color, @2 is object.
|
||||
#: init.lua
|
||||
msgid "Blue"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua
|
||||
msgid "Car"
|
||||
msgstr ""
|
||||
|
||||
#. Translators: @1 is color, @2 is object.
|
||||
#: init.lua
|
||||
msgid "Test: @1 @2"
|
||||
msgstr ""
|
||||
|
||||
#. Translators: @1 is use count.
|
||||
#: init.lua
|
||||
msgid "Item has been used @1 time."
|
||||
msgid_plural "Item has been used @1 times."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
Loading…
Reference in New Issue