Closed Bug 511367 Opened 15 years ago Closed 15 years ago

Multi-line msgids are not picked up properly

Categories

(addons.mozilla.org Graveyard :: Localization, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: wenzel, Unassigned)

References

Details

When checking the de .po file after the l10n conversion, I found these strings:

4265 #: views/elements/recaptcha.thtml:67
4266 msgid "If this is hard to read, you "
4267 msgstr ""
4268 
4269 #: views/elements/recaptcha.thtml:75
4270 msgid "If this is hard to understand, "
4271 msgstr ""
4272 

These are obviously half sentences, apparently extracted badly by the gettext tools.

The corresponding code looks like this:
 66         <div class="recaptcha_refresh recaptcha_only_if_image">
 67             <?=sprintf(___('If this is hard to read, you '
 68             .'can <a href="%1$s">try different words</a> or <a href="%2$s">listen '
 69             .'to something</a> instead.'), 'javascript:Recaptcha.reload()',
 70             "javascript:Recaptcha.switch_type('audio')")?>
 71         </div>
 72         <?php /* audio captcha text */ ?>
 73         <div class="recaptcha_description recaptcha_only_if_audio"><?=___('Please type what you hear.')?></div>
 74         <div class="recaptcha_refresh recaptcha_only_if_audio">
 75             <?=sprintf(___('If this is hard to understand, '
 76             .'you can <a href="%1$s">listen to something else</a> or <a href="%2$s">'
 77             .'switch back to text</a>.'), 'javascript:Recaptcha.reload()',

This is a problem we are likely to run into a lot in the future: When msgids are long (which they tend to be now that they are plain English) you apparently cannot make them cross multiple lines, or the extraction script won't pick them up properly.
I think we should be able to extend the regexp to catch concatenation (\s+.\s+) between multiple strings.
Sounds like a good idea.
You're talking about patching xgettext?

When I ran across those I just removed the concatenation and re-extracted.  Wenzel, can you do that and update the .po files?
Yes, I'll do that with the code in question here right now...

I checked it into r49515, except for the "uk" locale, whose .po file is broken right now. I am unsure they checked in merge conflicts.

Gandalf: The extract script is just a wrapper for xgettext; I am unsure if we can teach it to accept multi-line strings, except for maybe by pre-processing the input files to get rid of multi-line strings, but that'd screw up line numbers.

http://viewvc.svn.mozilla.org/vc/addons/trunk/site/app/locale/extract-po.sh?view=markup
(In reply to comment #4)
> I am unsure they checked in merge conflicts.

^^^ for extra credit, insert "why" where appropriate.
(In reply to comment #5)
> (In reply to comment #4)
> > I am unsure they checked in merge conflicts.
> 
> ^^^ for extra credit, insert "why" where appropriate.

He's probably using an automated tool or something.  I'll send him a heads up.
(In reply to comment #4)
> Gandalf: The extract script is just a wrapper for xgettext; I am unsure if we
> can teach it to accept multi-line strings, except for maybe by pre-processing
> the input files to get rid of multi-line strings, but that'd screw up line
> numbers.

I think I'm ready to sacrifice the exact line number (which, in the worst case, will be off by 2 lines) for valuable output :)
How about you guys? :)
I don't know why we'd spend time on this.  Just don't send concatenated strings to ___().  It looks like this was brought up on http://www.mail-archive.com/php-i18n@lists.php.net/msg00960.html in 2006 but never went anywhere.
As Fred said, concatenating gives a much nicer source code view. If you don't see it as a reason then we should close this bug as wontfix.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.