#2257: .po files : same msgid records could be "deduplicated"
-------------------------+--------------------------------------------------
 Reporter:  rejoc        |        Owner:  rejoc   
     Type:  enhancement  |       Status:  new     
 Priority:  normal       |    Milestone:  1.1b4   
Component:  I18n         |      Version:  1.1 HEAD
 Severity:  normal       |   Resolution:          
 Keywords:  i18n         |  
-------------------------+--------------------------------------------------
Comment (by Gustavo):

 rejoc:

 All what you're describing is the intended behavior of Gettext. That's how
 things work on every single Gettext-powered application (this is, nearly
 all the applications you're using). And there's no bug in that behavior.

 If you don't like this behavior and prefer to risk getting side effects in
 the future, then you can write your own script which adapts the PO
 template as you want. But this should ''not'' go in TG by default.

 A long time ago I wrote a bash script to merge duplicate messages in a web
 site, using a very conservative approach: Having one POT per web site
 section and then merging the msgids duplicate in the individual POTs --
 only in the individual POTs. This avoids context problems in different
 languages. I'll search for that old script and if I find it, I'll attach
 it.

 Keep in mind that the Gettext folks are no ignorants. It's a very mature
 piece of software which is used in most free software projects, so
 everything you see is expected. At this point we can hardly find a bug.

 Replying to [comment:2 rejoc]:
 > Well... I could have choose any msgid that gets duplicated...
 >
 > Within a simple .po file, a single msgid, even if it is duplicated, will
 be translated by a single msgstr (seems to be the last non empty msgstr).
 >
 > As you say, the translation of a same message can be translated
 differently and if you don't pay attention, you won't see that the message
 you are currently translating is used somewhere else in the same .po file,
 but with another meaning (very likely to append as your .pot file grows).
 Here, the context is the .po file and there is only one translation.
 >
 > So having the msgids deduplicated (while keeping a trace of its
 different locations) looked like a good way to detect/avoid bad
 translations.
 >
 > And it does not break anything in the logic of collect/add|merge/compile
 process
 >
 >
 > But there is another issue (bug?) :
 >
 > if you have a .po file containing
 > {{{
 > #: demo/templates/master.html:75
 > msgid "some text"
 > msgstr "un petit texte"
 >
 > #: demo/templates/welcome.html:25
 > msgid "some text"
 > msgstr ""
 > }}}
 >
 > it compiles and gives the expected translation of "un petit texte" for
 all the occurrences of "some text".
 >
 > Now you do a "tg-admin i18n merge" (usually after a collect because you
 modified something) and... you get :
 > {{{
 > #: demo/templates/master.html:75
 > msgid "some text"
 > msgstr ""
 >
 > #: demo/templates/welcome.html:25
 > msgid "some text"
 > msgstr ""
 > }}}
 >
 > You lost your translation because merge uses the last msgstr it finds in
 the .po for a given msgid.
 >
 > (I have included a patch for that one... It keeps that last non empty
 message like compile does)

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2257#comment:3>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to