Polls

Best Build 21 Screenshot

Log in to vote!

Currently Online

Latest Posts

Topic: Untranslatable strings

GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3207
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2013-10-08, 14:55
There's a bunch of strings that are untranslatable, because word order cannot be changed. An example is

Out of 


Which produces messages like "Out of stone" in the game. What I would need here instead is

Out of %s


so I can translate it as

Chan eil %s air fhàgail dhomh


How do you want me to report such strings?

I also hit quite a number of truncated strings, because there isn't room enough for them in the GUI. Where and how do you want me to report those?

Busy indexing nil values

Top Quote
fk
Avatar
Joined: 2013-07-30, 22:58
Posts: 150
Ranking
At home in WL-forums
Posted at: 2013-10-08, 16:30

"Out of %s"

That makes sense. Unfortunately, when a sentence in the source is changed, its translations in all languages disappear automatically from Launchpad. That makes it hard to update such small changes, much will be lost and never updated anymore and translators might become discouraged. I can only hope that there is a way to fix that.

Btw. ware names are not translated. I think that it is due to the fact that they are not objects in the game. You will get something like: "Chan eil enots air fhàgail dhomh" face-grin.png

"I also hit quite a number of truncated strings, because there isn't room enough for them in the GUI. Where and how do you want me to report those? "

The translations and message boxes need a small overhaul. It would in my opinion be great if that could become an issue for build19 and I am prepared to spend much time on it. It would in that light also be helpful to return to the smaller font.


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

fk wrote:

"Out of %s"

That makes sense. Unfortunately, when a sentence in the source is changed, its translations in all languages disappear automatically from Launchpad. That makes it hard to update such small changes, much will be lost and never updated anymore and translators might become discouraged. I can only hope that there is a way to fix that.

The way to fix that is for translators to download the files from Launchpad before the change and load them into Virtaal. When they then grab the changed version, Virtaal's translation memory will pull strings that have small changes out of the translation memory and mark the changes, so retranslating goes really fast. Launchpad only offers 100% matches, so using Virtaal is the way to go in these cases.

Maybe the way to go would be to make a complete list, then announce it to give translators some time to grab the old version, and then change them all at once?

Btw. ware names are not translated. I think that it is due to the fact that they are not objects in the game. You will get something like: "Chan eil enots air fhàgail dhomh" face-grin.png

face-grin.png

"I also hit quite a number of truncated strings, because there isn't room enough for them in the GUI. Where and how do you want me to report those? "

The translations and message boxes need a small overhaul. It would in my opinion be great if that could become an issue for build19 and I am prepared to spend much time on it. It would in that light also be helpful to return to the smaller font.

I actually think that the current font is small enough. Especially the text font - when playing the tutorial campaign, I didn't read the flavour messages at all, because it was too hard on my eyes.

One of the truncation problems occurs in the headers for the game lobby, where the font is tiny already. I can't even get "Sgioba" for "Team" in, which is only 1 extra letter. Another prominent example is the OK-button, which is "Ceart ma-thà" in Gaelic. Abbreviations (which English speakers are really fond of) are always a challenge for me, because Gaelic doesn't do them. The best way of course would be dynamic button/column width and the messageboxes adapting accordingly, but I do know that this would take some programming.

BTW: here's a document with general guidelines on what you can expect regarding text size: http://www.w3.org/International/articles/article-text-size

And please do let me know if I you need any further testing data or screenshots.


Busy indexing nil values

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

Time to start with the list.... I will add a post whenever I've finished a file that contains problematic strings. Apart from missing placeholders that force translators to jump through hoops trying to make their language looke like English, plural handling is another big problem. I have found some strings that use ngettext properly, but there are quite a lot more that need to be switched.

File: win_conditions.po

Strings that need ngettext

../../scripting/win_condition_texts.lua:31
%i trees.

../../scripting/win_condition_texts.lua:28
%s has %i trees at the moment.

../../scripting/win_condition_texts.lua:49
Keep it for %i more minutes to win the game.

../../scripting/win_condition_texts.lua:54
Otherwise the game will end in %i minutes.

../../scripting/win_condition_texts.lua:27 ../../scripting/win_condition_texts.lua:53
The game will end in %i minutes.

../../scripting/win_condition_texts.lua:39
Total: %i points

../../scripting/win_condition_texts.lua:47
You still got %i minutes to prevent a victory.

../../scripting/win_condition_texts.lua:33
with %i trees.

Strings that need placeholders

../../scripting/win_condition_texts.lua:30
%s had

Suggested string: %s had %s

BTW where does the last string come up? I have trouble understanding what it means.

Edited: 2013-10-10, 15:31

Busy indexing nil values

Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1439
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2013-10-11, 07:17

This is a great contribution, but it would be even better if you just did the fixes in a branch that we can eventually merge? If you post them here, someone else has to look over them, understand them again (like you already did) and implement your suggestions. You already have all the knowledge to fix the strings directly at their source (feel free to ask here of course if something is unclear). You could also directly fix the plural issues then. Are you interested on working on this?

One more thing, for the placeholders we should use boosts format string format [1]:

cout << boost::format("writing %1%,  x=%2% : %3%-th try") % "toto" % 40.23 % 50;

This allows reordering of the inserted values for translators which is sometimes needed.

[1] http://www.boost.org/doc/libs/1_54_0/libs/format/


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3207
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2013-10-11, 09:06

Sounds good. I'll have to see about compiling the code, to make sure I won't break anything. Wish me luck!

And thanks for the syntax face-smile.png

Edited: 2013-10-11, 11:21

Busy indexing nil values

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

Well, after managing to compile, I tried changing the Lua script. However, we don't have ngettext support for Lua at this time. This is all a bit over my head right now and I would probably need a man week or so to figure this out, since this involves learning 2 new programming languages, which I'd rather spend localizing. Could you please have a look for me, or at least give me some pointers?


So, I tried my hand at a .cc file, since I've done this stuff in C before, and the languages have similar syntax (I've never written a line of C++ in my life). I picked ui_fsmenu/loadgame.cc, line 158 as a test case, because I know where it appears in the game, and I could do some fast testing. Here are some examples of what I tried:


Boost:

boost::format("Do you really want to delete %s?%") % fname,

Result:

loadgame.cc:158:4: error: ‘format’ is not a member of ‘boost’

Raw C++ syntax:

"Do you really want to delete %s?%" % fname,

Result:

loadgame.cc:158:42: error: no match for ‘operator%’ in ‘"Do you really want to delete 
%s?%" % fname’

Printf:

printf(_("Do you really want to delete %s?"), fname),

Result:

loadgame.cc:158:55: error: cannot pass objects of non-trivially-copyable type
‘std::string {aka struct std::basic_string<char>}’ through ‘...’
...

Sprintf:

sprintf(_("Do you really want to delete %s?"), fname),

Result:

loadgame.cc:158:56: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
...

I also tried fiddling with the placeholder, %s, %1, %1%, %1$... nothing works. So, I'm now offically stuck face-sad.png

Edited: 2013-10-11, 12:50

Busy indexing nil values

Top Quote
Tino
Joined: 2009-02-20, 17:05
Posts: 252
Ranking
Tribe Member
Location: Somewhere in Germany...
Posted at: 2013-10-11, 13:31

Hi,

you'll have to include boost::format:

[...]
#include <cstdio>
include "boost/format.hpp"
include "game_io/game_loader.h"
include "game_io/game_preload_data_packet.h"
include "gamecontroller.h"
include "gamesettings.h"
[...]

and then

UI::WLMessageBox confirmationBox
    (this,
 _("Delete file"),
 (boost::format(_("Do you really want to delete %s%?")) % fname).str(),
 UI::WLMessageBox::YESNO);
if (confirmationBox.run()) {
[...]

The string has to be put in _() to get it translated, and because boost::format does not return a std::string we have to do one cast with .str()

Does this help?

Edited: 2013-10-11, 13:35

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

I've done the include and added this:

UI::WLMessageBox confirmationBox
    (this,
     _("Delete file"),
     (boost::format(_("Do you really want to delete %s%?")) % fname).str(),
     UI::WLMessageBox::YESNO);

And the code compiled, but when testing, it didn't like the format:

terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector
<boost::io::bad_format_string> >'
what():  boost::bad_format_string: format-string is ill-formed

It would help if the error message told me what it didn't like about it face-sad.png


Busy indexing nil values

Top Quote
Tino
Joined: 2009-02-20, 17:05
Posts: 252
Ranking
Tribe Member
Location: Somewhere in Germany...
Posted at: 2013-10-11, 19:05

GunChleoc wrote:

what(): boost::bad_format_string: format-string is ill-formed

It would help if the error message told me what it didn't like about it face-sad.png

Ok, what does your entry in the corresponding *.po file looks like? The translation has to contain the %s% part, of course. So, after changing the source code you'll also have to re-compile the po/pot files...

Edited: 2013-10-11, 19:16

Top Quote