In Progress Français The token {.l} does not work properly

Users who are viewing this thread

Version number
1.7.1
Branch
Beta
Modded/unmodded
No, I didn't use any mods.

Daneel53

Sergeant Knight at Arms
Translation Error: L'empire a assiégé l'Onica
Corrected Translation: L'empire assiégé Onica
Where did you find this error (which conversation, screen, area,...)?: Trials
Screenshot:

Hi TaleWorlds devs!

When reading the code of the token {.l}, I understood that the goal of this token is to put an article of type "le", "la" or "l'" (in English, "the") before the name of something: a faction, a group, a castle, etc.

For example, in French we write:
- "L'empire a assiégé les Kuzaïtes"
- "L'empire a assiégé le château d'Onica"
- "L'empire a assiégé Poros" (no article before a town name)
- "L'empire a assiégé Onica" (no article before a town name)

The way to generate such a sentence in French should be by writing "L'empire a assiégé {.l}{ITEM}", but unfortunately that doesn't work if ITEM is a town or a village whose name begins with a vowel:
1646304034890.png

Your code that deal with the token {.l} is written so that the article is generated only when the ITEM has a genre. When the token is {.l}, ProcessToken calls HandleDefiniteArticle(), that calls GetDefinititeArticle() that do this:

Code:
text2 = null
if (this._isPlural)
{
    text2 = FrenchTextProcessor._genderToDefiniteArticle[FrenchTextProcessor.WordType.Plural];
}
else if (this.CheckNextCharIsVowel(text, cursorPos) && !this.CheckIfNextWordShouldBeConsideredAConsonant(text, token, cursorPos))
{
    text2 = FrenchTextProcessor._genderToDefiniteArticle[FrenchTextProcessor.WordType.StartingWithaVowel];
}
else if (this._curGender != FrenchTextProcessor.WordGenderEnum.NoDeclination)
{
    text2 = FrenchTextProcessor._genderToDefiniteArticle[this.GetWordTypeFromGender(this._curGender)];
}

In pseudo language, and due to what returns FrenchTextProcessor._genderToDefiniteArticle[] :

Code:
If ITEM is plural, text2 = "les"
else if next char (first char of ITEM) is vowel, texte2 = "l'"
else if ITEM has a genre (M or F), text2 = "le" (M) ou "la" (F)
else text2 = ""

This is why I understand that an article is send back if ITEM has a genre, and nothing if it has no genre.
But there is mistake in the code: the fact that ITEM begins by a vowel or not must not be on the same level that the fact that it has a genre or not.
The code must FIRST determine if ITEM has a genre, and if yes, only AFTER determine which article must replace the token, because even if ITEM begins by a vowel, we don't put an article before it if it has no genre in Bannerlord point of view (as a town name). The code should be like that:

Code:
If ITEM has a genre (M or F)
    If ITEM is plural, text2 = "les"
    else if next char (first char of ITEM) is vowel, texte2 = "l'"
    else text2 = "le" (M) ou "la" (F)
else text2 = ""

If you change the code as indicated, the "l'" before Onica that has no genre shall not be present anymore, which is correct.

Note:
When this code shall be modified as above, you will discover that the expression {?settlementNeedsArticle(SETTLEMENT)}{.l}{?}{\?}{SETTLEMENT} for the token {.l} becomes useless, because all the castles and the hideouts have a defined genre in Bannerlord files and the towns and villages have not. So a sentence as
id="F8g1TzoX" text="L'empire a assiégé {.l}{SETTLEMENT_NAME}"
will always produce a correct result:
- If SETTLEMENT_NAME is a castle (genre M) -> "L'empire a assiégé le château d'Onica"
- If SETTLEMENT_NAME is a town (no genre) -> "L'empire a assiégé Onica"
No need anymore to use the function settlementNeedsArticle() to know if an article must be added or not, the token {.l} already answered this question!

Thanks for reading.
 
Back
Top Bottom