Ludeon Forums

Ludeon Forums

  • November 18, 2018, 11:41:31 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: New keyed translations format  (Read 3800 times)

ison

  • Developer
  • Planetologist
  • *****
  • Posts: 2120
    • View Profile
New keyed translations format
« 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:
Code: [Select]
{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)
Code: [Select]
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:
Code: [Select]
{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
RimWorld 1.0 Translation Improvements
New translation cleaner tool
More minor 1.0 changes + info about LanguageWorkers
« Last Edit: September 07, 2018, 11:01:27 AM by ison »
Logged

k2ymg

  • Drifter
  • **
  • Posts: 24
  • Refugee
    • View Profile
Re: New keyed translations format
« Reply #1 on: September 12, 2018, 05:25:41 AM »

Is this works for Backstories ?
Logged

Tynan

  • Developer
  • Administrator
  • Transcendent
  • *****
  • Posts: 11500
    • View Profile
    • Tynan's Blog
Re: New keyed translations format
« Reply #2 on: September 13, 2018, 01:21:03 AM »

It doesn't seem to work for pawn traits. We should look at that.

Original report:
Quote
When 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.

Code: [Select]
<!-- EN: abrasive -->
<Abrasive.degreeDatas.abrasive.label>{PAWN_gender ? Diretto : Diretta}</Abrasive.degreeDatas.abrasive.label>
Logged
Tynan Sylvester - @TynanSylvester - Tynan's Blog

k2ymg

  • Drifter
  • **
  • Posts: 24
  • Refugee
    • View Profile
Re: New keyed translations format
« Reply #3 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.
Logged

Elevator

  • Drifter
  • **
  • Posts: 63
  • Refugee
    • View Profile
Re: New keyed translations format
« Reply #4 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:
Code: [Select]
<DivorcedMe.stages.divorced_me.label>{0_gender ? развёлся : развелась} со мной</DivorcedMe.stages.divorced_me.label>instead of:
Code: [Select]
<DivorcedMe.stages.divorced_me.label>развелся(ась) со мной</DivorcedMe.stages.divorced_me.label>This will provide cleaner thought messages and help to improve translations to different languages.
« Last Edit: September 18, 2018, 10:23:47 AM by Elevator »
Logged

Elevator

  • Drifter
  • **
  • Posts: 63
  • Refugee
    • View Profile
Re: New keyed translations format
« Reply #5 on: September 18, 2018, 10:01:45 AM »

It would also be great if conditional expressions worked with whitespaces.

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

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

I know that I can write like:
Code: [Select]
{PAWN_gender ? ваш : ваша} {PAWN_gender ? бывший : бывшая } {PAWN_gender ? поселенец : поселенка}, but it doesn't seem convenient at all.
Logged

morticinus

  • Muffalo
  • *
  • Posts: 4
  • Refugee
    • View Profile
Re: New keyed translations format
« Reply #6 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):
Code: [Select]
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
Logged

Harkeidos

  • Muffalo
  • *
  • Posts: 11
  • Refugee
    • View Profile
Re: New keyed translations format
« Reply #7 on: November 14, 2018, 01:03:27 PM »

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)
Code: [Select]
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:
Code: [Select]
{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
Logged

Adirelle

  • Muffalo
  • *
  • Posts: 4
  • Refugee
    • View Profile
Re: New keyed translations format
« Reply #8 on: November 17, 2018, 08:09:15 AM »

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 ?
Logged