[latexila] i18n: some fixes



commit 2b59018c2e113227d574772e259f4b25805ea8f0
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Wed Jul 27 14:37:26 2011 +0200

    i18n: some fixes
    
    - Use ngettext () for plural forms.
    - Add comments for translators.
    - ...

 src/custom_statusbar.vala     |    3 +++
 src/latex_post_processor.vala |   10 ++++++----
 src/main_window.vala          |    4 ++--
 src/preferences_dialog.vala   |   13 ++++++++-----
 src/structure.vala            |    1 +
 src/ui/preferences_dialog.ui  |    2 +-
 6 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/src/custom_statusbar.vala b/src/custom_statusbar.vala
index b248cdb..f876633 100644
--- a/src/custom_statusbar.vala
+++ b/src/custom_statusbar.vala
@@ -36,6 +36,9 @@ public class CustomStatusbar : Statusbar
         cursor_position.pop (0);
         if (line == -1 && col == -1)
             return;
+
+        // Translators: "Ln" is an abbreviation for "Line", Col is an abbreviation for
+        // "Column". Please, use abbreviations if possible.
         cursor_position.push (0, _("Ln %d, Col %d").printf (line, col));
     }
 }
diff --git a/src/latex_post_processor.vala b/src/latex_post_processor.vala
index 6894544..aae93fc 100644
--- a/src/latex_post_processor.vala
+++ b/src/latex_post_processor.vala
@@ -135,11 +135,13 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
         foreach (string line in lines)
             latex_output_filter (line);
 
-        // stats
+        // Stats.
+        // Since all the messages printed by the 'latex' or 'pdflatex' command are in
+        // English, it would be strange to have only this one translated.
         msg.message = "%d %s, %d %s, %d %s".printf (
-            nb_errors,   nb_errors   > 1 ? "errors"   : "error",
-            nb_warnings, nb_warnings > 1 ? "warnings" : "warning",
-            nb_badboxes, nb_badboxes > 1 ? "badboxes" : "badbox");
+            nb_errors,   nb_errors   == 1 ? "error"   : "errors",
+            nb_warnings, nb_warnings == 1 ? "warning" : "warnings",
+            nb_badboxes, nb_badboxes == 1 ? "badbox"  : "badboxes");
         msg.message_type = BuildMessageType.OTHER;
         add_msg (false);
     }
diff --git a/src/main_window.vala b/src/main_window.vala
index ecf5b57..94e16b5 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -147,10 +147,10 @@ public class MainWindow : Window
         { "StructureComment", null, N_("_Comment"), null,
             N_("Comment the selected structure item"), on_structure_comment },
         { "StructureShiftLeft", Stock.GO_BACK, N_("Shift _Left"), "",
-            N_("Shift the selected structure item to the left (e.g. section â chapter"),
+            N_("Shift the selected structure item to the left (e.g. section â chapter)"),
             on_structure_shift_left },
         { "StructureShiftRight", Stock.GO_FORWARD, N_("Shift _Right"), "",
-            N_("Shift the selected structure item to the right (e.g. chapter â section"),
+            N_("Shift the selected structure item to the right (e.g. chapter â section)"),
             on_structure_shift_right },
 
         // Help
diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala
index 6d57436..8c4411a 100644
--- a/src/preferences_dialog.vala
+++ b/src/preferences_dialog.vala
@@ -25,6 +25,8 @@ public class PreferencesDialog : Dialog
     private static PreferencesDialog preferences_dialog = null;
     private ListStore build_tools_store;
 
+    delegate unowned string Plural (ulong n);
+
     private PreferencesDialog ()
     {
         title = _("Preferences");
@@ -185,7 +187,7 @@ public class PreferencesDialog : Dialog
 
         Label autosave_label = (Label) builder.get_object ("autosave_label");
         set_plural (autosave_label, settings, "auto-save-interval",
-            _("minute"), _("minutes"));
+            (n) => ngettext ("minute", "minutes", n));
 
         var reopen_checkbutton = builder.get_object ("reopen_checkbutton");
         settings.bind ("reopen-files", reopen_checkbutton, "active",
@@ -280,7 +282,7 @@ public class PreferencesDialog : Dialog
         Label interactive_comp_label =
             (Label) builder.get_object ("interactive_comp_label");
         set_plural (interactive_comp_label, settings, "interactive-completion-num",
-            _("character"), _("characters"));
+            (n) => ngettext ("character", "characters", n));
 
         var document_view_program = builder.get_object ("document_view_program");
         settings.bind ("document-view-program", document_view_program, "text",
@@ -475,16 +477,17 @@ public class PreferencesDialog : Dialog
     }
 
     private void set_plural (Label label, GLib.Settings settings, string key,
-        string msg_singular, string msg_plural)
+        Plural plural)
     {
         uint val;
         settings.get (key, "u", out val);
-        label.label = val > 1 ? msg_plural : msg_singular;
+        label.label = plural (val);
+
         settings.changed[key].connect ((setting, k) =>
         {
             uint v;
             setting.get (k, "u", out v);
-            label.label = v > 1 ? msg_plural : msg_singular;
+            label.label = plural (v);
         });
     }
 
diff --git a/src/structure.vala b/src/structure.vala
index 04096c6..f219476 100644
--- a/src/structure.vala
+++ b/src/structure.vala
@@ -665,6 +665,7 @@ public class Structure : VBox
             _names[StructType.TODO]         = "TODO";
             _names[StructType.FIXME]        = "FIXME";
             _names[StructType.TABLE]        = _("Table");
+            // Translators: "Figure" here means a diagram (\begin{figure}...\end{figure})
             _names[StructType.FIGURE]       = _("Figure");
             _names[StructType.IMAGE]        = _("Image");
             _names[StructType.INCLUDE]      = _("File included");
diff --git a/src/ui/preferences_dialog.ui b/src/ui/preferences_dialog.ui
index 42c668a..4e66641 100644
--- a/src/ui/preferences_dialog.ui
+++ b/src/ui/preferences_dialog.ui
@@ -218,7 +218,7 @@
               <object class="GtkLabel" id="autosave_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">minutes</property>
+                <property name="label">minutes</property>
               </object>
               <packing>
                 <property name="expand">False</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]