What you should know to make your campaign easy to translate

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

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

What you should know to make your campaign easy to translate

Post by Viliam »

This topic is related to localization, but it should be read by campaign authors.

Translating programs has two steps. The second step is the translating of the texts... leave this to translators. But the first step is making a program and scenarios so that they are possible to translate; preferably easy to translate. Therefore the goal of this topic is to give enough information to English-only speaking campaign developer so that he or she can write campaigns that will be a pleasure to localize. ;-)



The most important rule of all is: Do not split sentences. That is, avoid (ab)using the cool WML features that allow you to insert a string variable in the middle of sentence, like this:

message = _"Attention, everyone! I see $unit approaching!"

Why? In some languages placing a word in a sentence requires more than mere string concatenation. Some languages use declension.

Declension is when the form of the word (typically noun, but also adjective, pronoun, or article) changes according to the role ("case") of the word in the sentence. Each language supporting declension may have different number (I guess it goes from 2 to 7) of cases, defined differently. Here is example how the same word would be declined in Slovak language:

Toto je Konrád. = This is Konrad. (nominative -- describing someone)
Nevyhráme bez Konráda. = We will not win without Konrad. (genitive -- originating from someone)
Daj žezlo Konrádovi. = Give the scepter to Konrad. (dative -- movement towards someone)
Vidí­m Konráda. = I see Konrad. (accusative -- pointing at someone)
Vitaj, Konrád! = Welcome, Konrad! (vocative - addressing someone directly)
Hovoríme o Konrádovi. = We speak about Konrad. (locative -- "location" of someone)
Pocestujeme s Konrádom. = We will travel with Konrad. (instrumental -- using someone)

So for example "I see Konrad approaching." would become "Vidí­m prichádzať Konráda." OK, the problem is still not completely obvious... why "I see $unit approaching." couldn't be translated as "Vidí­m prichádzať $unit|a."?

Well, because declension may be more difficult than adding a specified suffix in a specified situation. First, different types of words may have completely different declension patterns (for example based on "gramatical gender" of the word and/or its ending), see later. Second, in some languages adjectives also have to be declined, so "Elder Lich" ("Starší­ kostej") in sentence "I see Elder Lich." becomes "Vidí­m staršieho kosteja." Third, inflecting a word sometimes mean not only adding some suffix, but also removing some, see later. Here is example, how the same sentences would work in Slovak for Asheviere.

Toto je Aševiera. = This is Asheviere.
Nevyhráme bez Aševiery. = etc. the same sentences like in example about Konrad
Daj žezlo Aševiere.
Vidí­m Aševieru.
Vitaj, Aševiera!
Hovorí­me o Aševiere.
Pocestujeme s Aševierou.

So the sentence "I see $unit approaching." may become "Vidí­m prichádzať Konráda." or "Vidí­m prichádzať Aševieru." -- and there is no way to do this correctly.

-

So, what do I do when I have to translate a sentence like "I see $unit approaching." Using a rule of thumb "the translated sentence must look naturally, even if the accurateness had to be sacrificed" I change it to something like "I see someone approaching. It is $unit." It is almost the same thing, but such wording requires nominative case, so the string concatenation will result in gramatically correct sentence. 8) However, this is not always possible to do, and it often feels artificial, so I would rather avoid having to do this.



By the way, there are also some usages of declension in English, did you notice? It is used with pronouns: "I", "me", "my" / "mine"; "we", "us", "our" / "ours"; "you", "your" / "yours"; "he", "him", "his"; "she", "her" / "hers"; "they", "them", "their" / "theirs"; "who", "whom", "whose". It is the same mechanism... but in some other languages it is used much more widely.
Last edited by Viliam on May 17th, 2011, 8:54 am, edited 2 times in total.
Molean
Posts: 157
Joined: July 25th, 2009, 7:11 pm

Re: What you should know to make your campaign easy to translate

Post by Molean »

Hi, I was reading this thread out of curiosity.

For those of us who aren't coders, inserting a string variable in a middle of a sentence refers to the exclamation mark in that example? Or what?

It might be just me, but your post was hard to understand without knowing Slovak myself. To make it clearer, you might put the translation of each slovak sentence/phrase after you list it.
User avatar
melinath
Posts: 1298
Joined: May 20th, 2009, 7:42 am

Re: What you should know to make your campaign easy to translate

Post by melinath »

Molean wrote:Hi, I was reading this thread out of curiosity.

For those of us who aren't coders, inserting a string variable in a middle of a sentence refers to the exclamation mark in that example? Or what?

It might be just me, but your post was hard to understand without knowing Slovak myself. To make it clearer, you might put the translation of each slovak sentence/phrase after you list it.
...
First of all, if you aren't a coder, how are you making a campaign? If you aren't making a campaign, why are you complaining about a post for campaign makers?

Secondly, he very clearly stated what "inserting a string variable is": (emphasis on 'like this' is mine)
Viliam wrote:That is, avoid (ab)using the cool WML features that allow you to insert a string variable in the middle of sentence, like this:

message = _"Attention, everyone! I see $unit approaching!"
Thirdly, he did translate the Slovak.
Molean
Posts: 157
Joined: July 25th, 2009, 7:11 pm

Re: What you should know to make your campaign easy to translate

Post by Molean »

Don't be like that, melinath. The first was out of curiousity, the second was "if I didn't understand it because of lack of translation, maybe others didn't as well" & curiousity. Either way, no reason to get your underwear in a bunch. Curiousity being as much about learning as anything else. If I ever want to learn to map make etc, I will need to start somewhere.

The "like this" example did not tell me what part of that example was the "insertion of a string variable the middle of sentence"

Except for the first bit, most all of the slovak was not translated.
For example:
Spoiler:
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: What you should know to make your campaign easy to translate

Post by zookeeper »

Molean wrote:The "like this" example did not tell me what part of that example was the "insertion of a string variable the middle of sentence"
The bolded part:
_"Attention, everyone! I see $unit approaching!"

You know that the variable reference has ended if there's a space or a |. Thus, in this case, you'll know that the name of the variable which's value is used is "unit" instead of, for example, "unit approaching". Likewise in the string _"I see $unit|!" the variable name is also "unit", because | is used to denote the end of the variable name (without the |, the game would try to use the value of a variable named "unit!" instead).
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: What you should know to make your campaign easy to translate

Post by Max »

how do you handle cases where you don't know the gender of the person speaking (e.g. in a sighted event) and the translation differs if it's male or female (like in most slavic languages)?
caslav.ilic
Translator
Posts: 61
Joined: February 5th, 2007, 4:17 pm
Location: Brunswick, Germany

Re: What you should know to make your campaign easy to translate

Post by caslav.ilic »

Yes, that's a classical problem. In Serbian we use a slightly old-fashioned/very literary form of past tense, which unlike the more usual form, happens not to depend on gender of the speaker.

Within current Gettext framework, the general solution to this would be to introduce a way to get unit gender in WML (I've little idea about WML, so I wouldn't know if it's actually possible right now), and then use it to choose between the two messages, with "female speaker^..." and "male speaker^..." contexts.
Chusslove Illich (Часлав Илић)
User avatar
pauxlo
Posts: 1047
Joined: September 19th, 2006, 8:54 pm

Re: What you should know to make your campaign easy to translate

Post by pauxlo »

Molean wrote:Hi, I was reading this thread out of curiosity.

For those of us who aren't coders, inserting a string variable in a middle of a sentence refers to the exclamation mark in that example? Or what?
No, it refers to the use of $unit (a variable which will be expandad to the name of a unit) in the middle of the sentence.
Molean wrote:It might be just me, but your post was hard to understand without knowing Slovak myself. To make it clearer, you might put the translation of each slovak sentence/phrase after you list it.
The translations for Asheviere are the same as for Konrad.
There is added a bit of cripplying by some forum crashes (which seem to have reinterpreted the UTF8 strings as Latin 1 (or its windows variant), two times) after the creation of the post in 2006, so the slovak words doen't look like slovak words ...
The right sentences should be:
Viliam wrote: This is Konrad.
Toto je Konrád (nominative).

We cannot win without Konrad.
Nemôžeme vyhrať bez Konráda. (genitive)

Give the scepter to Konrad.
Daj žezlo Konrádovi. (dative)

I see Konrad.
Vidám Konráda. (accusative)

Welcome, Konrad!
Vitaj, Konrád! (vocative)

We speak about Konrad.
Hovoráme o Konrádovi.

We will travel with Konrad.
Pocestujeme s Konrádom. (instrumental)

So for example "I see Konrad approaching." would become "Vidám prichádzať Konráda." OK, the problem is still not completely obvious... why "I see $unit approaching." couldn't be translated as "Vidám prichádzať $unit|a."?

Well, because declension may be more difficult than adding a specified suffix in a specified situation. First, different types of words may have completely different declension patterns (for example based on "gramatical gender" of the word and/or its ending), see later. Second, in some languages adjectives also have to be declined, so "Elder Lich" ("Staršá kostej") in sentence "I see Elder Lich." becomes "Vidám staršieho kosteja." Third, inflecting a word sometimes mean not only adding some suffix, but also removing some, see later. Here is example, how the same sentences would work in Slovak for Asheviere.

This is Asheviere.
(etc)

Toto je Aševiera.
Nemôžeme vyhrať bez Aševiery.
Daj žezlo Aševiere.
Vidám Aševieru.
Vitaj, Aševiera!
Hovoráme o Aševiere.
Pocestujeme s Aševierou.

So the sentence "I see $unit approaching." may become "Vidám prichádzať Konráda." or "Vidám prichádzať Aševieru." -- and there is no way to do this correctly.
[...]
(I hope I got the re-trancoding right ... strangely it was not a simple double UTF-8 coding, but one letter (ť) got trough untranscoded, and in some cases the last byte (¡) of a sequence was cut of.)
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Re: What you should know to make your campaign easy to trans

Post by Viliam »

Max wrote:how do you handle cases where you don't know the gender of the person speaking (e.g. in a sighted event) and the translation differs if it's male or female (like in most slavic languages)?
a) I complain to the campaign author. :lol2:
b) I try to rephrase the sentence so that the substituted word appears in the basic (nominative) case.

For example: "You see $unit." could become "$unit was seen." or something like this.

(This solution may not work in some languages or even in some other situations is Slovak.)

-

OK, I fixed the UTF-8 things, the examples should be legible again. I also added more colors to hopefully make it easier to read.

Please note that my point was not that you should learn Slovak. :lol2: My point was: "Don't concatenate words in sentence." If you trust me about this, you don't need to read more. The rest of the long text is just an answer to "Why not?". And perhaps for amusement of curious readers.

Similar situation exist in other languages, too. At least all Slavic and Baltic languages, and Latin language. I am not sure about other languages. German has it too, but a bit differently. So this concerns many translations, not just one or two.
jonadab
Posts: 148
Joined: October 7th, 2005, 2:33 am
Location: Ohio
Contact:

Re: What you should know to make your campaign easy to trans

Post by jonadab »

Viliam wrote:My point was: "Don't concatenate words in sentence."
So then what do we do instead, in a situation where different actions on the user's part may lead to different details?

(Also, does this conversation tempt anyone else to write a sequence of dialog wherein each remark contains a pun based on an idiom from the previous speaker's comment, like the fight scene between Elan and his father in Order of the Stick?)
I write Bible School materials:
http://bibleschoolmaterials.blogspot.com/
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: What you should know to make your campaign easy to trans

Post by AI »

You write out the whole sentence multiple times, one for each option.
Anagkai
Posts: 58
Joined: February 12th, 2012, 10:05 am

Re: What you should know to make your campaign easy to trans

Post by Anagkai »

I happen to be an "expert" for German. :D
Normally, names aren't declined:

"Das ist Konrad." -> "This is Konrad." -> Nominative
"Ich sehe Konrad." -> "I see Konrad." -> Akkusative

But there can be problems with the gender of unit type names:

"Ich traf eine Elfendruidin." -> "I met an elvish druid."
"Ich traf einen Zwergenkämpfer." -> "I met a dwarvish fighter."

The articles need to be different, because the first one is female and the second one is male.
My campaigns: Princess Nilwyn (available) & Home of the Undead (available)
Anagkai
Posts: 58
Joined: February 12th, 2012, 10:05 am

Re: What you should know to make your campaign easy to trans

Post by Anagkai »

Anagkai wrote:I happen to be an "expert" for German. :D
Normally, names aren't declined:

"Das ist Konrad." -> "This is Konrad." -> Nominative
"Ich sehe Konrad." -> "I see Konrad." -> Akkusative

But there can be problems with the gender of unit type names:

"Ich traf eine Elfendruidin." -> "I met an elvish druid."
"Ich traf einen Zwergenkämpfer." -> "I met a dwarvish fighter."

The articles need to be different, because the first one is female and the second one is male.
EDIT: I explained it, because Viliam talked about german translations.
My campaigns: Princess Nilwyn (available) & Home of the Undead (available)
Exasperation
Posts: 462
Joined: June 8th, 2006, 3:25 am

Re: What you should know to make your campaign easy to trans

Post by Exasperation »

The ongoing saga of Procedural Content vs. Translatable Strings continues:

Would something like the following scheme work?

Code: Select all

if spotted_gender == "male" then
	if enemy_gender == "male" then
		raw_string = _ "male_unit_name^%s the male_unit_type^%%s notices male_unit_name^%%%%s"
		wesband.message("", string.format(string.format(string.format(raw_string, enemy_name), enemy_type), spotted_name))
	elseif enemy_gender == "female" then
		raw_string = _ "female_unit_name^%s the female_unit_type^%%s notices male_unit_name^%%%%s"
		wesband.message("", string.format(string.format(string.format(raw_string, enemy_name), enemy_type), spotted_name))
	else
		raw_string = _ "A gender_neutral_unit_type^%s notices male_unit_name^%%s"
		wesband.message("", string.format(string.format(raw_string, enemy_type), spotted_name))
	end
elseif spotted_gender == "female" then
-- remaining 9 cases removed for sanity's sake
end
This is an excerpt from a Lua function, which is why it doesn't use the $varname format. Getting the unit names, genders, and translated unit types is not a problem and you can assume they have already been stored in the appropriate variables. The nested calls to string.format is so that the variables will be substituted correctly regardless of whether the translator needs to move them around in the sentence and they wind up in a different order (ie if you move %%s to before %s, %s will still become the contents of the variable substituted in the innermost call to string.format).

If this is a workable solution (or at least mostly workable), would I need to create a default translation to keep the context hints from showing up in the English version of the final output string?
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: What you should know to make your campaign easy to trans

Post by Anonymissimus »

Doesn't the translation algorithm ignore those xxx^ hints prefixing something else anyway ? You could try female^ and so if not (perhaps it doesn't allow for arbitrary xxx strings.)
If that doesn't work (especially since just male/female is not enough here), it should also be possible to give the translator context hints outside of the actual string; namely in wml there can be
# po: xxxxx
commments which are visible for the translator (at least if he's watching out for them). So in lua a
--# po: xxx
comment hopefully works. (If not, tell AI). So you could put something like %s=male_unit_name; %%s=male_unit_type etc there.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Post Reply