Currently Online

Latest Posts

Topic: Untranslatable strings

GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3292
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2013-10-11, 20:21

I ran utils/buildlocale.py (assuming that's what I need to do to update the pot and po files) and the error still happens.

Edited: 2013-10-11, 20:21

Busy indexing nil values

Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1440
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2013-10-12, 18:30

However, we don't have ngettext support for Lua at this time

I will gladly add this in, it should be a very quick change too. Can you post some examples of how you would want to use it? Just like:

"I have " .. tostring(n) .. " " ... ngettext("orange", n)

I am not very familiar with how gettext works, that's why I am asking how the interface must look.

And you need to run utils/buidcat.py first. It will update the .pot files, then the game should run. 'make lang' will update the .po files.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3292
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2013-10-12, 19:31

SirVer wrote:

However, we don't have ngettext support for Lua at this time

I will gladly add this in, it should be a very quick change too. Can you post some examples of how you would want to use it? Just like:

"I have " .. tostring(n) .. " " ... ngettext("orange", n)

I am not very familiar with how gettext works, that's why I am asking how the interface must look.

We should make it look just like the C ones for consistency. For example:

ngettext("%u soldier", "%u soldiers", total)

Example result for the .po file:

#: ../../src/logic/militarysite.cc:119
#, c-format
msgid "%u soldier"
msgid_plural "%u soldiers"
msgstr[0] "%u saighdear"
msgstr[1] "%u shaighdear"
msgstr[2] "%u saighdearan"
msgstr[3] "%u saighdear"

The number of translation entries depends on the plural definitions for the target language.

I also found a gettext-lua library on Github and this conversation about it.

And you need to run utils/buidcat.py first. It will update the .pot files, then the game should run. 'make lang' will update the .po files.

ETA: I ran buildcat.py successfully, but make has no target lang. So, I'm still getting the error.

Edited: 2013-10-12, 20:18

Busy indexing nil values

Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1440
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2013-10-12, 21:32

The Lua extension we would not need, we already wrapped some of the gettext stuff for Widelands and getting an external library in is probably more work. But that this guy has made an extractor for lua is awesome - it is even merged into the main gettext release, but I could not figure out if there has been an official release since then. On my system, xgettext just coredumps when I run it on any texts.lua file. Do you know anything about this? If we can get extractions from Lua files, the rest should be very easy to add.

If the official extractor is working for us, we can replace our custom extractor that is written in python (and would need extension to extract strings from ngettext and similar methods).

After running buildcat.py, buidlocale.py should make working locales for you - that is essentially what make lang calls.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3292
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2013-10-12, 22:18

SirVer wrote:

The Lua extension we would not need, we already wrapped some of the gettext stuff for Widelands and getting an external library in is probably more work. But that this guy has made an extractor for lua is awesome - it is even merged into the main gettext release, but I could not figure out if there has been an official release since then. On my system, xgettext just coredumps when I run it on any texts.lua file. Do you know anything about this? If we can get extractions from Lua files, the rest should be very easy to add.

No, I am a complete rookie in this, I just stumbled across this while searching for the ngettext syntax for Lua. I have tried fiddling with gettext extraction once and failed gloriously lol

After running buildcat.py, buidlocale.py should make working locales for you - that is essentially what make lang calls.

Already tried and failed. Tha locales build according to Terminal output, but the boost call still crashes Widelands face-sad.png


Busy indexing nil values

Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1440
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2013-10-12, 23:30

Mmh, I looked at the format string and I think the placholder is wrong. It must be either '%s' or '%1%' , if you want the first argument to be formatted as a string, it must be '%1$s'. This I found here: http://www.boost.org/doc/libs/1_54_0/libs/format/doc/format.html#syntax

Does this work?


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3292
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2013-10-13, 14:35

It does. You're my hero! face-smile.png


Busy indexing nil values

Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1440
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2013-10-13, 15:48

nono, you are ours :). Thanks for spending time doing this!


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3292
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2013-10-13, 17:03

I have managed to fix 5 strings face-smile.png

2 of them still need testing though, so I haven't commited the changes yet. Any hints how I can get these on my screen?

 ../../src/logic/production_program.cc:1022
Recruited


../../src/network/internet_gaming.cc:434
Server time offset is %i seconds.

Busy indexing nil values

Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1440
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2013-10-13, 18:52

The first is part of the success string when you hover over a donkey/horse/oxfarm. The second appears when you enter the meta-server, i.e. when you click on internet game and connect to the server.


Top Quote