Ludeon Forums

RimWorld => Mods => Translations => Topic started by: ison on September 04, 2018, 08:06:39 AM

Title: New keyed translations format
Post by: ison on September 04, 2018, 08:06:39 AM
New keyed translations format
(this post describes a system which will be used in the upcoming unstable build)

We highgly recommend using the translation cleaning tool before changing the keyed translations! This will update all "EN: " comments with the up-to-date English texts.

We've changed the keyed translations format a bit, but it's back-compatible which means everything should work the same as before even if you don't change anything.

Most keyed translations now have extra symbols you can use, like definite and indefinite forms of the item's label. You can access it by writing, for example {0_X}, where X is the name of the sub-symbol. You can find the list of all available sub-symbols at the end of this post.

For example, if {0} refers to a person, you can now write:
{0_definite} took {0_possessive} backpack.
which will be resolved to: John took his backpack.

This flexibility may or may not be useful in your case, depending on how the sentence looks like in your language. Sometimes it's enough to use exactly the same symbols as in English, and sometimes you may want to use more.

Some symbols now have a name, but using numbers is still valid. For example, an English translation may contain text like this: {PAWN_definite}.

There used to be a problem with definite and indefinite articles in some languages. This problem is now fixed for the following languages: German, French, Korean, Russian, Italian, Spanish. So if you used to use e.g. "Un(e)" in French, you now may want to change it to {0_indefinite} (0 is an example here) which should resolve to either "un" or "une" based on the pawn's gender. If your language has definite and indefinite articles but they don't work, then please let us know so we can implement them.

Some languages use different words for each gender. In English this is solved by using {0_pronoun}, {0_objective}, and {0_possessive}. Some languages have many more pronouns though. This can now be solved by using a conditional expression like this: {PAWN_gender ? A : B}. This will resolve to either A or B based on the pawn's gender. If your language uses 3 genders, you can use {PAWN_gender ? A : B : C} (A for male, B for female, and C for neuter). It's possible to use this syntax to resolve indefinite and definite articles, e.g. in French {PAWN_gender ? un : une}, however we don't recommend doing this. In this case it's better to use {PAWN_indefinite}.

Our system can easily tell the gender of a pawn, but it can't tell the gender of any other object. This means that if you want to use a gender conditional expression on, for example, items, then you need to provide some lookup tables by creating the following files in your language folder:
WordInfo/Gender/Male.txt
WordInfo/Gender/Female.txt
WordInfo/Gender/Neuter.txt
and add one word per line to each file, e.g.: (Male.txt)
sword
computer
keyboard


then if an object whose label is "sword" is passed, its _gender will be male.

This makes it possible to do this:
{THING_label} is {THING_gender ? beautiful1 : beautiful2}
where "beautiful" is different based on the THING's gender (which happens in some languages).

Note that we now use {} everywhere instead of []. The RulePackDef system (used by art descriptions and name generators) still uses [] though. Even though the RulePackDefs system works similarly they are 2 separate systems.

List of available symbols for Pawns:
{0}: John, a cat, a dog (short name if possible, otherwise indefinite form of the pawn kind)
{0_nameFull}: John Doe, a cat, a dog (full name if possible, otherwise indefinite form of the pawn kind)
{0_nameFullDef}: John Doe, the cat, the dog (full name if possible, otherwise definite form of the pawn kind)
{0_label}: John, Constructor; cat; dog (label (name + title))
{0_labelShort}: John, cat, dog (short name if possible, otherwise kind label)
{0_definite}: John, the cat, the dog (short name if possible, otherwise definite form of the pawn kind)
{0_nameDef}: John, the cat, the dog (short name if possible, otherwise definite form of the pawn kind)
{0_indefinite}: John, a cat, a dog (short name if possible, otherwise indefinite form of the pawn kind)
{0_nameIndef}: John, a cat, a dog (short name if possible, otherwise indefinite form of the pawn kind)
{0_pronoun}: he/she
{0_possessive}: his/her
{0_objective}: him/her
{0_factionName}: Some Community (faction name)
{0_factionPawnSingular}: colonist (faction member label)
{0_factionPawnSingularDef}: the colonist (faction member label (definite))
{0_factionPawnSingularIndef}: a colonist (faction member label (indefinite))
{0_factionPawnPlural}: colonists (faction members label)
{0_factionPawnPluralDef}: the colonists (faction members label, definite)
{0_factionPawnPluralIndef}: colonists (faction members label, indefinite)
{0_kind}: human, cat, dog (kind label)
{0_kindDef}: the human, the cat, the dog (kind label (definite))
{0_kindIndef}: a human, a cat, a dog (kind label (indefinite))
{0_kindPlural}: humans, cats, dogs (kind label (plural))
{0_kindPluralDef}: the humans, the cats, the dogs (kind label (plural), definite)
{0_kindPluralIndef}: humans, cats, dogs (kind label (plural), indefinite)
{0_kindBase}: human, cat, dog, deer (instead of buck/doe) (base genderless kind label)
{0_kindBaseDef}: the human, the cat, the dog, the deer (base genderless kind label (definite))
{0_kindBaseIndef}: a human, a cat, a dog, a deer (base genderless kind label (indefinite))
{0_kindBasePlural}: humans, cats, dogs, deer (base genderless kind label (plural))
{0_kindBasePluralDef}: the humans, the cats, the dogs, the deer (base genderless kind label (plural), definite)
{0_kindBasePluralIndef}: humans, cats, dogs, deer (base genderless kind label (plural), indefinite)
{0_lifeStage}: teenager, baby, adult (life stage label)
{0_lifeStageDef}: the teenager, the baby, the adult (life stage label (definite))
{0_lifeStageIndef}: a teenager, a baby, an adult (life stage label (indefinite))
{0_lifeStageAdjective}: teenage, baby, adult
{0_title}: constructor (pawn title)
{0_titleDef}: the constructor (pawn title (definite))
{0_titleIndef}: a constructor (pawn title (indefinite))
{0_gender}: male, female (pawn gender)
{0_gender ? A : B}: A if male or neuter, B if female
{0_gender ? A : B : C}: A if male, B if female, C if neuter
{0_humanlike ? A : B}: A if humanlike, B if not

How to contribute (https://ludeon.com/forums/index.php?topic=2933.0)
RimWorld 1.0 Translation Improvements (https://ludeon.com/forums/index.php?topic=41942.0)
New translation cleaner tool (https://ludeon.com/forums/index.php?topic=42587.0)
More minor 1.0 changes + info about LanguageWorkers (https://ludeon.com/forums/index.php?topic=42601.0)
Request: Help check the language workers for accuracy (https://ludeon.com/forums/index.php?topic=44000.0)

[attachment deleted due to age]
Title: Re: New keyed translations format
Post by: k2ymg on September 12, 2018, 05:25:41 AM
Is this works for Backstories ?
Title: Re: New keyed translations format
Post by: Tynan on September 13, 2018, 01:21:03 AM
It doesn't seem to work for pawn traits. We should look at that.

Original report:
QuoteWhen trying to use {PAWN_gender ? A : B} in a label translation, it doesn't work. However, when used in the description translation, it does. Why is this?

The reason we are trying to use {PAWN_gender ? A : B} is a label is because some adjectives (ie. traits) are different based on the gender of the pawn they belong to. So an abrasive male is "Diretto", but an abrasive female is "Diretta". I was wondering if I might be doing something wrong.

<!-- EN: abrasive -->
<Abrasive.degreeDatas.abrasive.label>{PAWN_gender ? Diretto : Diretta}</Abrasive.degreeDatas.abrasive.label>

Title: Re: New keyed translations format
Post by: k2ymg on September 13, 2018, 04:27:49 AM
I see. I'll try it when supported. It seems useful in a case like translate 'courtesean' to 'male prostitute' or 'female prostitute'. Thx.
Title: Re: New keyed translations format
Post by: Elevator on September 18, 2018, 08:33:58 AM
It would be great if conditional formatting worked with ThoughtDef objects. In this case translators can write like that:
<DivorcedMe.stages.divorced_me.label>{0_gender ? развёлся : развелась} со мной</DivorcedMe.stages.divorced_me.label>
instead of:
<DivorcedMe.stages.divorced_me.label>развелся(ась) со мной</DivorcedMe.stages.divorced_me.label>
This will provide cleaner thought messages and help to improve translations to different languages.
Title: Re: New keyed translations format
Post by: Elevator on September 18, 2018, 10:01:45 AM
It would also be great if conditional expressions worked with whitespaces.

Currently
{PAWN_gender ? ваш бывший поселенец : ваша бывшая поселенка}
transfroms to "вашбывшийпоселенец", which doesn't look good.

One of possible solutions could be using quotation marks like this:
{PAWN_gender ? "ваш бывший поселенец" : "ваша бывшая поселенка"}
so that anaylyzer will treat text between qoutation marks as a solid string.

I know that I can write like:
{PAWN_gender ? ваш : ваша} {PAWN_gender ? бывший : бывшая } {PAWN_gender ? поселенец : поселенка}
, but it doesn't seem convenient at all.
Title: Re: New keyed translations format
Post by: morticinus on October 08, 2018, 10:08:18 AM
Hello,
this helped greatly for keyed and backstories (thank you Ison), but:
can you implement this also for definjected folders RULEPACK, TALE, INTERACTION?

i need this (for example):

original template:
[INITIATOR_nameDef] asked [RECIPIENT_nameDef] to join.

translated:
[INITIATOR_nameDef] se {INITIATOR_gender ? zeptal : zeptala} [RECIPIENT_nameDef], zda se nechce připojit.


thank you
Title: Re: New keyed translations format
Post by: Harkeidos on November 14, 2018, 01:03:27 PM
Quote from: ison on September 04, 2018, 08:06:39 AM
Our system can easily tell the gender of a pawn, but it can't tell the gender of any other object. This means that if you want to use a gender conditional expression on, for example, items, then you need to provide some lookup tables by creating the following files in your language folder:
WordInfo/Gender/Male.txt
WordInfo/Gender/Female.txt
WordInfo/Gender/Neuter.txt
and add one word per line to each file, e.g.: (Male.txt)
sword
computer
keyboard


then if an object whose label is "sword" is passed, its _gender will be male.

This makes it possible to do this:
{THING_label} is {THING_gender ? beautiful1 : beautiful2}
where "beautiful" is different based on the THING's gender (which happens in some languages).


Hello,
is it possible to know which list the objects point to?
For example, when I find:

ANIMAL_labelShort {}
or
ANIMAL_label {}

is it possible to know in which file / folder all ANIMALS are listed?

Thank you
Title: Re: New keyed translations format
Post by: Adirelle on November 17, 2018, 08:09:15 AM
Quote from: Harkeidos on November 14, 2018, 01:03:27 PM
Hello,
is it possible to know which list the objects point to?
For example, when I find:

ANIMAL_labelShort {}
or
ANIMAL_label {}

is it possible to know in which file / folder all ANIMALS are listed?

Thank you

I have the same question: how do we extract a list of words to be listed in these files ? from Strings/Words/Nouns/*.xml ? from the labels of DefInjected/*/*.xml ? Should we list the labels as-is or split them in single words and put them in singular form ?
Title: Re: New keyed translations format
Post by: Adirelle on November 25, 2018, 05:08:52 AM
Linking it here for information : https://github.com/Ludeon/RimWorld-fr/issues/235
Title: Re: New keyed translations format
Post by: Harkeidos on November 25, 2018, 02:26:54 PM
Quote from: Adirelle on November 25, 2018, 05:08:52 AM
Linking it here for information : https://github.com/Ludeon/RimWorld-fr/issues/235

Thank you!
Title: Re: New keyed translations format
Post by: b606 on December 05, 2018, 10:49:22 AM
Hello,
I am trying to implement translation for animal kinds which are epicene words in french. That is words which are always "male" or always "female".

For example, "tortue" (turtle), "gazelle" or "panthère" follow female grammar in french. And "écureuil" or "Yorkshire Terrier" follow male grammar. So it is a little shocking to read "un tortue" or "le tortue" when the ANIMAL_gender is male. Instead "une tortue mâle" or "la tortue mâle" is correct. The same rule applies for their plurals.

An instance of these cases can be found in Keyed/Incidents.xml tags <LetterLabelAnimalInsanitySingle>, <AnimalInsanitySingle>, <LetterLabelAnimalSelfTame>, <LetterAnimalSelfTame> and <LetterAnimalSelfTameAndNameNumerical>.

As I cannot rely on ANIMAL_gender for these, I tried to revert to the {0} word gender. 0_gender seems to work for <LetterLabelAnimalInsanitySingle> and <AnimalInsanitySingle> even though {0} nor {0_gender} was not referenced in the english sentence, provided the words are correctly classified in WordInfo/Gender. So far, tests on https://github.com/Ludeon/RimWorld-fr/tree/animal-epicene on these tags are satisfactory.

However, for <*seftTamed*> tags, that did not work. A closer look gives some sort of explanation:
I am stuck here with half a solution. Maybe there are two distinct problems here but the questions are:
Best regards.
Title: Re: New keyed translations format
Post by: Harkeidos on March 03, 2019, 03:43:50 AM
It does not seem to work with the RulePacks_Combat.xml file.
This is the log shown in the game:

Quote
--    Keuneke contro Li
Perde cuore ha portato Li a spirare.
Il proiettile di fucile da caccia di Keuneke ha annientato {recipient_part_destroyed0_gender ? Il : La : Lo} cuore di Li.

--    Illuminati contro I Curbor Del Ruscello
Colpo d'arma da fuoco su torso ha portato Abereimar a morire.
Il proiettile di fucile da caccia di Keuneke ha perforato {recipient_part_destroyed0_gender ? Il : La : Lo} torso di Abereimar e ha colpito {recipient_part_damaged0_gender ? Il : La : Il} {recipient_part_damaged0_gender ? Suo : Sua : Suo} cassa toracica.
Il proiettile di fucile da caccia di Keuneke ha mancato.
Il proiettile di fucile da caccia di Keuneke ha trafitto come un genio {recipient_part_damaged0_gender ? Il : La : Lo} torso di Abereimar.
Keuneke ha fatto fuoco deliberatamente su Abereimar con {WEAPON_gender ? Il : La : Il} {WEAPON_gender ? Proprio : Propria : Proprio} fucile da caccia.

--    Illuminati contro I Curbor Del Ruscello
Rosso-croicaa è {SUBJECT_gender ? Svenuto : Svenuta : Svenuto} a causa di colpo d'arma da fuoco su testa.
{Recipient_part_damaged0_gender ? Il : La : Lo} testa di Rosso-croicaa viene ferito dal proiettile di fucile da caccia {WEAPON_projectile_gender ? Magistrale : Sapiente : Sapiente} di Keuneke.
Il proiettile di fucile da caccia di Keuneke ha eliminato {recipient_part_destroyed0_gender ? Il : La : Lo} polmone destro di Rosso-croicaa e ha danneggiato {recipient_part_damaged0_gender ? Il : La : Il} {recipient_part_damaged0_gender ? Suo : Sua : Suo} torso.
Keuneke ha fatto fuoco accuratamente su Rosso-croicaa con {WEAPON_gender ? Il : La : Il} {WEAPON_gender ? Proprio : Propria : Proprio} fucile da caccia.
Keuneke ha fatto fuoco accuratamente su Rosso-croicaa con {WEAPON_gender ? Il : La : Il} {WEAPON_gender ? Proprio : Propria : Proprio} fucile da caccia.
Il proiettile di fucile da caccia di Keuneke ha mancato di molto.
Il proiettile di fucile da caccia di Keuneke ha mancato.
{Recipient_part_damaged0_gender ? Il : La : Lo} braccio destro di Rosso-croicaa viene danneggiato dal proiettile di fucile da caccia di Keuneke.

There is something wrong?

Thanks
Title: Re: New keyed translations format
Post by: TeiXeR on March 04, 2019, 09:39:40 AM
I think it does not work with any of the RulePackDef files because it's a separate system. Therefore it's complicated to translate the combat logs properly, for example.
Title: Re: New keyed translations format
Post by: morticinus on March 10, 2019, 08:05:52 AM
Hi Ison
The Czech language has three genders. Male, female, neuter. I'm beginning to rework some sentences to sound better. I'm using {0_gender? A: B: C}.
However, I also need to have the D variant like this: {0_gender? A : B : C : D } + added WordInfo/Gender/Plural.txt
(maybe to future customizable like this: {0_gender? A : B : C : D : etc : etc }, only if easy to add)
A = Male
B = Female
C = Neuter
D = Plurale tantum/Classic Plural


Plurale tantum - a noun that appears only in the plural form and does not have a singular variant for referring to a single object, (in czech) door, scissors, pants, etc.

Examples:
"A {1_label} has been short-circuited in the rain and started a fire."
{1_label} {1_gender ? způsobil : způsobila : způsobilo : způsobily } kvůli dešti zkrat a {1_gender ? začal : začala : začalo : začaly } hořet.


"{0} has died because of cold."
{0} kvůli chladu {0_gender ? uhynul : uhynula : uhynulo : uhynuly }.


Please add this to your code. Thank you!
Title: Re: New keyed translations format
Post by: Elevator on March 23, 2019, 12:53:14 PM
QuotePlurale tantum - a noun that appears only in the plural form and does not have a singular variant for referring to a single object, (in czech) door, scissors, pants, etc.
I agree with @morticinus. Russian language works the same way.
Title: Re: New keyed translations format
Post by: ison on April 01, 2019, 11:40:50 AM
Quote from: morticinus on March 10, 2019, 08:05:52 AM
Hi Ison
The Czech language has three genders. Male, female, neuter. I'm beginning to rework some sentences to sound better. I'm using {0_gender? A: B: C}.
However, I also need to have the D variant like this: {0_gender? A : B : C : D } + added WordInfo/Gender/Plural.txt
(maybe to future customizable like this: {0_gender? A : B : C : D : etc : etc }, only if easy to add)

Hmm, I understand. Some nouns are always plural in some languages so even if you know that {0} refers to only 1 object you still need to use the plural form sometimes. Your proposed solution works, though I see some minor problems with it. What if the plural form also depended on the gender? We'd need A : B : C : D : E : F. What if {0} already referred to multiple objects? (e.g. "cats" or "dogs"), would "A" be translated to "cats" or "cat" and then you'd have to use D, E, F? It's a bit confusing. Maybe what we need is something like this: {0_count ? {0_gender ? A : B : C} : {0_gender ? A : B : C}}. It's getting a bit complex, we'd need to pass the "count" information everywhere in our code.
Title: Re: New keyed translations format
Post by: morticinus on April 06, 2019, 08:15:44 AM
Hi Ison,
I don't know if we understand each other. Maybe, I described it wrong.

I need to improve this:

Quote from: ison on September 04, 2018, 08:06:39 AM
Our system can easily tell the gender of a pawn, but it can't tell the gender of any other object. This means that if you want to use a gender conditional expression on, for example, items, then you need to provide some lookup tables by creating the following files in your language folder:
WordInfo/Gender/Male.txt
WordInfo/Gender/Female.txt
WordInfo/Gender/Neuter.txt
and add one word per line to each file, e.g.: (Male.txt)
sword
computer
keyboard


then if an object whose label is "sword" is passed, its _gender will be male.

This makes it possible to do this:
{THING_label} is {THING_gender ? beautiful1 : beautiful2}
where "beautiful" is different based on the THING's gender (which happens in some languages).

{0_gender? A : B } = great for Backstories.xml (used for verbs, adjectives, pronouns (male, female)....etc
{0_gender? A : B : C} = this works great in Keyed folder (primarily for objects) but I can't always use it
{0_gender? A : B : C : D} = I need this for great translation improvements (A Female.txt, B Male.txt, C Neuter.txt, D xxxxx.txt (Plural.txt??))
__________________________________________________________________________________________________
Example using of {0_gender ? A : B : C : D} for label "flower" (Female.txt):
-- {THING_label} is {THING_gender ? beautiful1 : beautiful2 : beautiful3 : beautiful4}.

Singular form - "flower" (translated to květina) is in the file Female.txt

květina //flower
baterie  //battery
židle  //chair
...


Result:
-- Flower is beautiful2.


__________________________________________________________________________________________________
Example using of {0_gender ? A : B : C : D} for label "doors" (Plural.txt):
-- {THING_label} is {THING_gender ? beautiful1 : beautiful2 : beautiful3 : beautiful4}.

Plurale tantum form - "doors" (translated to dveře - only plural form in Czech) is in the file Plural.txt

dveře //doors
nůžky //scissors
kalhoty //pants
...


Result:
Doors is beautiful4


__________________________________________________________________________________________________
Example using of {0_gender ? A : B : C} for label "dog/cat/pig" (Male.txt/Female.txt/Neuter.txt):
-- {0_label} is {0_gender ? beautiful1 : beautiful2 : beautiful3}.

Result:
-- Dog is beautiful1.
-- Cat is beautiful2.
-- Pig is beautiful3.

I would keep a simple system.
This system will help me many problems.

Thank you.
Title: Re: New keyed translations format
Post by: MaBo974 on April 09, 2019, 03:55:52 PM
Hi Ison, I think there is an error with the  definition of {x_objective} for Italian language. I've recently change the Interactions_Prisoner.xml file like this:

<li>r_logentry->[INITIATOR_nameDef] ha promesso a [RECIPIENT_nameDef] dei [goodthingMas], chiedendo a [RECIPIENT_objective] di unirsi.</li>

All fine except [RECIPIENT_objective] was translated as "la"; it should be "lei" for female and "lui" for male.

Please let me know if you need more info.

Thanks and have a nice day.
Title: Re: New keyed translations format
Post by: Arczi008TV on May 04, 2019, 06:27:04 PM
Like morticinus said, we need {1_gender ? A : B : C : D}

Example:
{1_label} has rotted away in storage.

(rotted)

A: Male Rice/potatoe (zgnił - rotted)
B: Female Ambrosia (zgniła - "rottad")
C: Neuter Hay (zgniło - "rottod")
D: Plural Mushrooms/potatoes -Plural (zgniły - "rotteds"
Title: Re: New keyed translations format
Post by: morticinus on April 03, 2020, 12:21:14 PM
Hi
we still need this: {x_gender? A : B : C : D} (A Female.txt, B Male.txt, C Neuter.txt, D Plural.txt)

Any chance to add this to the code?

Thank you
Title: Re: New keyed translations format
Post by: Arczi008TV on July 31, 2021, 01:54:10 PM
Quote from: ison on April 01, 2019, 11:40:50 AM
Hmm, I understand. Some nouns are always plural..

Rice and corn is always plural in my language, but still rice is male and corn is female.

Problem is here. <RawPotatoes.label>Potatoes</RawPotatoes.label>
We can have one potatoe in storage. But you recieve letter:  "Potatoes has rotted away in storage."

So if you could do something like this. (that propably would be easy to do)
<RawPotatoe.label>Potatoe</RawPotatoe.label>
<RawPotatoe.labelPlural>Potatoes</RawPotatoe.labelPlural>

And then use:
  <MessageRottedAwayInStorage>{1_label} {1_gender ? A : B : C} has rotted away in storage.</MessageRottedAwayInStorage>
  <MessageRottedAwayInStoragePlural>{1_labelPlural} {1_gender ? A : B : C} has rotted away in storage.</MessageRottedAwayInStoragePlural>


We could use also
{0_labelPlural} like there is {0_kindPlural}: humans, cats, dogs (kind label (plural)