- Edited
From Godot's Help:
If you're using plain English as source strings (rather than message codes LIKE_THIS), you may run into ambiguities when you have to translate the same English string to different strings in certain target languages. You can optionally specify a translation context to resolve this ambiguity and allow target languages to use different strings, even though the source string is identical…
It happens to be the case on the project I'm working on. The incantation to do this is:
# "Close", as in an action (to close something).
button.set_text(tr("Close", "Actions"))
# "Close", as in a distance (opposite of "far").
distance_label.set_text(tr("Close", "Distance"))
So in this case "Actions" and "Distance" are meant to help with context. But Help does not say a word about how is this "context" used, like are there some csv files named "Actions" and "Distance"? How are these files used and what would be in them? Also it seems no one ever used these, all localization tutorials I saw (been researching this from yesterday morning) just skip this part.
Or is this meant to be more like "context for the translator"? I tried typing in everything from path names to node names to resources to random nonsense but… just nothing happens no matter what I type. No errors, no effect on in game translation, nothing. Has anyone used these?
Edit: found it mentioned in an old proposal for Godot 3, the description sounds just about like what I'm dealing with, after which the reply with advised solution is simply
support for translation contexts was implemented in 4.0
…and that's it! Not a word about what is it. Here is the link:
github post