GNOME Bugzilla – Bug 682275
Do not split strings that need to be translated
Last modified: 2012-09-02 04:13:13 UTC
On [1] there is this snippet of code: visible_option.set_tooltip_markup(_("<b>Enable or disable this layer</b>\n" + "Disabled layers will not play nor render.")) Unfortunately gettext does get it wrong and the pot file generated [2] the string available to translate is: #: ../pitivi/timeline/layer.py:107 msgid "<b>Enable or disable this layer</b>\n" msgstr "" Which, as you can see, is missing half of the string. Could be possible to do something like tmp_string = _("<b>Enable or disable this layer</b>\nDisabled layers will not play nor render.") visible_option.set_tooltip_markup(tmp_string) I know it breaks your beautiful 80 characters limit (which I do care when I program too). But I would say that having half of the string translated on the UI could be fare shameful than having a +80 characters on a single line. I haven't checked if there is any other string like that, I just stumbled upon this one, I leave up to you, the awesome PiTiVi developers, to do the grep magic ;) Thanks for this amazing video editor!! [1] http://git.gnome.org/browse/pitivi/tree/pitivi/timeline/layer.py#n107 [2] http://l10n.gnome.org/POT/pitivi.master/pitivi.master.pot
Oh, I wrongly assumed that gettext didn't barf up on this... Guess we'll need to write a rule/guideline for this somewhere, maybe in docs/HACKING. Do you think a naïve: git grep "_(" | grep "+" ...would find all of them?
(In reply to comment #1) > Oh, I wrongly assumed that gettext didn't barf up on this... Guess we'll need > to write a rule/guideline for this somewhere, maybe in docs/HACKING. > > Do you think a naïve: > > git grep "_(" | grep "+" > > ...would find all of them? I would guess so... :)
Actually, this is a bit confusing. I've seen this in the code, which works as far as I know? self._info_bar = self.clip_properties.addInfoBar( _("Select a clip on the timeline " "to configure its associated effects"))
Not confusing but subtle! Your string is: _("Select a clip on the timeline " "to configure its associated effects")) And the one I reported is: _("<b>Enable or disable this layer</b>\n" + "Disabled layers will not play nor render.")) Notice the difference? Right! the "+" between the two strings on the "bad" one :) So, Python by itself already joins two strings like "this" "and" "this". And gettext seems to be able to get that too, but if you add an explicit "+" sign between the strings then gettext get lost in translation (bad joke I know). Just tried locally (remove the "+" sign and run intltool-update -p within the po folder) and it does work, the pitivi.pot file shows the whole string. Lesson learned: Python allows you to type less :)
commit 97eee97b68c95556f1385511a1c5770e43d50c82 Author: Paul Lange <palango@gmx.de> Date: Sun Aug 26 17:03:59 2012 +0200 layer: Do not use explicit concatenation for translatable tooltips Fixes bug #682275