Latest Posts

Topic: Empty strings

stonerl
Avatar
Topic Opener
Joined: 2018-07-29, 23:03
Posts: 327
Ranking
Tribe Member
Posted at: 2019-05-17, 13:41

How do we handle empty strings?

servername_ui = (boost::format(_("unnamed %u")) % i++).str();

e.g. here it would set unnamed to an empty string if the translation was "". That is the case for all en_US.po strings because they do not contain any translations.

Should I check servename ui again and do:

servername_ui = (boost::format(("unnamed %u")) % i++).str();

Edit: The string is only empty in debug but not release. How come?

Edited: 2019-05-17, 13:50

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2019-05-18, 17:11

If the translation was "", Widelands would crash, because the placeholder is not present. The only way that happens is if a translator decided to translate with an empty string, which is completely wrong in this case. This will get picked up eventually when I run my translation validation script and I would fix it on Transifex and pull the translations again.

That is the case for all en_US.po strings because they do not contain any translations.

Since when? I guess I don't understand what you mean here. In any case, if something has not been translated, Gettext will simply show the original string.

tl;dr show me to the commit and give me steps to reproduce and I will have a look.

Also if you are working on something, do not touch the po files. That's all generated by script.


Busy indexing nil values

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-29, 23:03
Posts: 327
Ranking
Tribe Member
Posted at: 2019-05-23, 11:59

I'm talking about the changes I made in this already merged branch:

https://code.launchpad.net/~widelands-dev/widelands/bug-1825932-open-games-clean-start

Here I take the translated string and add a number in case a hostaname with the same name exists. This does work with release but not with debug. Since all strings in en_US.po are empty, in debug it takes an empty string, in release it takes the original string "unnamed".

Since when? I guess I don't understand what you mean here. In any case, if something has not been translated, Gettext will simply show the original string.

en_US.po is empty. No string is translated. Every time I switch to "try system language" (en_US in my case) I get a message in the settings that tells my that 100% of the translations are missing. That is because en_US.po does not contain any translated strings.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2019-05-25, 18:47

So what? If en_US.po is empty, it falls back to the source string.

The message in the options is just there to manage user expectation, because we have some translations with low coverage.

I tried to do some testing with the locale and got

[Host]: disconnect_client(0, DIFFERENT_PROTOCOL_VERS, )
widelands: ../src/network/nethostproxy.cc:259: void NetHostProxy::receive_commands(): Assertion `clients_.count(id)' failed.
Aborted (core dumped)

So something's fishy in any case.

Edited: 2019-05-25, 18:48

Busy indexing nil values

Top Quote