Page MenuHomeWildfire Games

Mark tribute messages for plural translation
AbandonedPublic

Authored by Gallaecio on Jan 28 2018, 10:20 AM.

Details

Reviewers
Itms
leper
mimo
elexis
Trac Tickets
#4597
Summary

Petra may send messages regarding tribute amounts. While in English it is not necessary to use plural in those strings, in some languages it is.

The issue has been reported at Transifex by GunChleoc: https://www.transifex.com/wildfire-games/0ad/translate/#/$/105312248?issue=yes
It affects some other strings which have also been reported.
And there is a trac ticket: https://trac.wildfiregames.com/ticket/4597

Test Plan

I verified that there is no syntax error in the affected file, but I have not tested the change yet, as I have no idea how to get the messages to show up in-game.

Diff Detail

Event Timeline

Gallaecio created this revision.Jan 28 2018, 10:20 AM
Vulcan added a subscriber: Vulcan.Jan 28 2018, 11:22 AM

Successful build - Chance fights ever on the side of the prudent.

Updating workspaces...
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (309 tests).....................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (309 tests).....................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...
Executing section Default...
Executing section Source...
Executing section JS...

We have an internationalization ticket on trac that is also about plural strings for simulation-sent GUI chat notifications.
This ticket was never resolved because I believe in order to do it properly, one would have to not pick a string in the simulation and send that but send the entire object and let the GUI pick the string.
If we use markPlural in the sim we ought to use translatePlural in the GUI.
If it happens to work that we can call translate() on one of the strings that were marked by markForPluralTranslation, then that sounds rather coincidental.
Looking at the C++ code, translatePlural ends up using the internationalization library we have dictionary->translate_plural(singularSourceString, pluralSourceString, number);.

I assume one should be able to test the patch by running an AI 4v4 100pop match with very few res, change the gamespeed to 20x and change perspective to one player or be one player.

Side node, aichat should become translated-chat or simulation-chat as it is also used by non-AI simulation components.

The cleaner approach to fix this thing and the mentioned ticket would be to implement translated-chat-plural.

binaries/data/mods/public/simulation/ai/petra/chatHelper.js
227

(Seems nicer to define an own variable with let)

I found the #4597 ticket by chance in one of the Transifex reports, it was not my intention to fix it, I just thought I had fixed it with these changes.

Should I fix the inline comment and propose this change as a fix that solves the issues reported by translators but does not fix the ticket?

Does passing markForPluralTranslation actually work? If not, then not.
I suspect we just want to add few GUI code and fix it well.

I am having trouble verifying that it works, as I am not familiar with Petra. Originally, I tried to ask for an alliance to all 7 players in a game, hoping that at least one would ask for tributes, but n luck. Now I have edited handleDiplomacyRequest(), commenting out part of its content to force the last case of the if/else statement to occur, but I still could not get an AI player to request tributes. I will have to look deeper into the Petra AI code to try and get the AI to send one of those plural messages.

@mimo got a hack to trigger the chat messages?

See D1382 for a way to display all AI messages.

Gallaecio abandoned this revision.May 26 2018, 7:31 PM

I’ve lost interest in working on this for the time being. I will look into internalization issues that are easier to fix.