In Progress Français The function settlementNeedsArticle() does not always work before a castle

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 septentrional a assiégé Château de Tepes
Corrected Translation: L'empire septentrional a assiégé le Château de Tepes
Where did you find this error (which conversation, screen, area,...)?: Screen
Screenshot:
1646303319044.png

Hi TaleWorlds devs!

I was checking a video played with the official French Translation when I saw the above line.
There is obviously a missing article "le" before "Château". So I searched from where this line comes, and I found it:
id="E20BBKYo" text="{.L}{FACTION_NAME} {?IS_PLURAL(FACTION_NAME)}ont assiégé{?}a assiégé{\?} {TOWN_NAME}."

OK, clear, a "{.l}" is missing before {TOWN_NAME}. I though that it was a good occasion to test the special syntax {?settlementNeedsArticle(SETTLEMENT)}{.xx}{?}{\?}{SETTLEMENT} by replacing SETTLEMENT by the right variable.

To be sure to obtain a castle, I decided to twist the following welcome sentence that we have when arriving to a castle:
id="F8g1TzoX" text="Vous êtes à l'extérieur {.dl}{SETTLEMENT_NAME}. Vous voyez la bannière...

I replaced the beginning of the sentence as follow:
id="F8g1TzoX" text="L'empire a assiégé {?settlementNeedsArticle(SETTLEMENT_NAME)}{.l}{?}{\?}{SETTLEMENT_NAME}.

Unfortunately, this is not working, the "le" is not displayed:
1646303461814.png

Yet, if I put a direct {.l} in the sentence, like hereunder, we obtain the missing article:
id="F8g1TzoX" text="L'empire a assiégé {.l}{SETTLEMENT_NAME}.
1646303514691.png

This example shows that the expression {?settlementNeedsArticle(SETTLEMENT_NAME)}{.l}{?}{\?}{SETTLEMENT_NAME} did not work! It should have generated a {.l} token before the name of the castle, and it was not the case.

Let's look at the definition of the function settlementNeedsArticle() into the file Native/.../FR/fr_function.xml:
<function functionName="settlementNeedsArticle" functionBody="{?$0.IS_CASTLE}1{:???:$0.IS_HIDEOUT}1{:}0{\?}"/>

What I understand from this definition, it's that the function is 1 if IS_CASTLE or IS_HIDEOUT is true, and 0 if both are false. And if the function is 1, the expression {?settlementNeedsArticle(SETTLEMENT)}{.l}{?}{\?} is replaced by {.l}.

Normally this function should be 1 every time the settlement is a castle (or a hideout), but unfortunately the trial I did prove that it is not the case : SETTLEMENT_NAME is Château d'Onica, but the token {.l} is not generated. Which means that the variable IS_CASTLE was not set internally.

Normally the variable IS_CASTLE should be raised automatically every time the settlement is a castle, but obviously it is not the case. I fear that it is raised only for the sentences where the expression settlementNeedsArticle was requested by the translators, and not set in all the other sentences. This is an error, because it prevents us to add such expression in sentences where it was forgotten by the official translators, as in the sentence that I was talking about about at the very beginning of this report.

We cannot either add spontaneously a simple {.l} in this sentence, because, due to the way the token {.l} works, if the TOWN_NAME is a town or a village whose name begins by a vowel, a "l'" shall be added, which produce too an incorrect sentence because in French we don't write an article "le" before a town name. The following line is incorrect:
1646303588571.png

So, to summerize:
- If we add an expression {?settlementNeedsArticle(SETTLEMENT)}{.l}{?}{\?}{SETTLEMENT} before a settlement that is a castle, it doesn't work, there is no "le" before "château".
- But if we add a simple {.l} and the settlement is a town whose name begins by a vowel, the result is not correct either.

Well, we are locked! Please modify your code so that every time a settlement is a castle or a hideout, the related internal variables IS_CASTLE and IS_HIDEOUT are set.

This said, read the other bug report dedicated to the token {.l}, it may help to unlock this situation.

Thanks for reading.
 
Hello @Daneel53!

Firstly, thanks for your dedicated work on the French Localization. I checked the function, and it seems like IS_CASTLE and IS_HIDEOUT variables are set correctly. But there are 2 different bugs that cause this behavior. First one is a low level text processing bug. The second bug is in the function definition. It looks like the settlementNeedsArticle function doesn't consider the attributes' values, but only checks whether they have it or not. This wouldn't have been an issue if, say, IS_CASTLE value was only set for castles. But they are set for villages too with “0” as value.

Anyway, thanks again. I'll fix the issues along with the one you described in here.
 
Thanks, happy if my work can help to fix bugs.
If you have questions related to French grammary and tokens, you may always contact me through PM. :xf-smile:
 
Back
Top Bottom