dynamic array-like string variables (WML) for translations

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
Post Reply
VS
Translator
Posts: 187
Joined: November 27th, 2005, 10:07 am

dynamic array-like string variables (WML) for translations

Post by VS »

While translating the new tutorial I keep running into problems with the way player names are represented. Normal campaigns just hard-wire them into messages strings, so there's no problem with them, you translate them with the whole text. But if name of some unit is in a variable, you can translate it only once in the variable initialization and then it's just inserted in the same form (state?) everywhere via variables. This works well for English, but other languages (I mean Slavonic, but there may be more) just can't handle that. You need different forms (better term for this?) of nouns in different context, and since names are nouns, too, almost any sentences constructed by using variables with names are quite ... wrong.

So, what I'd like to see added to WML is some way to ...
1) create string array at run-time by parsing a translatable string -> unknown number of array fields
2) reference easily fields of such array in message strings

This is what it may look like:

Code: Select all

# English source
[init_trans_array]
  varname = playername
  content = _ "Konrad"
[/init_trans_array]

[message]
  message = _ "Look, I see $playername[0] and his army there!"
[/message]
Whereas the translations for these could be:

Code: Select all

# Czech translations
"Konrád|Konráda|Konrádovi|Konráda|Konráde|Konrádovi|Konrádem"
"Podívej, tamhle vidím $playername[4] a jeho vojsko!"
As you can see, both initialization of array and using its values is fully customizable by translator.

Only $playername without [index] would return [0] (backward compatibility), invalid indexes too (as it's always there).

Yes, I know WICOT applies to this in very very general principle, but the [variables] syntax is just horrible, it does not offer any meaningful way to translate its whole content at once and finally (what is the point here), it can not define unknown (varying) number of strings.
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Post by Viliam »

IMHO technically simpler would be not to insert a hero name via variable, but instead have two catalog entries:

"Look, I see Konrad and his army there!"
"Look, I see Li'sar and her army there!"


:cry: Generally, whenever you construct a sentence from pieces, expect localization problems. So it is better to avoid sentence construction if possible.

I made today a Slovak translation of the tutorial, sometimes it was impossible to translate correctly; sometimes the "translation" required some creativity. -- It goes usually like this; if a name would be declinated in the sentence (but game engine of course does not support declinations), I modify the sentence so that the word appears in its "base form". For example instead of "I see $HERO there" I translate "There is $HERO"... the meaning is the same, but the word is not declinated.


BTW: It is really annoying to translate 10 times "*Left click or any key to continue..." If some sentence is 10 times repeated at the end of various dialogs, consider string concatenation. That is, instead of:

_"You are standing in the keep, and your mentor Delfador is on the East side of the river.
*Left click or any key to continue..."

_"The places $he could move to are highlighted.
*Left click or any key to continue..."


Use something like this:

_"You are standing in the keep, and your mentor Delfador is on the East side of the river." _"
*Left click or any key to continue..."

_"The places $he could move to are highlighted." _"
*Left click or any key to continue..."


It gives the same result, but you it is enough to translate the last sentence once. (If the string appears twice in exactly the same form, it is translated only once. If there are differences, however small, it must be translated twice.)
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

Viliam wrote:BTW: It is really annoying to translate 10 times "*Left click or any key to continue..." If some sentence is 10 times repeated at the end of various dialogs, consider string concatenation. That is, instead of:
If you have specific strings that can be modified in this way, please send me a PM list.
Hope springs eternal.
Wesnoth acronym guide.
Xan
Inactive Developer
Posts: 258
Joined: August 28th, 2005, 3:05 pm
Contact:

Post by Xan »

Viliam wrote:IMHO technically simpler would be not to insert a hero name via variable, but instead have two catalog entries:

"Look, I see Konrad and his army there!"
"Look, I see Li'sar and her army there!"


:cry: Generally, whenever you construct a sentence from pieces, expect localization problems. So it is better to avoid sentence construction if possible.
I completely agree with this, and it is what I would do if I made a campaign that uses "dynamically formatted" strings.
"It is time people learned about their failures and my successes."
rusty
Inactive Developer
Posts: 21
Joined: January 7th, 2006, 12:26 am

Re: dynamic array-like string variables (WML) for translatio

Post by rusty »

VS wrote:While translating the new tutorial I keep running into problems with the way player names are represented. Normal campaigns just hard-wire them into messages strings, so there's no problem with them, you translate them with the whole text. But if name of some unit is in a variable, you can translate it only once in the variable initialization and then it's just inserted in the same form (state?) everywhere via variables. This works well for English, but other languages (I mean Slavonic, but there may be more) just can't handle that. You need different forms (better term for this?) of nouns in different context, and since names are nouns, too, almost any sentences constructed by using variables with names are quite ... wrong.
I'm happy to change the tutorial to make it translatable, but I was not aware of a language which actually had a problem 8(.

I can do double-strings if there is really no good work around, but I would need to do it sooner, not later, because all the translations would have to catch up!

Thanks!
Rusty.
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Post by Viliam »

Later (this evening hopefully) I will try to write a detailed report based on this tutorial. Not only because of the tutorial, but generally for campaign authors to avoid some common mistakes. Something like "how to make your campaign easy to localize". It will generally be a list of "Don't do this... because of this...". ;-)

That "*Left click or any key to continue..." thing was so annoying that I remembered it.


BTW: The new tutorial is great... I liked it very much!!!
rusty
Inactive Developer
Posts: 21
Joined: January 7th, 2006, 12:26 am

Tutorial strings revised..

Post by rusty »

Viliam wrote:Later (this evening hopefully) I will try to write a detailed report based on this tutorial. Not only because of the tutorial, but generally for campaign authors to avoid some common mistakes. Something like "how to make your campaign easy to localize". It will generally be a list of "Don't do this... because of this...". ;-)
That would be awesome! I've separated all the strings and even the Left click in the tutorial and committed it (I decided to do it now, in time for 1.1.4).
BTW: The new tutorial is great... I liked it very much!!!
Hey, thanks! It was my first "campaign" so I was learning along the way, and lots of people helped to answer my dumb questions.

Thanks!
Rusty.
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Post by Viliam »

Rusty, I especially liked the idea of displaying information in labels, as opposed to dialogs only. That was a revolutionary change. The only problem I see about it is that the labels are at the bottom of hex, not in the middle; therefore the descriptions of "deep water" and "shallow water" are a bit confusing... probably putting only one "deep water" mark and one "shallow water" mark in such places that both that hex and the hex below are of the same type, would be more legible.

And here is "What you should know to make your campaign easy to translate" ;-)
torangan
Retired Developer
Posts: 1365
Joined: March 27th, 2004, 12:25 am
Location: Germany

Post by torangan »

Feel free to expand the thread, I made it sticky already.
WesCamp-i18n - Translations for User Campaigns:
http://www.wesnoth.org/wiki/WesCamp

Translators for all languages required: contact me. No geek skills required!
Post Reply