How to add new language?

Post Reply
User avatar
azimuth
New member
Posts: 8
Joined: Tue Jan 29, 2013 08:39

How to add new language?

by azimuth » Post

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 :

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

Code: Select all

13:08:46: INFO[main]: locale has been set to:ru_RU.UTF-8

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
azimuth
New member
Posts: 8
Joined: Tue Jan 29, 2013 08:39

by azimuth » Post


User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

Have you copiled minetest with gettext? Use

Code: Select all

cmake . -DENABLE_GETTEXT=1 -DRUN_IN_PLACE=1 && make -j2
The cmake output should tell something like

Code: Select all

-- GetText enabled; locales found: it;da;fr;de
Also: You dont need to run updatepo.sh, make does this for you.

User avatar
azimuth
New member
Posts: 8
Joined: Tue Jan 29, 2013 08:39

by azimuth » Post

PilzAdam wrote:Have you copiled minetest with gettext? Use

Code: Select all

cmake . -DENABLE_GETTEXT=1 -DRUN_IN_PLACE=1 && make -j2

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

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

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.

User avatar
azimuth
New member
Posts: 8
Joined: Tue Jan 29, 2013 08:39

by azimuth » Post

In int main(int argc, char *argv[]) i find

Code: Select all

init_gettext((porting::path_share+DIR_DELIM+".."+DIR_DELIM+"locale").c_str());
ls -l locale/

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

Code: Select all

make
folder "ru" has been created

In int main(int argc, char *argv[]) contains:

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

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

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

sfan5
Moderator
Posts: 4095
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

I just tried out too, it doesn't work for me too.
$LANG is set correctly and gettext compiled in
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

Does it actually work for anyone in the latest dev version?

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

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).
Last edited by kaeza on Wed Jan 30, 2013 17:54, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

I found something: strace outputs:

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

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?

User avatar
azimuth
New member
Posts: 8
Joined: Tue Jan 29, 2013 08:39

by azimuth » Post

PilzAdam wrote:I found something: strace outputs:

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

Code: Select all

init_gettext((porting :: path_share + DIR_DELIM + ".." + DIR_DELIM + "locale"). c_str ());
is not true.

If it is replaced by

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.

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Post

PilzAdam wrote:Have you copiled minetest with gettext? Use

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?)?

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

4aiman wrote:
PilzAdam wrote:Have you copiled minetest with gettext? Use

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.
Last edited by PilzAdam on Tue Mar 05, 2013 14:40, edited 1 time in total.

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Post

Thanks, PilzAdam! Will try that.

Edit: Thanks again!
Last edited by 4aiman on Wed Mar 06, 2013 14:38, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests