[Cdd-commits] r674 - in cdd/trunk/webtools: . po

CDD Subversion Commit noreply at alioth.debian.org
Sat Apr 5 18:16:00 UTC 2008


Author: js
Date: Sat Apr  5 18:16:00 2008
New Revision: 674

Added:
   cdd/trunk/webtools/.gitignore
   cdd/trunk/webtools/.svnignore
   cdd/trunk/webtools/mkmo.sh   (contents, props changed)
   cdd/trunk/webtools/mkpot.sh   (contents, props changed)
   cdd/trunk/webtools/po/
   cdd/trunk/webtools/po/cdd-webtools.pot
   cdd/trunk/webtools/po/da.po
   cdd/trunk/webtools/po/de.po
   cdd/trunk/webtools/po/en.po
   cdd/trunk/webtools/po/fr.po
Modified:
   cdd/trunk/webtools/tasks_idx.py
Log:
Implement proof-of-concept i18n for webtools.


Added: cdd/trunk/webtools/.gitignore
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/.gitignore	Sat Apr  5 18:16:00 2008
@@ -0,0 +1 @@
+locale

Added: cdd/trunk/webtools/.svnignore
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/.svnignore	Sat Apr  5 18:16:00 2008
@@ -0,0 +1 @@
+locale

Added: cdd/trunk/webtools/mkmo.sh
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/mkmo.sh	Sat Apr  5 18:16:00 2008
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+domain="cdd-webtools"
+podir="po"
+ls -1 "$podir"/*.po | xargs -I{} basename '{}' .po | while read lang; do
+	modir="locale/$lang/LC_MESSAGES"
+	mkdir -p "$modir"
+	msgfmt --output-file="$modir/$domain.mo" "$podir/$lang.po"
+done

Added: cdd/trunk/webtools/mkpot.sh
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/mkpot.sh	Sat Apr  5 18:16:00 2008
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+xgettext \
+	--default-domain="cdd-webtools" \
+	--package-name="cdd-webtools" \
+	--package-version="0.1.1" \
+	--msgid-bugs-address="debian-custom at lists.debian.org" \
+	--copyright-holder="Custom Debian Distribution Team <debian-custom at lists.debian.org>" \
+	--language="Python" \
+	--keyword="_" \
+	--output-dir="po" \
+	--output="cdd-webtools.pot" \
+	tasks_idx.py

Added: cdd/trunk/webtools/po/cdd-webtools.pot
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/po/cdd-webtools.pot	Sat Apr  5 18:16:00 2008
@@ -0,0 +1,21 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Custom Debian Distribution Team <debian-custom at lists.debian.org>
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: cdd-webtools 0.1.1\n"
+"Report-Msgid-Bugs-To: debian-custom at lists.debian.org\n"
+"POT-Creation-Date: 2008-04-05 20:02+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: tasks_idx.py:57
+msgid "Hello world"
+msgstr ""

Added: cdd/trunk/webtools/po/da.po
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/po/da.po	Sat Apr  5 18:16:00 2008
@@ -0,0 +1,21 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Custom Debian Distribution Team <debian-custom at lists.debian.org>
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: cdd-webtools 0.1.1\n"
+"Report-Msgid-Bugs-To: debian-custom at lists.debian.org\n"
+"POT-Creation-Date: 2008-04-05 18:36+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: tasks_idx.py:52
+msgid "Hello world"
+msgstr "Hej verden"

Added: cdd/trunk/webtools/po/de.po
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/po/de.po	Sat Apr  5 18:16:00 2008
@@ -0,0 +1,21 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Custom Debian Distribution Team <debian-custom at lists.debian.org>
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: cdd-webtools 0.1.1\n"
+"Report-Msgid-Bugs-To: debian-custom at lists.debian.org\n"
+"POT-Creation-Date: 2008-04-05 18:36+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: tasks_idx.py:52
+msgid "Hello world"
+msgstr "Hallo Welt"

Added: cdd/trunk/webtools/po/en.po
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/po/en.po	Sat Apr  5 18:16:00 2008
@@ -0,0 +1,21 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Custom Debian Distribution Team <debian-custom at lists.debian.org>
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: cdd-webtools 0.1.1\n"
+"Report-Msgid-Bugs-To: debian-custom at lists.debian.org\n"
+"POT-Creation-Date: 2008-04-05 18:36+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: tasks_idx.py:52
+msgid "Hello world"
+msgstr "Hello world"

Added: cdd/trunk/webtools/po/fr.po
==============================================================================
--- (empty file)
+++ cdd/trunk/webtools/po/fr.po	Sat Apr  5 18:16:00 2008
@@ -0,0 +1,21 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Custom Debian Distribution Team <debian-custom at lists.debian.org>
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: cdd-webtools 0.1.1\n"
+"Report-Msgid-Bugs-To: debian-custom at lists.debian.org\n"
+"POT-Creation-Date: 2008-04-05 18:36+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: tasks_idx.py:52
+msgid "Hello world"
+msgstr ""

Modified: cdd/trunk/webtools/tasks_idx.py
==============================================================================
--- cdd/trunk/webtools/tasks_idx.py	(original)
+++ cdd/trunk/webtools/tasks_idx.py	Sat Apr  5 18:16:00 2008
@@ -1,8 +1,21 @@
 #!/usr/bin/python
 
+import os
+import gettext
+
 import genshi
 import genshi.template
 
+# Initialize i18n
+locale_dir = os.path.join(os.path.dirname(__file__), 'locale')
+domain = 'cdd-webtools'
+gettext.install(domain)
+languages = ('en', 'de', 'fr', 'da')
+l10nstring = {}
+for lang in languages:
+#    l10nstring[lang] = gettext.translation(domain, languages=[lang], fallback = True)
+    l10nstring[lang] = gettext.translation(domain, locale_dir, languages=[lang], fallback = False)
+
 loader = genshi.template.TemplateLoader('.')
 
 data = dict(
@@ -39,4 +52,8 @@
 
 template = loader.load('tasks_idx.xhtml')
 
-print template.generate(**data).render('xhtml')
+for lang in languages:
+    l10nstring[lang].install()
+    print _('Hello world')
+
+#print template.generate(**data).render('xhtml')



More information about the Cdd-commits mailing list