Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2008-02-09 13:45:59 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2008-02-09 13:51:27 (GMT)
commit8c2cb3a5d04b45e10dfd4c845816cf1b2cb3928c (patch)
treea0c776ff88b6e3bc2ed7c620ffe88dd8f576211f
parent7c84042f0288c828a26e1b6c99d8a4438a07ba8d (diff)
#5017 Correctly expose some strings to gettext.
-rw-r--r--NEWS3
-rw-r--r--misc.py25
-rw-r--r--po/Journal.pot93
3 files changed, 93 insertions, 28 deletions
diff --git a/NEWS b/NEWS
index 835525e..a379b6a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,8 @@
+* #5017 Correctly expose some strings to gettext. (tomeu)
+
85
84
-
* #6190 Don't crash when an activity has its icon missing. (tomeu)
* #6029 Don't fail when the mount point is already occupied. (tomeu)
diff --git a/misc.py b/misc.py
index d1a5648..652930e 100644
--- a/misc.py
+++ b/misc.py
@@ -15,7 +15,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from gettext import gettext as _
-from gettext import ngettext
+import gettext
import logging
import time
import traceback
@@ -95,6 +95,26 @@ AND = _(' and ')
COMMA = _(', ')
RIGHT_NOW = _('Right now')
+# Explanation of the following hack:
+# The xgettext utility extracts plural forms by reading the strings included as
+# parameters of ngettext(). As our plurals are not passed to ngettext()
+# straight away because there needs to be a calculation before we know which
+# strings need to be used, then we need to call ngettext() in a fake way so
+# xgettext will pick them up as plurals.
+
+def ngettext(singular, plural, n): pass
+
+ngettext('%d year', '%d years', 1)
+ngettext('%d month', '%d months', 1)
+ngettext('%d week', '%d weeks', 1)
+ngettext('%d day', '%d days', 1)
+ngettext('%d hour', '%d hours', 1)
+ngettext('%d minute', '%d minutes', 1)
+
+del ngettext
+
+# End of plurals hack
+
def _get_elapsed_string(timestamp, max_levels=2):
levels = 0
result = ''
@@ -109,7 +129,8 @@ def _get_elapsed_string(timestamp, max_levels=2):
else:
result += COMMA
- result += ngettext(name_singular, name_plural, elapsed_units) % elapsed_units
+ result += gettext.ngettext(name_singular, name_plural,
+ elapsed_units) % elapsed_units
elapsed_seconds -= elapsed_units * factor
levels += 1
diff --git a/po/Journal.pot b/po/Journal.pot
index eb9a405..1243253 100644
--- a/po/Journal.pot
+++ b/po/Journal.pot
@@ -8,23 +8,24 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-12-11 15:41+0000\n"
+"POT-Creation-Date: 2008-02-09 14:50+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
-#: activity/activity.info:2 journalactivity.py:111 volumesmanager.py:58
+#: activity/activity.info:2 journalactivity.py:121 volumesmanager.py:58
msgid "Journal"
msgstr ""
-#: collapsedentry.py:178 expandedentry.py:170
+#: collapsedentry.py:180 expandedentry.py:170
msgid "Untitled"
msgstr ""
-#: collapsedentry.py:260 expandedentry.py:172
+#: collapsedentry.py:262 expandedentry.py:172
msgid " Activity"
msgstr ""
@@ -40,93 +41,135 @@ msgstr ""
msgid "Tags:"
msgstr ""
-#: journaltoolbox.py:51
+#: journaltoolbox.py:52
msgid "Search"
msgstr ""
-#: journaltoolbox.py:122
+#: journaltoolbox.py:123
msgid "Anytime"
msgstr ""
-#: journaltoolbox.py:124
+#: journaltoolbox.py:125
msgid "Today"
msgstr ""
-#: journaltoolbox.py:126
+#: journaltoolbox.py:127
msgid "Since yesterday"
msgstr ""
#. TRANS: Filter entries modified during the last 7 days.
-#: journaltoolbox.py:128
+#: journaltoolbox.py:129
msgid "Past week"
msgstr ""
#. TRANS: Filter entries modified during the last 30 days.
-#: journaltoolbox.py:130
+#: journaltoolbox.py:131
msgid "Past month"
msgstr ""
#. TRANS: Filter entries modified during the last 356 days.
-#: journaltoolbox.py:132
+#: journaltoolbox.py:133
msgid "Past year"
msgstr ""
-#: journaltoolbox.py:139
+#: journaltoolbox.py:140
msgid "Anyone"
msgstr ""
-#: journaltoolbox.py:141
+#: journaltoolbox.py:142
msgid "My friends"
msgstr ""
-#: journaltoolbox.py:142
+#: journaltoolbox.py:143
msgid "My class"
msgstr ""
#. TRANS: Item in a combo box that filters by entry type.
-#: journaltoolbox.py:254
+#: journaltoolbox.py:255
msgid "Anything"
msgstr ""
-#: journaltoolbox.py:295
+#: journaltoolbox.py:303
msgid "Backup"
msgstr ""
-#: journaltoolbox.py:327
+#: journaltoolbox.py:335
msgid "Go back"
msgstr ""
-#: journaltoolbox.py:339
+#: journaltoolbox.py:347
msgid "Erase"
msgstr ""
-#: journaltoolbox.py:354
+#: journaltoolbox.py:362
msgid "Copy to clipboard"
msgstr ""
#. TRANS: Action label for resuming an activity.
-#: journaltoolbox.py:432
+#: journaltoolbox.py:440
msgid "Resume"
msgstr ""
#. TRANS: Action label for starting an entry.
-#: journaltoolbox.py:435
+#: journaltoolbox.py:443
msgid "Start"
msgstr ""
-#: misc.py:84
+#: misc.py:94
msgid " and "
msgstr ""
-#: misc.py:85
+#: misc.py:95
msgid ", "
msgstr ""
-#: misc.py:86
+#: misc.py:96
msgid "Right now"
msgstr ""
-#: misc.py:123
+#: misc.py:107
+#, python-format
+msgid "%d year"
+msgid_plural "%d years"
+msgstr[0] ""
+msgstr[1] ""
+
+#: misc.py:108
+#, python-format
+msgid "%d month"
+msgid_plural "%d months"
+msgstr[0] ""
+msgstr[1] ""
+
+#: misc.py:109
+#, python-format
+msgid "%d week"
+msgid_plural "%d weeks"
+msgstr[0] ""
+msgstr[1] ""
+
+#: misc.py:110
+#, python-format
+msgid "%d day"
+msgid_plural "%d days"
+msgstr[0] ""
+msgstr[1] ""
+
+#: misc.py:111
+#, python-format
+msgid "%d hour"
+msgid_plural "%d hours"
+msgstr[0] ""
+msgstr[1] ""
+
+#: misc.py:112
+#, python-format
+msgid "%d minute"
+msgid_plural "%d minutes"
+msgstr[0] ""
+msgstr[1] ""
+
+#: misc.py:154
msgid "No date"
msgstr ""