HomeWildfire Games

Translation fixes.
AuditedrP25332

Description

Translation fixes.

  • Fix in tooltip context for healing 'Health'
  • Fix in tooltip for splash shape.
  • Translate locale_advanced
  • Translate specific name in the structure truee
  • Translate player name in gamesetup.

Patch by: nwtour

Differential Revision: https://code.wildfiregames.com/D3889

Details

Auditors
Stan
Committed
wraitiiApr 28 2021, 10:04 AM
Differential Revision
D3889: Fix some translation
Parents
rP25331: [Windows] Automated build.
Branches
Unknown
Tags
Unknown
Build Status
Buildable 16930
Build 38739: Post-Commit BuildJenkins
Build 38738: Post-Commit Build (macOS)Jenkins

Event Timeline

Stan raised a concern with this commit.May 3 2021, 3:25 PM
Stan added subscribers: wowgetoffyourcellphone, Stan.
/ps/trunk/binaries/data/mods/public/gui/reference/common/TemplateLoader.js
91

This ^

ERROR: JavaScript error: gui/reference/common/TemplateLoader.js line 91 
0 is read-only
 loadTechnologyTemplate@gui/reference/common/TemplateLoader.js:91:30
 findAllAutoResearchedTechs@gui/reference/common/TemplateLoader.js:197:20
 TemplateLoader@gui/reference/common/TemplateLoader.js:18:36 ReferencePage@gui/reference/common/ReferencePage.js:10:25 StructreePage@gui/reference/structree/StructreePage.js:10:3
 init@gui/reference/structree/structree.js:8:11 onPress@gui/pregame/MainMenuItems.js:35:13 
performButtonAction@gui/pregame/MainMenuItemHandler.js:77:9 pressButton@gui/pregame/MainMenuItemHandler.js:63:10
This commit now has outstanding concerns.May 3 2021, 3:25 PM
nwtour added a subscriber: nwtour.EditedMay 3 2021, 4:00 PM

Looked at a similar check in TemplateParser.js
This code should solve the error

--- a/binaries/data/mods/public/gui/reference/common/TemplateLoader.js
+++ b/binaries/data/mods/public/gui/reference/common/TemplateLoader.js
@@ -88,7 +88,8 @@ class TemplateLoader
 
                        // Translate specificName as in GetTechnologyData() from gui/session/session.js
                        for (let civ in data.specificName)
-                               data.specificName[civ] = translate(data.specificName[civ]);
+                               if (data.specificName[civ)
+                                       data.specificName[civ] = translate(data.specificName[civ]);
 
                        this.technologyData[templateName] = data;
                }

Upload it as a separate patch?

Stan added a comment.May 3 2021, 4:01 PM

You could make another diff :)
Would that translate the specific name though in the above files?

nwtour added a comment.May 3 2021, 4:11 PM
In rP25332#51242, @Stan wrote:

You could make another diff :)

Ok

Would that translate the specific name though in the above files?

No. There is a separate block of code for translating "SpecificName" as simple string:

TemplateLoader.prototype.TechnologyTranslateKeys = ["genericName", "tooltip", "description"];
...
translateObjectKeys(data, this.TechnologyTranslateKeys);

If this functionality is needed, I can test it at the same time

Stan added a comment.May 3 2021, 4:17 PM

If this functionality is needed, I can test it at the same time

As noted on IRC today, the example json are incorrect, however being able to translate normal strings (instead of objects) seems to be nice. So up to you :)

nwtour added a comment.May 3 2021, 5:33 PM
In rP25332#51247, @Stan wrote:

As noted on IRC today, the example json are incorrect, however being able to translate normal strings (instead of objects) seems to be nice.

Now "Plain String" is not displayed at all (Not even translated text, see screenshot in https://code.wildfiregames.com/D3921).

Stan raised a concern with this commit.

Didn't find a button. This has been fixed.

Stan accepted this commit.May 10 2021, 3:26 PM

Indeed. It is now mandatory to use objects.

All concerns with this commit have now been addressed.May 10 2021, 3:26 PM
In rP25332#51518, @Stan wrote:

Indeed. It is now mandatory to use objects.

Or rather "it is now explained that it is mandatory to use objects" ;)