Page MenuHomeWildfire Games

Translation improvements.
AbandonedPublic

Authored by Freagarach on Jan 28 2021, 9:12 AM.

Details

Reviewers
Gallaecio
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

Most of the time, translators don't want specific names to be translated, but, at most, transcribed.
This adds context to specific names, because that is not clear from within Transifex.

Test Plan

Agree.

Event Timeline

Freagarach created this revision.Jan 28 2021, 9:12 AM
Owners added a subscriber: Restricted Owners Package.Jan 28 2021, 9:12 AM

Build is green

builderr-debug-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblobby_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libengine_dbg.a(precompiled.o) has no symbols
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedba

See https://jenkins.wildfiregames.com/job/macos-differential/3100/display/redirect for more details.

Freagarach requested review of this revision.Jan 28 2021, 9:22 AM
wraitii accepted this revision.Jan 28 2021, 9:26 AM
wraitii added a subscriber: wraitii.

Seems like a good idea.

This revision is now accepted and ready to land.Jan 28 2021, 9:26 AM
Stan added a subscriber: Stan.Jan 28 2021, 9:41 AM

Can we add more context that this? E.g. “The entity's specific name. It should usually not be translated unless you're using a different alphabet” or something?

As @Stan already pointed out, just “specific name” is not really that clear for translators.
Also, would it be possible to have custom contexts, e.g.

<SpecificName context="ὁπλοθήκη">Hoplothēkē</SpecificName>

And would adding a context cause all these strings to be retranslated?

Furthermore, it seems transifex groups strings by file location, e.g.

  • simulation/templates/structures/ → “Buildings”
  • simulation/templates/units/ → “Units”
  • simulation/templates/ → “Misc. Templates”

While this may make sense for people familiar with the 0 A.D. public folder, it's less obviously beneficial for translators. I suppose it's not possible to have a transifex group for all specific names and another for all other strings from all simulation templates?

binaries/data/mods/public/maps/random/ardennes_forest.json
5

This should be done, but as a consequence the entire string will have to be retranslated, therefore postpone it to A25.

Stan added a comment.EditedJan 28 2021, 12:42 PM

It seems changing context breaks translations but not directly see r24420.

It did take a long time to get there though
rP24350 was the commit.
rP24370 was the pot change and fr.public-templates-units.po was changed but translation was not invalidated
rP24420 was the actual change in translation for fr.public-templates-units.po
rP24760 was when I translated it myself.

Also, would it be possible to have custom contexts, e.g.

<SpecificName context="ὁπλοθήκη">Hoplothēkē</SpecificName>

I think having greek in the context would make things worse? Not all translators can read that.

Furthermore, it seems transifex groups strings by file location, e.g.

  • simulation/templates/structures/ → “Buildings”
  • simulation/templates/units/ → “Units”
  • simulation/templates/ → “Misc. Templates”

While this may make sense for people familiar with the 0 A.D. public folder, it's less obviously beneficial for translators. I suppose it's not possible to have a transifex group for all specific names and another for all other strings from all simulation templates?

I don't think it's possible no, since it's only one line in all the files. If specific names were elsewhere, maybe.

And would adding a context cause all these strings to be retranslated?

Yes, context and "ID string" are both used to determine a translation.

  • simulation/templates/structures/ → “Buildings”
  • simulation/templates/units/ → “Units”
  • simulation/templates/ → “Misc. Templates”

This is defined in i10n/messages.json

rP24350 was the commit.
rP24370 was the pot change and fr.public-templates-units.po was changed but translation was not invalidated
rP24420 was the actual change in translation for fr.public-templates-units.po
rP24760 was when I translated it myself.

Quite expected. First you committed. Then i18n scripts ran, updated the "PO template" (aka .pot). That immediately invalidated the translations on transfix, but the .po files got picked up only on the next run (presumably because transifex isn't real-time). Then you translated it and the translation for picked up in the .po file.

I think having greek in the context would make things worse? Not all translators can read that.

It makes it clear it's not an English word and does explain why it's written the way it is.

I don't think it's possible no, since it's only one line in all the files. If specific names were elsewhere, maybe.

This is defined in i10n/messages.json

Looking at the file, I think it's not only possible, but also not too difficult to do, actually.

binaries/data/mods/public/maps/random/ardennes_forest.json
5

Included in D3493.

This patch was indeed meant for A25.

Looking at the file, I think it's not only possible, but also not too difficult to do, actually.

Looking forward to your diff ;)

It makes it clear it's not an English word and does explain why it's written the way it is.

Nah, not sure it is an improvement indeed. Any suggestion for the context string?

Nescio added a subscriber: bb.Jan 28 2021, 6:22 PM

Looking forward to your diff ;)

It would conflict with this one, though.

Nah, not sure it is an improvement indeed.

While 0 A.D. uses American English by default and transliterates κ as k, χ as ch, and ξ as x, another language might want to use kh for χ and ks for ξ. And it's even less straightforward if the localization language doesn't use the Latin alphabet. Having the original Greek spelling could really help. That's also why it's already included in the “Rhomphaia” attack name context (see D2995/rP24209 by @bb).

Point taken, although it is not nice that it can have merely one context, such that every specific name then ought to have the whole string about not translating, right?

Well, I was thinking something along the lines of e.g. context="Transliteration of Ancient Greek Θεμιστοκλῆς" for hero_themistocles.xml or context="Transliteration of Meroitic" for hero_amanirenas.xml.

Just a note on the purpose of context: the context feature of PO files is meant as an ID to allow translators to translate differently 2 strings that are the same in English. For example, the word “Build” could be used in English as a noun (a build of something) or a verb (to build something); adding verb or noun as context allows translators to use the proper word in their language for each case, as chances are the word is not the same in their language in each scenario.

If the purpose is to give background to translators to understand what they are translating and have better “context” to translate correctly, the PO feature to use is “extracted comments”, which should appear in PO files prefixed with #. before each msgid. See https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files

@Gallaecio, thank you for the clarification.
D2995/rP24209 introduced translatable attack names and added context to them, e.g. distinguishing “Sword” (a single-edged weapon) used by e.g. Athenian cavalry from “Sword” (a double-edged weapon) used by e.g. Briton cavalry. For the non-swordsman attack name strings the context is indeed more of giving translators a better understanding of what it is they're translating.
How to use the “extracted comments” feature in XML? And in JSON?

How to use the “extracted comments” feature in XML? And in JSON?

Looking at https://code.wildfiregames.com/source/0ad/browse/ps/trunk/source/tools/i18n/extractors/extractors.py :

  • JSON: Use the comments extraction option in the extraction configuration file to define a JSON key from which to extract translator comments. You could create a key (e.g. _translatorComment, _l10nComment, _i18nComment; I’m suggesting a _prefix to differentiate it from keywords used by the game, but maybe that’s not necessary) in the corresponding files and configure it to be extracted.
  • XML: comment XML attribute
Freagarach planned changes to this revision.Feb 3 2021, 9:01 AM
Freagarach abandoned this revision.Apr 3 2022, 7:42 PM