Not every string is translatable, and some translatable strings require some extra information to make any damn sense to the translators. gettext is configured to include any comment that begins with TRANSLATORS: in the .pot file, so use that.
In the bug fixed in patch #2 (854226), the translator is actually asking for gettext context strings, claiming that 'c' is being used as an input string for both "close" and "continue". It doesn't look like that's actually the case, or isn't anymore, but either way python still doesn't have pgettext support, so I just added some comments instead so that whoever gets asked to translate "c" gets a hint as to what that actually means.
There is very likely more problems than just these.
intltool-extract adds "no-c-format" to every format string that it extracts. We don't want that. This behavior is not configurable because intltool is kind of a piece of garbage. --- po/Rules-extract | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/po/Rules-extract b/po/Rules-extract index 506d6f3..f232500 100644 --- a/po/Rules-extract +++ b/po/Rules-extract @@ -7,19 +7,27 @@ # input file. --local will output files in a tmp/ directory relative to the # current working directory. # +# intltool-extract adds "no-c-format" to any lines it finds containing format +# specifiers, which disables the xgettext warnings on format errors. Assume +# instead that anything in a glade file is going to be used as a python format +# string so that our gettext tests work. +# # All output files need to be in $srcdir for gettext to be able to find them.
%.glade.h: %.glade @intltool-extract -q --type=gettext/glade -l $< && \ - mv tmp/$$(basename $@) $@ + sed 's/no-c-format/python-format/' < tmp/$$(basename $@) > $@ && \ + rm -f tmp/$$(basename $@)
%.desktop.in.h: %.desktop.in @intltool-extract -q --type=gettext/keys -l $< && \ - mv tmp/$$(basename $@) $@ + sed 's/no-c-format/python-format/' < tmp/$$(basename $@) > $@ && \ + rm -f tmp/$$(basename $@)
%liveinst.h: %liveinst @intltool-extract -q --type=gettext/quoted -l $< && \ - mv tmp/$$(basename $@) $@ + sed 's/no-c-format/python-format/' < tmp/$$(basename $@) > $@ && \ + rm -f tmp/$$(basename $@)
# Remove the $top_srcdir prefix from files so that xgettext can search for the file # relative to $top_srcdir and get the path name right in the .po
We'll have to watch for other single character inputs that might abbreviate a different word, but for now trying to get gettext context support into anaconda would be overkill. --- pyanaconda/ui/tui/hubs/__init__.py | 1 + pyanaconda/ui/tui/simpleline/base.py | 3 +++ 2 files changed, 4 insertions(+)
diff --git a/pyanaconda/ui/tui/hubs/__init__.py b/pyanaconda/ui/tui/hubs/__init__.py index 14e6957..5476806 100644 --- a/pyanaconda/ui/tui/hubs/__init__.py +++ b/pyanaconda/ui/tui/hubs/__init__.py @@ -105,6 +105,7 @@ class TUIHub(TUIObject, common.Hub): except (ValueError, KeyError): # If we get a continue, check for unfinished spokes. If unfinished # don't continue + # TRANSLATORS: 'c' to continue if key == _('c'): for spoke in self._spokes.values(): if not spoke.completed and spoke.mandatory: diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py index 8b6d200..ab4f52f 100644 --- a/pyanaconda/ui/tui/simpleline/base.py +++ b/pyanaconda/ui/tui/simpleline/base.py @@ -449,16 +449,19 @@ class App(object): return False
# global refresh command + # TRANSLATORS: 'r' to refresh if self._screens and (key == _('r')): self._do_redraw() return True
# global close command + # TRANSLATORS: 'c' to continue if self._screens and (key == _('c')): self.close_screen() return True
# global quit command + # TRANSLATORS: 'q' to quit elif self._screens and (key == _('q')): if self.quit_question: d = self.quit_question(self, _(self.quit_message))
1) This constant is not used anymore 2) Building a sentence by concatenating translated fragments is a terrible idea --- pyanaconda/constants.py | 12 ------------ 1 file changed, 12 deletions(-)
diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py index 6ef6948..55fe440 100644 --- a/pyanaconda/constants.py +++ b/pyanaconda/constants.py @@ -43,18 +43,6 @@ shortProductName = productName.lower() if productName.count(" "): shortProductName = ''.join(s[0] for s in shortProductName.split())
-exceptionText = _("An unhandled exception has occurred. This " - "is most likely a bug. Please save a copy of " - "the detailed exception and file a bug report") -if not bugzillaUrl: - # this string will be combined with "An unhandled exception"... - # the leading space is not a typo. - exceptionText += _(" with the provider of this software.") -else: - # this string will be combined with "An unhandled exception"... - # the leading space is not a typo. - exceptionText += _(" against anaconda at %s") %(bugzillaUrl,) - # DriverDisc Paths DD_ALL = "/tmp/DD" DD_FIRMWARE = "/tmp/DD/lib/firmware"
- URL schemes are not translatable - In the datetime_spoke, remove the translatable flag from numbers and spaces, and added a translator comment for the HH:MM separator - For the add/remove/refresh ToolButtons in custom and source, the button labels aren't normally displayed, but attempting to translate Glade IDs is kind of weird so replaced the labels with more helpful labels. - Removed format strings from resize.glade since resize.py has its own versions of them. Left untranslated strings in the glade file as placeholders. --- pyanaconda/ui/gui/spokes/custom.glade | 6 +++--- pyanaconda/ui/gui/spokes/datetime_spoke.glade | 8 ++++---- pyanaconda/ui/gui/spokes/lib/resize.glade | 6 +++--- pyanaconda/ui/gui/spokes/source.glade | 18 +++++++++--------- 4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade index aa9184d..1b5de13 100644 --- a/pyanaconda/ui/gui/spokes/custom.glade +++ b/pyanaconda/ui/gui/spokes/custom.glade @@ -1622,7 +1622,7 @@ until you click on the main menu's 'Begin Installation' button.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Add a new mountpoint.</property> - <property name="label" translatable="yes">addButton</property> + <property name="label" translatable="yes">Add</property> <property name="use_underline">True</property> <property name="icon_name">list-add-symbolic</property> <signal name="clicked" handler="on_add_clicked" swapped="no"/> @@ -1639,7 +1639,7 @@ until you click on the main menu's 'Begin Installation' button.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Remove the selected mountpoint(s).</property> - <property name="label" translatable="yes">removeButton</property> + <property name="label" translatable="yes">Remove</property> <property name="use_underline">True</property> <property name="icon_name">list-remove-symbolic</property> <signal name="clicked" handler="on_remove_clicked" swapped="no"/> @@ -1656,7 +1656,7 @@ until you click on the main menu's 'Begin Installation' button.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Configure selected mountpoint.</property> - <property name="label" translatable="yes">configureButton</property> + <property name="label" translatable="yes">Configure</property> <property name="use_underline">True</property> <property name="icon_name">preferences-system-symbolic</property> <signal name="clicked" handler="on_configure_clicked" swapped="no"/> diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.glade b/pyanaconda/ui/gui/spokes/datetime_spoke.glade index bb84ce6..e5cb6b9 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.glade +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.glade @@ -276,7 +276,7 @@ <object class="GtkLabel" id="hoursLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">00</property> + <property name="label">00</property> <attributes> <attribute name="scale" value="2"/> </attributes> @@ -292,7 +292,7 @@ <object class="GtkLabel" id="colonLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">:</property> + <property name="label" translatable="yes" comments="TRANSLATORS: This is the separator between hours and minutes, like in HH:MM">:</property> <attributes> <attribute name="scale" value="2"/> </attributes> @@ -308,7 +308,7 @@ <object class="GtkLabel" id="minutesLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">00</property> + <property name="label">00</property> <attributes> <attribute name="scale" value="2"/> </attributes> @@ -414,7 +414,7 @@ <object class="GtkLabel" id="spaceLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes"> </property> + <property name="label"> </property> <attributes> <attribute name="scale" value="2"/> </attributes> diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade b/pyanaconda/ui/gui/spokes/lib/resize.glade index fc7e9f3..dd0e38e 100644 --- a/pyanaconda/ui/gui/spokes/lib/resize.glade +++ b/pyanaconda/ui/gui/spokes/lib/resize.glade @@ -308,7 +308,7 @@ <property name="can_focus">False</property> <property name="halign">start</property> <property name="margin_bottom">6</property> - <property name="label" translatable="yes"><b>%s disks; %s reclaimable space</b> (in filesystems)</property> + <property name="label"><b>. disks; . reclaimable space</b> (in filesystems)</property> <property name="use_markup">True</property> </object> <packing> @@ -323,7 +323,7 @@ <property name="can_focus">False</property> <property name="halign">end</property> <property name="margin_bottom">6</property> - <property name="label" translatable="yes">Total selected space to reclaim: <b>%s</b></property> + <property name="label">Total selected space to reclaim:</property> <property name="use_markup">True</property> </object> <packing> @@ -338,7 +338,7 @@ <property name="can_focus">False</property> <property name="halign">end</property> <property name="margin_bottom">6</property> - <property name="label" translatable="yes">Installation requires a total of <b>%s</b> for system data.</property> + <property name="label">Installation requires a total of <b>.</b> for system data.</property> <property name="use_markup">True</property> </object> <packing> diff --git a/pyanaconda/ui/gui/spokes/source.glade b/pyanaconda/ui/gui/spokes/source.glade index 3b0962a..91d716d 100644 --- a/pyanaconda/ui/gui/spokes/source.glade +++ b/pyanaconda/ui/gui/spokes/source.glade @@ -753,9 +753,9 @@ <property name="can_focus">False</property> <property name="active">0</property> <items> - <item translatable="yes">http://</item> - <item translatable="yes">https://</item> - <item translatable="yes">ftp://</item> + <item>http://</item> + <item>https://</item> + <item>ftp://</item> <item translatable="yes">nfs</item> <item translatable="yes">Closest mirror</item> </items> @@ -1039,7 +1039,7 @@ <property name="has_tooltip">True</property> <property name="tooltip_markup" translatable="yes">Add a new repository.</property> <property name="tooltip_text" translatable="yes">Add a new repository.</property> - <property name="label" translatable="yes">addButton</property> + <property name="label" translatable="yes">Add</property> <property name="use_underline">True</property> <property name="icon_name">list-add-symbolic</property> <signal name="clicked" handler="on_addRepo_clicked" swapped="no"/> @@ -1058,7 +1058,7 @@ <property name="has_tooltip">True</property> <property name="tooltip_markup" translatable="yes">Remove the selected repository.</property> <property name="tooltip_text" translatable="yes">Remove the selected repository.</property> - <property name="label" translatable="yes">removeButton</property> + <property name="label" translatable="yes">Remove</property> <property name="use_underline">True</property> <property name="icon_name">list-remove-symbolic</property> <signal name="clicked" handler="on_removeRepo_clicked" swapped="no"/> @@ -1077,7 +1077,7 @@ <property name="has_tooltip">True</property> <property name="tooltip_markup" translatable="yes">Revert to the default list of repositories.</property> <property name="tooltip_text" translatable="yes">Revert to the default list of repositories.</property> - <property name="label" translatable="yes">resetButton</property> + <property name="label" translatable="yes">Reset</property> <property name="use_underline">True</property> <property name="icon_name">view-refresh</property> <signal name="clicked" handler="on_resetRepos_clicked" swapped="no"/> @@ -1217,9 +1217,9 @@ <property name="entry_text_column">0</property> <property name="id_column">1</property> <items> - <item translatable="yes">http://</item> - <item translatable="yes">https://</item> - <item translatable="yes">ftp://</item> + <item>http://</item> + <item>https://</item> + <item>ftp://</item> </items> <signal name="changed" handler="on_repoUrl_changed" swapped="no"/> </object>
I'm pretty sure we never intended to display page numbers while refreshing disks. --- pyanaconda/ui/gui/spokes/lib/refresh.glade | 43 ------------------------------ 1 file changed, 43 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/refresh.glade b/pyanaconda/ui/gui/spokes/lib/refresh.glade index f848b16..201604d 100644 --- a/pyanaconda/ui/gui/spokes/lib/refresh.glade +++ b/pyanaconda/ui/gui/spokes/lib/refresh.glade @@ -148,16 +148,6 @@ <signal name="clicked" handler="on_rescan_clicked" swapped="no"/> </object> </child> - <child type="tab"> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">page 1</property> - </object> - <packing> - <property name="tab_fill">False</property> - </packing> - </child> <child> <object class="GtkBox" id="box3"> <property name="visible">True</property> @@ -194,17 +184,6 @@ <property name="position">1</property> </packing> </child> - <child type="tab"> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">page 2</property> - </object> - <packing> - <property name="position">1</property> - <property name="tab_fill">False</property> - </packing> - </child> <child> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> @@ -262,17 +241,6 @@ installation options while this scan completes.</property> <property name="position">2</property> </packing> </child> - <child type="tab"> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">page 3</property> - </object> - <packing> - <property name="position">2</property> - <property name="tab_fill">False</property> - </packing> - </child> <child> <object class="GtkGrid" id="grid2"> <property name="visible">True</property> @@ -329,17 +297,6 @@ installation options while this scan completes.</property> <property name="position">3</property> </packing> </child> - <child type="tab"> - <object class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">page 4</property> - </object> - <packing> - <property name="position">3</property> - <property name="tab_fill">False</property> - </packing> - </child> </object> <packing> <property name="expand">True</property>
Not every string is translatable, and some translatable strings require some extra information to make any damn sense to the translators. gettext is configured to include any comment that begins with TRANSLATORS: in the .pot file, so use that.
In the bug fixed in patch #2 (854226), the translator is actually asking for gettext context strings, claiming that 'c' is being used as an input string for both "close" and "continue". It doesn't look like that's actually the case, or isn't anymore, but either way python still doesn't have pgettext support, so I just added some comments instead so that whoever gets asked to translate "c" gets a hint as to what that actually means.
These all look fine.
There is very likely more problems than just these.
So true.
- Chris
On 09/13/2013 03:23 PM, David Shea wrote:
- Removed format strings from resize.glade since resize.py has its own versions of them. Left untranslated strings in the glade file as placeholders.
So, I changed my mind on this one over the weekend. Leaving the format strings as they were is fine as long the translatable flag is removed. Having the placeholder text appear in glade with %s and whatnot is more useful in order to see how the labels will be used on the python side.
anaconda-patches@lists.fedorahosted.org