GNOME Bugzilla – Bug 651186
More efficient translatable strings
Last modified: 2011-06-25 15:55:03 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.
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.
See also the patches in bug 651483 and bug 652379, which touch similar strings.
The corrected version will be merged as part of my 0.14-localization-issues branch.
Fix committed to master as f47e1891ccf01e205638fcce13ad43beb3526eb5