GNOME Bugzilla – Bug 529057
distinguish different locations with the same name
Last modified: 2008-11-25 20:40:25 UTC
Right now, Locations.xml has no way of distinguishing multiple cities with the same name. Eg, es.po currently translates London, Ontario, Canada as "Londres" and Rome, Oregon, USA as "Roma", which I believe are both incorrect. One way to fix this would be to generate the .po files with automatically-generated msgctxts replacing the current somewhat-manually-generated comments, so that instead of: #. Translators: This is in Rome, Oregon in the United States. #: ../data/Locations.xml.in.h:5680 msgid "Rome" msgstr "Roma" we'd have #: ../data/Locations.xml.in.h:5680 msgctxt "United States/Oregon" msgid "Rome" msgstr "Rome" #: ../data/Locations.xml.in.h:NNNN msgctxt "Italy" msgid "Rome" msgstr "Roma" On a related topic, there doesn't actually appear to be any way to regenerate the po-locations files at all currently...
If you can find a good way to generate the context from the XML file, go ahead :-) Else, the current plan was to go the old and ugly way (ie "Italy|Rome"). (I was hit by this problem when reworking the french translation a few days ago)
Created attachment 110913 [details] XSLT transform Bug 458794 discusses adding msgctxt support to intltool. The patch there would let us do: <_name msgctxt="Italy">Rome</_name> The attached XSLT transform autogenerates message contexts from the XML structure, and also adds another feature to autogenerate comments about native names of cities. Eg, given as input: <gweather> <region> <_name>Europe</_name> <country> <_name>Belgium</_name> <state> <_name>Liege</_name> <name xml:lang="fr">Liège</name> <name xml:lang="fr_BE">Lîdje</name> <name xml:lang="nl">Luik</name> <name xml:lang="de">Lüttich</name> <location> <_name>Elsenborn</_name> ... it will output: <gweather> <region> <_name>Europe</_name> <country> <_name>Belgium</_name> <state> <!-- Translators: Liege is the anglicized name. The local name in 'fr' is Liège. The local name in 'fr_BE' is Lîdje. The local name in 'nl' is Luik. The local name in 'de' is Lüttich. --> <_name msgctxt="Belgium">Liege</_name> <location> <_name msgctxt="Liege, Belgium">Elsenborn</_name> ...
Awesome! I'm not 100% sure about putting all the translations in the translator comment, but except from this, it's just rocking.
(In reply to comment #3) > Awesome! I'm not 100% sure about putting all the translations in the translator > comment, but except from this, it's just rocking. Sorry, that's "all the translations from the *source* file", not "all the translations from the *output* file". ie, currently people are writing those sorts of comments by hand: <!-- Translators: This is a state in Belgium. local name (fr): Liège. local name (fr_BE): Lîdje. local name (nl): Luik. local name (de): Lüttich. --> <_name>Liège</_name> ... <!-- Translators: This is in Sweden. The native name is "Göteborg". Please use that unless you are sure that it has a different name in your language. --> <_name>Gothenburg</_name> ... <!-- Translators: The native name is "Danmark" - many contries have their own transcription though, because the country is a very old kingdom. --> <_name>Denmark</_name> etc, and I was just suggesting that we could have them just write out <name xml:lang="...">...</name> nodes in the Locations.xml.in file instead, and then autogenerate a comment in a consistent style from that. (So that between the autogenerated msgctxts and the autogenerated native-name comments, this should get rid of any need for people to manually write out comments with hints to the translations.)
*** Bug 429167 has been marked as a duplicate of this bug. ***
*** Bug 519649 has been marked as a duplicate of this bug. ***
Created attachment 116065 [details] [review] patch to generate msgctxts in update-locations.py Currently there are 242 strings with at least one duplicate, of which 53 have more than one. The winner is "Springfield", at 7, although they're all cities in the US, so it seems unlikely that anyone would need separate translations for any of them... Though Washington, DC and Washington, Iowa might need different translations? Not for 2.24 due to incomplete msgctxt support in translator tools.
committed in trunk