Page 1 of 1

How to add new language?

PostPosted: Tue Jan 29, 2013 09:20
by azimuth
I want to add russian language.
1) Download and build sources
2) Create folder "ru" in "po"
3) Copy po/minetest.pot to po/ru/minetest.po
4) Change po/ru/minetest.po :
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
# Russian translations for minetest-c55 package.
# Copyright (C) 2011 celeron
# This file is distributed under the same license as the minetest-c55 package.
# Azimuth <elagin.pasha@gmail.com>, 2013.
#
msgid ""
msgstr ""
"Project-Id-Version: minetest\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-01-29 12:32+0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Azimuth <elagin.pasha@gmail.com>\n"
"Language-Team: Russian <>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
...
#: src/guiMainMenu.cpp:248
msgid "Settings"
msgstr "Настройки"
...
#: src/guiMainMenu.cpp:245
msgid "Singleplayer"
msgstr "Одиночная игра"

#: src/guiMainMenu.cpp:246
msgid "Multiplayer"
msgstr "Сетевая игра"
...

5) util$ ./updatepo.sh
[da]: updating strings
.................... завершено.
[de]: updating strings
................... завершено.
[fr]: updating strings
.................... завершено.
[it]: updating strings
................... завершено.
[ru]: updating strings
................... завершено.

6) Run and see in main menu english words.

debug.txt
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
13:08:46: INFO[main]: locale has been set to:ru_RU.UTF-8

PostPosted: Tue Jan 29, 2013 09:28
by kaeza

PostPosted: Tue Jan 29, 2013 10:28
by azimuth

PostPosted: Tue Jan 29, 2013 13:41
by PilzAdam
Have you copiled minetest with gettext? Use
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
cmake . -DENABLE_GETTEXT=1 -DRUN_IN_PLACE=1 && make -j2

The cmake output should tell something like
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- GetText enabled; locales found: it;da;fr;de

Also: You dont need to run updatepo.sh, make does this for you.

PostPosted: Tue Jan 29, 2013 14:11
by azimuth
PilzAdam wrote:Have you copiled minetest with gettext? Use
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
cmake . -DENABLE_GETTEXT=1 -DRUN_IN_PLACE=1 && make -j2



Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest$ cmake . -DENABLE_GETTEXT=1 -DRUN_IN_PLACE=1 && make -j4
-- *** Will build version 0.4.4-d1 ***
...
-- GetText enabled; locales found: it;fr;ru;da;de
...
mo-update [de]: Creating locale directory.
[ 17%] mo-update [it]: Creating locale directory.
mo-update [fr]: Creating locale directory.
[ 17%] [ 18%] mo-update [ru]: Creating locale directory.
mo-update [da]: Creating locale directory.
Scanning dependencies of target minetestserver
[ 19%] mo-update [de]: Creating mo file.
[ 20%] mo-update [it]: Creating mo file.
Scanning dependencies of target minetest
[ 21%] [ 21%] mo-update [ru]: Creating mo file.
[ 21%] mo-update [fr]: Creating mo file.
mo-update [da]: Creating mo file.
[ 21%] mo update
[ 21%] [ 21%] Built target translations
...


$ bin/minetest
and see english words

PostPosted: Tue Jan 29, 2013 14:20
by PilzAdam
I have the same problem. I have everything correctly compiled and the $LANG varible set to de_DE.UTF-8 but I still get english text.

PostPosted: Tue Jan 29, 2013 19:49
by azimuth
In int main(int argc, char *argv[]) i find
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
init_gettext((porting::path_share+DIR_DELIM+".."+DIR_DELIM+"locale").c_str());


ls -l locale/
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
drwxrwxr-x 3 pavel pavel 4096 янв.  29 20:02 da
drwxrwxr-x 3 pavel pavel 4096 янв.  29 20:02 de
drwxrwxr-x 3 pavel pavel 4096 янв.  29 20:02 fr
drwxrwxr-x 3 pavel pavel 4096 янв.  29 20:02 it

folder "ru" don't exist

After
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
make

folder "ru" has been created

In int main(int argc, char *argv[]) contains:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
init_gettext((porting::path_share+DIR_DELIM+".."+DIR_DELIM+"locale").c_str());


my porting::path_user = : /home/pavel/dev/minetest/bin/..

i change to
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
init_gettext((porting::path_share + DIR_DELIM + "locale").c_str());

and "path" for bindtextdomain = /home/pavel/dev/minetest/bin/../locale

thereafter i change po/ru/minetest.po
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
#: src/guiMainMenu.cpp:245
msgid "Singleplayer"
msgstr "Одиночная игра"
.....
#: src/guiMainMenu.cpp:248
msgid "Settings"
msgstr "Nastroyki"

make && run &&
1) Nothing on "Singleplayer" tab.
2) See "Nastroyki" on "Settings" tab.
Image

PostPosted: Wed Jan 30, 2013 16:01
by sfan5
I just tried out too, it doesn't work for me too.
$LANG is set correctly and gettext compiled in

PostPosted: Wed Jan 30, 2013 16:32
by PilzAdam
Does it actually work for anyone in the latest dev version?

PostPosted: Wed Jan 30, 2013 17:53
by kaeza
PilzAdam wrote:Does it actually work for anyone in the latest dev version?

I followed your instructions and got Minetest running with Spanish texts, so I believe the same should hold true for other languages.
And yes, it's the (almost) latest version (a few commits behind).
EDIT: IDK if this works for languages that don't use the latin alphabet (like Russian, Japanese, etc).

PostPosted: Wed Jan 30, 2013 18:28
by PilzAdam
I found something: strace outputs:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
open("/home/adam/Minetest/minetest/bin/../../locale/de/LC_MESSAGES/minetest.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

but the file is at
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
"/home/adam/Minetest/minetest/bin/../locale/de/LC_MESSAGES/minetest.mo"

Copying the locale folder from minetest to the parent directory solves the problem.
But why does Minetest look at the wrong place to find the file?

PostPosted: Thu Jan 31, 2013 06:21
by azimuth
PilzAdam wrote:I found something: strace outputs:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
open("/home/adam/Minetest/minetest/bin/../../locale/de/LC_MESSAGES/minetest.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

But why does Minetest look at the wrong place to find the file?

Probably because the string
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
init_gettext((porting :: path_share + DIR_DELIM + ".." + DIR_DELIM + "locale"). c_str ());

is not true.

If it is replaced by
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
init_gettext((porting::path_share + DIR_DELIM + "locale").c_str());

all will be well.

The same line is contained 0.4.3 in and master branch.

PostPosted: Mon Mar 04, 2013 21:57
by 4aiman
PilzAdam wrote:Have you copiled minetest with gettext? Use
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
cmake . -DENABLE_GETTEXT=1 -DRUN_IN_PLACE=1 && make -j2


did the trick. Well, locales were recognized, russian one selected and then... then I got empty lines instead of text. Do I need to use ttf patch to make cyrillic chars show? Or should I have some ttf file in the particular folder (then - which one?)?

PostPosted: Tue Mar 05, 2013 14:40
by PilzAdam
4aiman wrote:
PilzAdam wrote:Have you copiled minetest with gettext? Use
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
cmake . -DENABLE_GETTEXT=1 -DRUN_IN_PLACE=1 && make -j2


did the trick. Well, locales were recognized, russian one selected and then... then I got empty lines instead of text. Do I need to use ttf patch to make cyrillic chars show? Or should I have some ttf file in the particular folder (then - which one?)?

You need to compile minetest with ttf support (i.e. -DENABLE_FREETYPE=1) and use a font that contains the charachters.

PostPosted: Wed Mar 06, 2013 12:12
by 4aiman
Thanks, PilzAdam! Will try that.

Edit: Thanks again!