After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 529057 - distinguish different locations with the same name
distinguish different locations with the same name
Status: RESOLVED FIXED
Product: libgweather
Classification: Core
Component: locations
unspecified
Other Linux
: Normal minor
: 2.22.0
Assigned To: libgweather-maint
libgweather-maint
: 429167 519649 (view as bug list)
Depends on: 458794
Blocks:
 
 
Reported: 2008-04-20 14:58 UTC by Dan Winship
Modified: 2008-11-25 20:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
XSLT transform (1.44 KB, text/plain)
2008-05-14 17:41 UTC, Dan Winship
  Details
patch to generate msgctxts in update-locations.py (204.18 KB, patch)
2008-08-07 13:27 UTC, Dan Winship
committed Details | Review

Description Dan Winship 2008-04-20 14:58:29 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...
Comment 1 Vincent Untz 2008-04-20 15:11:02 UTC
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)
Comment 2 Dan Winship 2008-05-14 17:41:48 UTC
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>
		    ...
Comment 3 Vincent Untz 2008-05-17 13:16:10 UTC
Awesome! I'm not 100% sure about putting all the translations in the translator comment, but except from this, it's just rocking.
Comment 4 Dan Winship 2008-05-18 23:02:55 UTC
(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.)

Comment 5 Dan Winship 2008-06-18 14:53:28 UTC
*** Bug 429167 has been marked as a duplicate of this bug. ***
Comment 6 Dan Winship 2008-06-18 15:25:41 UTC
*** Bug 519649 has been marked as a duplicate of this bug. ***
Comment 7 Dan Winship 2008-08-07 13:27:24 UTC
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.
Comment 8 Dan Winship 2008-11-25 20:40:25 UTC
committed in trunk