Opened 17 months ago
Closed 15 months ago
#6648 closed defect (fixed)
%(resource)s are not translated in AI private messages
Reported by: | Gurken Khan | Owned by: | Freagarach |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 27 |
Component: | Internationalization & Localization | Keywords: | translation UI resources |
Cc: | Gurken, Khan | Patch: | Phab:D4897 |
Description (last modified by )
When AIs make demands in private messages the resources are not translated but use the English terms like "food".
PetraAI bot doesn't recognize defeat of competitor, it's trading with (11/Oct/22)
possible solution ?
-
binaries/data/mods/public/simulation/ai/petra/chatHelper.js
a b PETRA.chatAnswerRequestDiplomacy = function(gameState, player, requestType, resp 225 225 "message": "/msg " + gameState.sharedScript.playersData[player].name + " " + 226 226 pickRandom(this.answerDiplomacyRequestMessages[requestType][response]), 227 227 "translateMessage": true, 228 "translateParameters": requiredTribute ? ["_amount_", "_resource_", "_player_"] : ["_player_"],228 "translateParameters": { "_resource_": "withinSentence" } , 229 229 "parameters": requiredTribute ? 230 { "_amount_": requiredTribute.wanted, "_resource_": requiredTribute.type, "_player_": player } :230 { "_amount_": requiredTribute.wanted, "_resource_": Resources.GetNames()[requiredTribute.type], "_player_": player } : 231 231 { "_player_": player } 232 232 }); 233 233 };
- the
Resources.GetNames()[requiredTribute.type]
transformswood
intoWood
- the
{ "_resource_": "withinSentence" }
for finding the correctly translated word with the translateObjectKeys function inChatMessageFormatPlayer.js
.
Line | |
---|---|
7285 | #. Translation: Word as used at the beginning of a sentence or as a single- |
7286 | #. word sentence. |
7287 | #: simulation/data/resources/wood.jsonname |
7288 | msgctxt "firstWord" |
7289 | msgid "Wood" |
7290 | msgstr "Hout" |
7291 | |
7292 | #. Translation: Word as used in the middle of a sentence (which may require |
7293 | #. using lowercase |
7294 | #. for your language). |
7295 | #: simulation/data/resources/wood.jsonname |
7296 | msgctxt "withinSentence" |
7297 | msgid "Wood" |
7298 | msgstr "Hout" |
7299 | |
7300 | #. Translation: Word as used at the beginning of a sentence or as a single- |
7301 | #. word sentence. |
7302 | #: simulation/data/resources/wood.jsonsubtypes.tree |
7303 | msgctxt "firstWord" |
7304 | msgid "Tree" |
7305 | msgstr "Boom" |
note
the missing space in the dutch text, which can be seen in the image above, is a problem of the translator and is not caused by this patch
l10n/nl.public-simulation-other.po
Line | |
---|---|
245 | #: simulation/ai/petra/chatHelper.js:81 |
246 | #, javascript-format |
247 | msgid "" |
248 | "%(_player_)s, you must send me a tribute of %(_amount_)s %(_resource_)s " |
249 | "before I accept an alliance with you." |
250 | msgstr "%(_player_)s, u moet eerst %(_amount_)s%(_resource_)s als geschenk sturen voordat ik een bondgenootschap met u accepteer." |
Attachments (1)
Change History (5)
comment:1 by , 17 months ago
Component: | UI – In-game → Internationalization & Localization |
---|
comment:2 by , 15 months ago
Description: | modified (diff) |
---|
by , 15 months ago
Attachment: | old_new.png added |
---|
comment:3 by , 15 months ago
Owner: | set to |
---|---|
Patch: | → Phab:D4897 |
Note:
See TracTickets
for help on using tickets.
possible solution