Resolved Français Bug for the first token of a sentence

Users who are viewing this thread

Version number
e1.7.0
Branch
Main
Modded/unmodded
No, I didn't use any mods.

Daneel53

Sergeant Knight at Arms
WBVC
Translation Error: Les terres autour des Etirfurd
Corrected Translation: Les terres autour d'Etirfurd
Where did you find this error (which conversation, screen, area,...)?: When arriving to the village Etirfurd
Screenshot: TaleWorlds.MountAndBlade.Launcher_2022-02-16_22-53-48.png

Hello dev team!
When arriving to the village of Etirfurd, I had the above welcome sentence.
This sentence comes from this line of std_TaleWorlds_CampaignSystem-fre.xml (SandBox):

id="RVDojUOM" text="Les terres autour {.dl}{SETTLEMENT_LINK} sont possédées pour la plupart par {.l}{LORD.LINK}, {FACTION_OFFICIAL} {.dl}{FACTION_TERM}.

The article "des" that is before Etirfurd is dedicated to plural names and Etirfurd has no genre and is singular, so there is obviously a mistake here.

I've taken the time to debug with dnSpy the code of the routine ProcessToken() that is into the class FrenchTextProcessor, and I discovered that the mistake comes from the function ProcessLink().

Roughly, the code of ProcessLink() is this one:

Code:
    if (this._wordGroups.TryGetValue(key, out valueTuple))
    {
        this.SetGenderInfo(valueTuple.Item1);
        if (valueTuple.Item3)
        {
            this.SetPlural();
        }
    }
    ...
    return;

Knowing that "key" contain the word that follows {.dl}, this code has two drawbacks: if the word does not exist in the dictionary _wordGroups (i.e. has no genre), the routine does nothing, and if the word is into the dictionary, if it is not plural nothing is done, the variable _isPlural is not set to false by using SetSingular().

As you know, the complete sentence is scanned two times: the first time to evaluate the links (SETTLEMENT_LINK, LORD.LINK and FACTION_TERM into this sentence), and a second time to evaluate the tokens. What happens is that the first scan finishes with the evaluation of FACTION_TERM that here is M and P (id="8HMyTKF6" text="{.M}{.P}Vlandais"), which means that _isPlural is set to true. Then the second scan evaluates the token {.dl} that is before SETTLEMENT_LINK (Etirfurd), ProcessLink() is called again, Etirfurd having no genre is not present into _wordGroups, so ProcessLink() does nothing, so _isPlural stays to true... and the routine HandleDePrepositionFollowedByDefiniteArticle() that evaluates the token {.dl} calls GetDefiniteArticle() that finds that _isPlural is true and sends back an article dedicated to plural: "des". Bingo!

The issue will not exist for the other tokens into the sentence because ProcessToken() reset _isPLural to false and _curGender to NoDeclination before exit, but when ProcessToken() is called for the first token, both parameters were not reset and still contain the values of the last evaluated link.

One solution is to reset both parameters into ProcessLink() before searching into _wordGroups:

Code:
    this._curGender = FrenchTextProcessor.WordGenderEnum.NoDeclination;
    this._isPlural = false;
    if (this._wordGroups.TryGetValue(key, out valueTuple))
    {
        this.SetGenderInfo(valueTuple.Item1);
        if (valueTuple.Item3)
        {
            this.SetPlural();
        }
    }

I've tried this code and it works, Etirfurd is not considered anymore as plural:

TaleWorlds.MountAndBlade.Launcher_2022-02-17_12-02-37.png

So please dear developers, modify your code to ensure that when the first token of a sentence is evaluated, both _isPlural and _curGender variables have been reset to their default values, false and noDeclination.

Note for French readers: I know that the article "de l'" before Etirfurd is not yet the good one, in French it should be written "d'Etirfurd". But this is due to the use by the translators of the token {.dl} when they should have use the token {.d}. If the translation use {.d} instead of {.dl}, the result is this one that is correct :
TaleWorlds.MountAndBlade.Launcher_2022-02-17_14-04-23.png

There are many mistakes in the use of the tokens into the official French translation, which cause many articles to be erroneous in French. This will be the subject of another bug report dedicated to this specific issue. But the present bug needs to be fixed anyway.
 
Last edited:

MArdA TaleWorlds

Community Support & Localization
Community Support
M&BWBWF&SNWVC
Forwarded to the QA team for further investigation. We will reach out again if we need more information. Thanks for reporting and sorry for any inconvenience!
 

beybi123

Developer
Hey, thanks for the detailed analysis. We will be fixing this issue and the one from your other post as soon as possible.
 

Daneel53

Sergeant Knight at Arms
WBVC
Fine. To fix these two code bugs opens the door toward the next topics related to the use of tokens in French. :xf-smile:

Note : To fix this bug will answer to the first part of this issue that I've send two months ago:

If you fix this bug, the "le" before Poros shall disappear. But you still have to replace "gouverné" by "gouvernée" in IDs q3wD0rbq and UWzQsHA2 of sandBox/.../std_TaleWorlds_CampaignSystem-fre.xml :xf-wink:
 

MArdA TaleWorlds

Community Support & Localization
Community Support
M&BWBWF&SNWVC
I've been informed that this bug is fixed and the fix will be sent to the game with future patches. Thanks for reporting and sorry for any inconvenience!
 
Top Bottom