Make BaseL10N more flexible about creation timestamp.
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 9 Dec 2007 05:02:28 +0000 (05:02 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 9 Dec 2007 05:02:28 +0000 (05:02 +0000)
Add one test for loading PO files, along with required data files.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@8180 dcc99617-32d9-48b4-a31d-7c20da2025e4

build/i18n/scripts/basel10n.py
build/i18n/tests/data/complex.po [new file with mode: 0644]
build/i18n/tests/data/complex.pot [new file with mode: 0644]

index 8073af5..bb816e6 100755 (executable)
@@ -29,19 +29,20 @@ class BaseL10N:
     def __init__(self):
         self.pot = polib.POFile()
 
-    def pothead(self, version=None):
+    def pothead(self, version=None, date=None):
         """
         Initializes the header for a POT file to reasonable defaults
         """
         # We should be smarter about the Project-Id-Version attribute
         if version is None:
             version = 'Evergreen 1.4'
-        date = time.strftime("%Y-%m-%d %H:%M:%S")
+        if date is None:
+            date = time.strftime("%Y-%m-%d %H:%M:%S") + '-0400'
         self.pot.metadata['Project-Id-Version'] = version
         self.pot.metadata['Report-Msgid-Bugs-To'] = \
             'open-ils-dev@list.georgialibraries.org'
         # Cheat and hard-code the time zone offset
-        self.pot.metadata['POT-Creation-Date'] = "%s %s" % (date, '-0400')
+        self.pot.metadata['POT-Creation-Date'] = date
         self.pot.metadata['PO-Revision-Date'] = 'YEAR-MO-DA HO:MI+ZONE'
         self.pot.metadata['Last-Translator'] = 'FULL NAME <EMAIL@ADDRESS>'
         self.pot.metadata['Language-Team'] = 'LANGUAGE <LL@li.org>'
diff --git a/build/i18n/tests/data/complex.po b/build/i18n/tests/data/complex.po
new file mode 100644 (file)
index 0000000..48dc354
--- /dev/null
@@ -0,0 +1,29 @@
+# 
+msgid ""
+msgstr ""
+"Project-Id-Version: Evergreen 1.4"
+"Report-Msgid-Bugs-To: open-ils-dev@list.georgialibraries.org"
+"POT-Creation-Date: 1999-12-31 23:59:59 -0400"
+"PO-Revision-Date: 2007-12-08 23:14:20 -0400"
+"Last-Translator: Dan Scott <dscott@laurentian.ca>"
+"Language-Team: fr-CA <LL@li.org>"
+"MIME-Version: 1.0"
+"Content-Type: text/plain; charset=utf-8"
+"Content-Transfer-Encoding: 8-bit"
+
+#: 240:field.aihu.org_unit.label 257:field.ancihu.org_unit.label
+msgid "Using Library"
+msgstr "Utiliser la bibliothèque"
+
+#: 2475:field.rxbt.voided.label
+msgid ""
+"Super crazy long and repetitive message ID from hell"
+"Super crazy long and repetitive message ID from hell"
+"Super crazy long and repetitive message ID from hell"
+"Super crazy long and repetitive message ID from hell"
+"Super crazy long and repetitive message ID from hell"
+msgstr "ôèàéç"
+
+#: 524:field.bre.source.label
+msgid "Record Source"
+msgstr ""
diff --git a/build/i18n/tests/data/complex.pot b/build/i18n/tests/data/complex.pot
new file mode 100644 (file)
index 0000000..cb4ddc7
--- /dev/null
@@ -0,0 +1,29 @@
+# 
+msgid ""
+msgstr ""
+"Project-Id-Version: Evergreen 1.4"
+"Report-Msgid-Bugs-To: open-ils-dev@list.georgialibraries.org"
+"POT-Creation-Date: 2007-12-06 23:16:35 -0400"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>"
+"Language-Team: LANGUAGE <LL@li.org>"
+"MIME-Version: 1.0"
+"Content-Type: text/plain; charset=utf-8"
+"Content-Transfer-Encoding: 8-bit"
+
+#: 240:field.aihu.org_unit.label 257:field.ancihu.org_unit.label
+msgid "Using Library"
+msgstr ""
+
+#: 2475:field.rxbt.voided.label
+msgid ""
+"Super crazy long and repetitive message ID from hell"
+"Super crazy long and repetitive message ID from hell"
+"Super crazy long and repetitive message ID from hell"
+"Super crazy long and repetitive message ID from hell"
+"Super crazy long and repetitive message ID from hell"
+msgstr ""
+
+#: 524:field.bre.source.label
+msgid "Record Source"
+msgstr ""