Novo README.md

This commit is contained in:
Lunovox 2023-07-20 10:45:42 -03:00
parent 9e07ee1525
commit 1d61ad20e8
4 changed files with 261 additions and 32 deletions

View file

@ -1,47 +1,55 @@
![urn_front]
# E-URN
# [E-URN]
[Minetest Mod] Colect opinion of player with electronic urn.
[ [Minetest Mod] ] Colect opinion of player with electronic urn.
**Dependencies:**
* default → Minetest Game Included
* default → Minetest Game Included
**Optional Dependencies:**
* [intllib](https://github.com/minetest-mods/intllib) → Facilitates the translation of several other mods into your native language, or other languages.
* [tradelands](https://github.com/Lunovox/tradelands) → Protection of rent door (not yet implemented).
* [correio](https://github.com/Lunovox/correio) → Send mail to offline players.
* [intllib] (Optional) → Facilitates the translation of several other mods into your native language, or other languages.
* [tradelands] (Optional) → Protection your lands and chests.
* [correio] (Optional) → Send mail to offline players.
## **License:**
* [GNU AGPL-3.0]
More details:
* in English: https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License
* em Português: https://pt.wikipedia.org/wiki/GNU_Affero_General_Public_License
**Licence:**
* GNU AGPL: https://pt.wikipedia.org/wiki/GNU_Affero_General_Public_License
**Developers:**
* [Lunovox](https://libreplanet.org/wiki/User:Lunovox)
<!--
**Translate to Others Languages:**
* Lunovox Heavenfinder: [email](mailto:lunovox@disroot.org), [xmpp](xmpp:lunovox@disroot.org?join), [social web](http:qoto.org/@lunovox), [audio conference](mumble:mumble.disroot.org), [more contacts](https:libreplanet.org/wiki/User:Lunovox)
* This mod currently are configured to language:
* English (DEFAULT)
* [Portuguese](https://raw.githubusercontent.com/Lunovox/minertrade/master/locale/pt.txt)
## **Internationalization of this Mod:**
* To add a new language to this mod just follow the steps below:
* Enable the complementary mod **'intllib'.**
* Set your language in **'minetest.conf'** by adding the [````language = <your language>````] property.
* Example for French Language: ````language = fr````
* Make a copy of the file [ **pt.txt** ] in the [ **locale** ] folder that is inside the mod for [````locale/<your_language>.txt````].
* Example for French language: ````locale/fr.txt````
* Open the file [````locale/<your_language>.txt````] in a simple text editor.
* Translate all lines. But, just here that stems the right of the equals symbol (=).
* Example for French Language: ````DISPENSING MACHINE = MACHINE DE DISTRIBUTION````
* Send your translated file to [lunovox@openmailbox.org](mailto:lunovox@openmailbox.org).
**SCREENSHOT IN PORTUGUESE:**
![](https://raw.githubusercontent.com/Lunovox/minertrade/master/screenshot.png)
This mod currently are configured to language:
![](https://raw.githubusercontent.com/Lunovox/minertrade/master/screenshot2.png)
* [English] (DEFAULT)
* [Portuguese]
![](https://raw.githubusercontent.com/Lunovox/minertrade/master/screenshot3.png)
To add a new language to this mod just follow the steps below:
-->
1. Enable the complementary mod **'intllib'.**
2. Set your language in **'minetest.conf'** by adding the [````language = <your language>````] property.
3. Example for French Language: ````language = fr````
4. Make a copy of the file [ **template.pot** ] in the [ **locale** ] folder that is inside the mod for [````locale/<your_language>.po````].
5. Example for French language: ````locale/fr.po````
6. Open the file [````locale/<your_language>.po````] in POEdit (Also works in a simple text editor).
7. Translate all and send your translated file to developers of this mod.
[urn_front]:textures/text_eurn_front.png
[correio]:https://gitlab.com/Lunovox/correio
[E-URN]:https://gitlab.com/lunovox/e-urn/
[English]:https://gitlab.com/lunovox/e-urn/-/raw/master/locale/template.pot
[GNU AGPL-3.0]:https://gitlab.com/lunovox/e-urn/-/raw/master/LICENSE
[intllib]:https://github.com/minetest-mods/intllib
[Minetest Mod]:https://minetest.net
[Portuguese]:https://gitlab.com/lunovox/e-urn/-/raw/master/locale/pt.po
[tradelands]:https://github.com/Lunovox/tradelands
[urn_front]:textures/text_eurn_front.png

BIN
favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

105
locale/README.md Normal file
View file

@ -0,0 +1,105 @@
# TRANSLATES
Update: 2023-03-19
version of Readme: 1.5
-----
To generate file [template.pot], did use terminal command:
```bash
cd soundchat
xgettext -n *.lua -L Lua --force-po --keyword=modSoundChat.translate --from-code=UTF-8 -o ./locale/template.pot
```
-----
### Generate file '.po' per [template.pot] file:
To translate [template.pot] to your language in '.po' file:
* Locales used: ca;cs;da;de;dv;eo;es;et;fr;hu;id;it;ja;jbo;kn;lt;ms;nb;nl;pl;pt;pt_BR;ro;ru;sl;sr_Cyrl;sv;sw;tr;uk
Sintaxe:
```bash
$ msginit --no-translator --no-wrap --locale=$LANG.UTF-8 --output-file=$LANG.po --input=$POT
```
* Example to brazilian portuguese language: [locale/pt_BR.po]
Example:
```bash
msginit --no-translator --no-wrap --locale=pt_BR.UTF-8 --output-file=./locale/pt_BR.po --input=./locale/template.pot
```
-----
### To Update ".po" file from a [template.pot] file.
Sintaxe:
```bash
$ msgmerge --sort-output --no-wrap --update --backup=off $LANG.po $POT
```
* Example to brazilian portuguese language: [locale/pt_BR.po]
Example:
```bash
msgmerge --sort-output --no-wrap --update --backup=off ./locale/pt_BR.po ./locale/template.pot
```
-----
To translate [template.pot] to your language use GUI App [PoEdit].:
### Install the PoEdit:
```bash
sudo apt-get install poedit
```
-----
### Convert '.po' file to '.tr' file.
Translate Sample: [locale/soundchat.pt_BR.tr]
```bash
$ cd ./locale/
$ lua5.3 po2tr.lua "soundchat" "pt_BR.po"
$ mv "pt_BR.tr" "soundchat.pt_BR.tr"
$ cat soundchat.pt_BR.tr | less
```
-----
### Exemple of enable the brazilian portuguese language in minetest:
Translate Sample: `locale/soundchat.pt_BR.tr`
To enable the translate to brazilian portuguese language, write "language = pt_BR" in file "minetest.conf". Or write the command ```/set -n language pt_BR``` in game chat, and run again the minetest game.
-----
### PLEASE SUBMIT YOUR NEW TRANSLATION TO THE DEVELOPERS OF THIS MOD THROUGH THE GIT PROJECT BELOW:
* `https://gitlab.com/lunovox/soundchat`
----
> See more:
* https://forum.minetest.net/viewtopic.php?f=47&t=21974
* https://github.com/minetest/minetest/issues/8158
* https://gist.githubusercontent.com/mamchenkov/3690981/raw/8ebd48c2af20c893c164e8d5245d9450ad682104/update_translations.sh
* https://gitlab.com/4w/xtend/-/blob/master/xtend_default/tools/convert_po_file_to_tr_file/convert_po_file_to_tr_file.lua
[locale/pt_BR.po]:https://gitlab.com/lunovox/soundchat/-/raw/master/locale/pt_BR.po
[locale/soundchat.pt_BR.tr]:https://gitlab.com/lunovox/soundchat/-/raw/master/locale/soundchat.pt_BR.tr
[PoEdit]:https://poedit.net
[template.pot]:https://gitlab.com/lunovox/soundchat/-/raw/master/locale/template.pot

116
locale/po2tr.lua Normal file
View file

@ -0,0 +1,116 @@
#!/usr/bin/env luajit
-- Convert regular Gettext PO files to Minetest-specific TR files. If there is
-- already a TR file with the same name of the PO file except the file suffix
-- bneing .tr (or .TR) instead of .po (or .PO) then THIS FILE WILL BE
-- OVERWRITTEN WITHOUT INFORMATION OR A WAY TO RECOVER THE PREVIOUS FILE!
--
--
-- ▄██▄
-- ▀███
-- █
-- ▄▄▄▄▄ █
-- ▀▄ ▀▄ █ BACKUP
-- ▄▀▀▀▄ █▄▄▄▄█▄▄ ▄▀▀▀▄ █
-- █ ▄ █ █ ▄ █ █
-- ▀▄ ▄▀ ▀▄ ▄▀ █
-- █▀▀▀ ▀▀▀ █ █
-- █ █ █ ALL
-- ▄▀▄▄▀▄ █ ▄█▀█▀█▀█▀█▀█▄ █ █
-- █▒▒▒▒█ █ █████████████▄ █ █
-- █▒▒▒▒█ █ ██████████████▄ █ █
-- █▒▒▒▒█ █ ██████████████▄ █ █
-- █▒▒▒▒█ █ ██████████████ █ █
-- █▒▒▒▒█ █ ██████████████▀ █ █ THE
-- █▒▒▒▒█ ██ ██████████████ █ █
-- ▀████▀ ██▀█ █████████████▀ █▄█
-- ██ ██ ▀█ █▄█▄█▄█▄█▄█▀ ▄█▀
-- ██ ██ ▀█ ▄▀▓█
-- ██ ██ ▀█▀▄▄▄▄▄▄▄▄▄▀▀▓▓▓█
-- ████ █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ███ █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█ THINGS
-- ██ █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ██ █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▌ !!!
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▌
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▌
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▌
--
--
-- The syntax of TR files according to the introducing forum post is:
--
-- # textdomain: namespace
-- original 1 = translation 1
-- original 2 = translation 2
-- original 3 = tralslation 3
-- original N = translation N
--
-- Where namespace should be the name of the mod. Following strings have to be
-- escaped using @.
--
-- String | Escape
-- -------+--------
-- `@` |`@@`
-- `=` |`@=`
-- `\n` |`@\n`
--
-- See https://forum.minetest.net/viewtopic.php?t=18349 for details.
-- Preparation
if arg[1] == nil or arg[2] == nil then
print('Provide the namesspace as first parameter')
print('Provide the path to the source PO file as second parameter')
print('Example: '..arg[0]..' mymod path/to/my/source.po')
return
end
local SEP = package.path:match('(%p)%?%.') or '/' -- wonky but hey ... :)
-- Assign parameters to local variables
local namespace = arg[1]
local po_file = arg[2]
local tr_file = arg[2]:gsub('po$', 'tr'):gsub('PO$', 'TR')
-- Get the translations through crude plaintext file parsing
local file_contents = {}
local translations = {}
local po_file_handle = io.open(po_file, 'rb')
if po_file_handle == nil then print('No base file found') return end
for line in po_file_handle:lines() do
if line:match('^msgid') or line:match('^msgstr') then
table.insert(file_contents, line)
end
end
local escape_string = function (s)
s = s:gsub('@([^%d])', '@@%1') -- All @ not followed by a number become @@
s = s:gsub('([^@]@)$', '%1@') -- An @ at the end of the string become @@
s = s:gsub('=', '@=') -- All = become @=
return s
end
for number,line_content in pairs(file_contents) do
if line_content:match('^msgid') then
local o = line_content:gsub('^msgid "(.+)"$', '%1')
local t = file_contents[number + 1]:gsub('^msgstr "(.+)"$', '%1')
if o ~= 'msgid = ""' and t ~= 'msgstr ""' then
table.insert(translations, escape_string(o)..'='..escape_string(t))
end
end
end
print(number)
po_file_handle:close()
-- Write translation to file
local tr_file_handle = io.open(tr_file, 'w+')
if tr_file_handle == nil then print('Could not open target file') return end
tr_file_handle:write('# textdomain: '..namespace, "\n")
for _,line in pairs(translations) do tr_file_handle:write(line, "\n") end
tr_file_handle:close()