OpenTTD
OpenTTD copied to clipboard
Help for translating Basque (i18n issues)
The original post, just below these lines, was not very constructive, so you can just jump to this comment to follow the actual constructive comments.
Original post:
Questions about Internationalization (i18n) and Localization
Version of OpenTTD
13.4
Expected result
As I'm a translator and have knowings about i18n, I would love take part in the project for improving translations as much as possible, by improving both i18n and L10n platforms/ways.
i18n
Plural
The first thought on this matter is the Plural i18n tag. It is thought as every language had just two grammatical numbers: singular and plural. But it's not that way. Some languages have more than just two number and even the way they are expressed can differ. That's all well explained here: https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
For example, in Basque we have singular (1) and plural (>1) numbers, but the words accompanying the numbers aren't plural, but indefinite. See this:
Plural for passengers
is bidaiariak
, but when you put that in a sentence... you get this:
3 bidaiariak
And it should be 3 bidaiari
(otherwise, in the string above, it means "The 3 passengers [were doing something]"
So that the i18n doesn't work for Basque, and so could it be for other languages, as it is explained in the link I wrote before.
Whole sentences instead of pieces
As I just explained in the section before, not every language is like English (or like French or Spanish), and that's specially evident when looking at the syntax (word order) and at the morphology (how the plural is build, for example). That's why, when internationalizing, it is highly recommended to give whole sentences instead of just pieces; for example:
To internationalized well the sentence 3 tones of livestock
, it's better to give the translatable string
[NUMB] [UNIT] [CARGO]
rather than giving two isolated strings:
tonne
> plural tonak
livestock
> plural abereak
In the second example, and without the translator knowing how those strings are combined, there will appear
156 tonak abereak
when it should be
156 tona abere
In the first and better example, the translator can place the variables as they wish, and add what needs to be added:
EU singular: [UNIT] [NUMB] [CARGO]
EU plural: [NUMB] [UNIT] [CARGO]
or
ES singular: [UNIT] [NUMB] de [CARGO]
ES plural: [NUMB] [UNIT]s de [CARGO]
As you see, not every language work the same way, and that's need to be taken into account when doing i18n.
Gettext
At last, I would like to recommend using Gettext i18n system, as it is well long developed and used, very well adaptable to very different languages. Besides, I know that system[1] and I could, hopefully, apply it on OpenTTD and solve some such problems that users can find in the translations of typologically different languages.
[1] I'm in charge of the internationalization of the project LiberaForms
L10n
Web platform
Current L10n web-platform (https://translator.openttd.org) does not permit to search specific strings, or at least, I wasn't able to do so after trying buttons and reading the translators manual for a bit. Searching strings is just necessary when, as a translator, you want to fix some specific string.
For that reason and because the current web-platform does not apparently have glossaries, translation memories and comments, I would strongly advise you to give another web based translation platform, as the very well working and free software Weblate
Testing the translation
As what is to translate here is a video game, translators should be able to see how their translation fits the interface and to look for errors before merging it with the code. So... is there any way a translator could load their new LANG file into the game to see their translation?
Thank you a lot, you are a great project that has been active for years and years, a very good project :)
Actual result
We could work together to improve this thing :)
Steps to reproduce
- Play the game in Basque in v 13.4 and you'll see it's wrong, for the reasons explained above.
You seem to be jumping to a few conclusions. But from what I read, mostly you noticed that Basque doesn't have the right plural system attached to it. So I think I can summarize your post to: please change the plural-system attached to Basque? To that I can ask:
Please supply what plural-system is used by Basque. A full list of what we support can be found here:
https://github.com/OpenTTD/eints/blob/main/webtranslate/newgrf/language_info.py#L38
If the one used by Basque is not on there, please supply references to how it works.
At last, I would like to recommend using Gettext i18n system
OpenTTD supports many complex forms of translations, far beyond what gettext offers. Besides the complex plural-system (over 15 systems are supported so far), we also have extensive support for taking plurals into account for partial words, support genders, cases (like acc, abl, dat for Latin), and translators have the freedom to combine sentences in a way that makes sense in their native language (including swapping words, variables, etc). We offer a lot of freedom. Please see https://translator.openttd.org/static/docs/strings.html#plural-form and further for a complete overview, and any of the relatable languages that have translations.
As you see, not every language work the same way, and that's need to be taken into account when doing i18n.
Most of your post is not something I recognize, as we are well aware of the different systems different languages use (which shows by the fact we have OpenTTD translated to 66 different languages). The tone is also rather condescending, but I guess that the actual tone is just lost in translation (hihi, the irony) ;)
So... is there any way a translator could load their new LANG file into the game to see their translation?
Every night OpenTTD creates a new "nightly" which contains the latest version of all translations. This is the best way to see how your translation looks. Given the complexity of our game, this is the best we currently have to offer. We are open for Pull Requests to extend that system however, just nobody has taken on that job yet.
We looked into this a bit more, and from what I can tell, we do support the plural cases you ask for, within the current plural system. It just seems that the translator of 10 years ago made choices that are not in line with your expectations. As you are now the sole translator for Basque, something you can fix!
For example, STR_CARGO_PLURAL_PASSENGERS
is translated (correctly I take from your post) with Bidaiariak
.
As is STR_CARGO_SINGULAR_PASSENGER
. But STR_QUANTITY_PASSENGERS
is translated with {COMMA}{NBSP}bidaiari{P "" ak}
, and from what I read from you, that should be {COMMA}{NBSP}bidaiari
instead? (similar with STR_PASSENGERS
).
{COMMA}
here is the amount of passengers, and {P "" ak}
means: if one passenger, don't add anything, and if more, add ak
. Which seems to be exactly what you run into, and of which you say it is wrong. The last translator however deliberately put it there (seemly by mistake or not understanding the system). It is, however, the only place {P}
is used when looking at cargo. Coal for example is just {WEIGHT_LONG} ikatz
. So maybe that is just done by error.
Also it appears Basque has cases, but the original translators never asked for any. Also maybe something that helps you in the translation?
Anyway, we are very open to add additional support for languages, as we like our game to be as crisps as it can be in other languages (within reason, ofc :P). But we have the issue that you have to learn our system, and we have to learn your language. So we have to find a bit of middleground to talk from. Easiest way for that is to join us on Discord, but also feel free to give examples here where you can't figure out how to make the translation correct, and we can look with you how that fits in our system.
Edit: similar, your example of "tons" is translated with {DECIMAL}{NBSP}tona{P "" k}
, which seems to be wrong too, if I understand you correctly.
Edit 2: I also looked at your livestock example, but the English string is: {COMMA}{NBSP}item{P "" s} of livestock
. Which is exactly what you suggest. And we don't measure livestock in tonnes, but in items. Which is translated with {COMMA}{NBSP}abere buru
. So I am a bit confused about that part of your post. We already offer the combination as a whole string (as many of the other 66 languages also need that context to do a proper translation). Can you elaborate on what I am missing here?
First of all, I want to apologize, since I did actually jump to some wrong conclusions. I am sorry if the tone came across as condescending. I was surely enthusiastic, but I didn't mean to be condescending.
That said, I just have a question to improve Basque and maybe its i18n: how can I translate and search for specific strings? Either on the web platform or locally.
If I had anything to say about i18n, I will join Discord.
To end up, my example of the livestock was just fictional, not a real one. Sorry for the confusion.
So I ask again about how could I search specific strings, and I'll try to make this little mess a bit more constructive.
First of all, I want to apologize, since I did actually jump to some wrong conclusions. I am sorry if the tone came across as condescending. I was surely enthusiastic, but I didn't mean to be condescending.
No worries :)
Currently the easiest way to search is by looking at the source file (https://github.com/OpenTTD/OpenTTD/blob/master/src/lang/basque.txt). Or on the main page of a language with CTRL+F.
As this of course is a suboptimal solution, we so happen to be in active development of a new version of our translator tool, which will allow for searching from the interface. But that is weeks away, as time is hard to come by :)
Great! I just started translating wrong strings and, for that, I found out that if I enter the string name into the web translator slug, I can actually search and edit specific strings!
While correcting previous translation, I found some strings in which I need help, for example, STR_NEWS_COMPANY_MERGER_DESCRIPTION In this string, there are two variables called {STRING}. How does the program decide which one is the cargo and which on the competitor? By the order? If it's that way, it would be helpful if those two variables are marked differently so the translators can place them in any order.
This bit is in the manual: https://translator.openttd.org/static/docs/strings.html#string-commands
By the order?
Yes.
If it's that way, it would be helpful if those two variables are marked differently so the translators can place them in any order.
As @LordAro mentions, you already can, by using {STRING:0}
for the first, and {STRING:1}
for the second.
In the new webtranslator version we are working on, this is made more explicit. That is to say, the English string already shows {STRING:0}
and {STRING:1}
, so it is more clear to translators that you can just swap them around in translations. This is in the current system a bit hidden, but once you know, you know :) (and not many translators know, so I can understand your question here :D )
Thanks both. I'll use the number afixes for that. And as you are working on making this thing more clear, what do you think about giving different names to each parameter, so the translator does not only know the order, but also the content of each string explicitly, without needing to deduce what could it be or checking it in the game?
For example, in the given example it could be this way:
[...]{CARGO_STR} has been sold to {PLAYER_STR} for {CURRENCY_LONG}!
This would have been a good idea 20 years ago. And it has been talked about on and off over the years. But doing it now would be a massive undertaking. Almost 5000 strings need to be evaluated, and then synchronized with 65 translations. I do not think anyone would be against such change, if done properly. But I also think that most people are like: meh, it is clear enough in the context of the English string, so the added value is not all that high for the amount of effort it would take.
But if we would do it, we do need to think about how. For example, CARGO_STR
might not be ideal; as internally we only care it is a {STRING}
. But maybe some other way, like {STRING:cargo}
, instead of {STRING:0}
. I dunno. But it requires a bit of designing and testing with other developers / translators. And then a lot of effort to make it happen.
So if you are up for it, create a design, test it with us, and go for it! I know it would make several translators happy :)
In the example, both {RAW_STRING} are actually the result of {COMPANY}, but preparsed because at the time the news is displayed one of them is gone.
I see that's a very big work. I'm not for it by now.
About the translations, I updated and fixed locally a lot of errors in the Basque translation, but couldn't find the way to update the file via Web Translator, so I'm pasting it here hoping someone will be able to incorporate it basque.txt
Sadly, that is not possible or practical. You really have to insert the translation in our webtranslator, as it also does validation and hints towards problems while doing so. We cannot judge any validation errors thrown at us, as such, it really has to be done by someone understanding the native language.
Oh, and isn't there any way to load the file into the WebTranslator so it do validation and give hints?