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-16, 07:58

I pushed my first 3 batches of changes. Please read the commit messages and review before merging.

https://code.launchpad.net/~gunchleoc/widelands/gci18nfixes


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-16, 21:39

Great! Thanks for persisting through this :).

Could you propose them for merging on launchpad? That way, this will not get lost (as I check regularly for branches that are suggested for merging). We are in feature freeze mode which means that we cannot touch any strings anymore - because that resets the work of some translators. So we can only merge this after b18 is out.


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

OK, done. I understand about the string freeze face-smile.png

Let me know when you have figured out the Lua ngettext stuff and I will have a look at those strings then.


Busy indexing nil values

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

I have been preparing the strings in scripting/win_condition_texts.lua for ngettext. This implies that I had to move those strings over to the actual scripts in scripting/win_conditions, because we will need dynamic access to the number variables. Now we have some win conditions strings in this file and some others in the individual scripts, which offends my code feng shui. Unless anybody protests, I will eliminate win_condition_texts.lua and move everything over. I'm asking first though, because I don't know the design decision that went into having these strings in a separate file.

I have tried testing what I did so far with playing a game of the type 03_territorial_lord.lua, but although I have been owning most of the map for ages, I am unable to trigger the win condition strings. Any pointers? I can make sure the syntax for what I'm doing is correct though by tabbing through the game types in the game start screen.


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-17, 06:50

I think the design decision was to not duplicate strings too often - some of them are used in many win conditions. I think you can safely move them over.

I do not know why the code is not triggering for you - it is hard to debug without seeing the problem. I played a game of territorial time yesterday and it worked for us. You can try reducing the amount of area that is needed before you get a notification to something less than 50% - and while playing, you should regularly get status updates (I think every 30 minutes or so).

Edited: 2013-10-17, 06:50

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

I didn't play territorial time, but territorial lord. I'll try the different modes though, maybe it's a problem with the actual mode.

goes off to do some string moving


Busy indexing nil values

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

I'm done coding for now and will be able to do the rest once SirVer gets around to programming the placeholder and ngettext stuff for Lua for me.

The changes in my branch so far:

  • Marked strings for ngettext so we can have more proper plurals (C++ only)
  • Gave translators control over the order of placeholders (C++ only). As I came across them, I also marked strings that aren't currently translated, in case they will be marked for translations in the future - just so we won't forget.
  • Joined some strings to use placeholders instead of concatenating them from individual strings in the code, again so that translators get control over word order
  • Replaced some placeholders with literals, because my language has some sandhi effects.
  • Prepared strings so they can be switched to ngettext easily (Lua)
  • Changed size/rearranged GUI elements to make enough space for translations.
Edited: 2013-10-20, 10:39

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-20, 19:51

That is a great contribution already! I took the liberty to adding you to widelands-dev on launchpad and repushing your branch to a wideland-dev branch (which means that everyone in widelands-dev can work on it). Please check out the new one at lp:~widelands-dev/widelands/gci18nfixes and continue working in this one. Make it a habit to push after commit and pull before working, otherwise you will have a bad time face-smile.png

I added the following features in the branch I just pushed:

  • Compile time fixes for Mac OS
  • Added string.bformat which wraps boost::format - as discussed.

I did not yet wrap any more of gettext and I did not yet fix the lua extractor to recognize that. It would be great if you could start adding examples in the Lua code of how you would want to use this, so that I can add in the functionality.

I also marked strings that aren't currently translated, in case they will be marked for translations in the future - just so we won't forget.

I do not thing this is a good idea - YAGNI (you ain't gonna use it). We should mark them when they should be translated, not sooner.

Replaced some placeholders with literals, because my language has some sandhi effects.

I do not understand what you mean by this and what you did there.

Edited: 2013-10-20, 19:54

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

Thanks!

Sandhi effects are when the grammar causes the sounds at the borders of words to influence each other. For example:

Sentry = freiceadan, Tower = tùr

Your soldiers occupied your X = Ghabh na saighdearan agad còmhnaidh san X agad

Fill in the placeholder, you get: Ghabh na saighdearan agad còmhnaidh san freiceadan/tùr agad.

However, this is wrong in some cases. The correct form is: Ghabh na saighdearan agad còmhnaidh san fhreiceadan/tùr agad.

The orthography adds an extra letter after the first consonant in some cases (depending on the sound), so this can't be handled with a placeholder. Gaelic has a lot of these sound interactions across word borders. We manage to localize around them in a lot of cases, but sometimes it's not possible.

BTW another problem I haven't yet dealt with is that it would be really great to have individual translations of yes/no, because Gaelic repeats the verb in positive/negative form and has no words for yes/no as such. We handle these cases by expanding all questions with a standard verb. I'll need to take a closer look at the questions that come up in the game to see if it's worth the trouble.

Edited: 2013-10-20, 21:34

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-20, 22:34

Öhh... I have no idea how we can implement that frankly. I think gettext assumes that the same sentence in english is also always the same sentence in other languages. But I have not enough experience to say if this is always true and the case.


Top Quote