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 651186 - More efficient translatable strings
More efficient translatable strings
Status: RESOLVED FIXED
Product: pitivi
Classification: Other
Component: General
Git
Other Linux
: Normal normal
: 0.14.1
Assigned To: Jean-François Fortin Tam
Pitivi maintainers
Depends on:
Blocks:
 
 
Reported: 2011-05-26 19:57 UTC by Claude Paroz
Modified: 2011-06-25 15:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
More efficient translatable strings (3.56 KB, patch)
2011-05-26 19:57 UTC, Claude Paroz
needs-work Details | Review

Description Claude Paroz 2011-05-26 19:57:29 UTC
Created attachment 188702 [details] [review]
More efficient translatable strings

Hereby patch is removing some markup in translatable strings (good practice), and factorizing some other strings: translator should only translate once "%d fps" instead of "12 fps", "15 fps", etc.
Comment 1 Alex Băluț 2011-05-27 21:25:55 UTC
Review of attachment 188702 [details] [review]:

Thanks for the patch.

+    # Translators: fps is frame per second
>> I have the impression there is some standard way to add descriptions for the _() messages, for translators. I'm not sure how, though. Maybe like this (notice the dot): #. fps is frame per second

+    (_("%s fps") % "23,976", gst.Fraction(24000.0, 1001.0)),
>> This is still not good, since in some locales it should be "23.976". Maybe use a "%.3f fps" template?

+    (_("%d KHz") % 8,   8000),
>> This looks ugly:
[(((rate % 1000 / 100) and "%.1f KHz" or "%d KHz") % (rate / 1000.0), rate)
 for rate in (8000, 11025, 22050, 44100, 48000, 96000)]
>> Maybe this looks better:
def _format_audio_rate(audio_rate):
    if audio_rate % 1000 / 100:
        return _("%.1f KHz") % (rate / 1000.0)
    else:
        return _("%d KHz") % (rate / 1000.0)
audio_rates = model((str, int), (
        _format_audio_rate(audio_rate)
        for audio_rate in (8000, 11025, 22050, 44100, 48000, 96000)))

+    (_("%d bit") % 8,  8),
>> This one should be a single line:
[(_("%d bit") % (bits * 8), bits) for bits in range(1, 5)]

-        return _("<b>Audio:</b>")
+        return "<b>%s</b>" % _("Audio:")
>> Better assign _("Audio:") to a variable, instead of returning it right away, and then at the end of the function return "<b>%s</b>" % track_name.

Should be good once the _("%s fps") % "23,976" is changed to "%.3f fps" and the other two are changed to "%.2f fps". Thanks.
Comment 2 Jean-François Fortin Tam 2011-06-12 21:29:13 UTC
See also the patches in bug 651483 and bug 652379, which touch similar strings.
Comment 3 Jean-François Fortin Tam 2011-06-21 22:35:25 UTC
The corrected version will be merged as part of my 0.14-localization-issues branch.
Comment 4 Jean-François Fortin Tam 2011-06-25 15:55:03 UTC
Fix committed to master as f47e1891ccf01e205638fcce13ad43beb3526eb5