From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
please use this command to generate the translation files for
plugins/sample
$ make -C plugins/sample/po/ update-po
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
configure.ac | 1 +
plugins/sample/Makefile.am | 9 ++++++++-
plugins/sample/config.status | 1 +
plugins/sample/po/LINGUAS | 1 +
plugins/sample/po/Makefile.in.in | 1 +
plugins/sample/po/Makevars | 41 ++++++++++++++++++++++++++++++++++++++++
plugins/sample/po/POTFILES.in | 2 ++
plugins/sample/po/en_US.po | 21 ++++++++++++++++++++
plugins/sample/po/gen-pot | 9 +++++++++
plugins/sample/po/pt_BR.po | 24 +++++++++++++++++++++++
plugins/sample/po/sample.pot | 21 ++++++++++++++++++++
plugins/sample/po/zh_CN.po | 24 +++++++++++++++++++++++
src/kimchi/template.py | 2 +-
13 files changed, 155 insertions(+), 2 deletions(-)
create mode 120000 plugins/sample/config.status
create mode 120000 plugins/sample/po/LINGUAS
create mode 120000 plugins/sample/po/Makefile.in.in
create mode 100644 plugins/sample/po/Makevars
create mode 100644 plugins/sample/po/POTFILES.in
create mode 100644 plugins/sample/po/en_US.po
create mode 100755 plugins/sample/po/gen-pot
create mode 100644 plugins/sample/po/pt_BR.po
create mode 100644 plugins/sample/po/sample.pot
create mode 100644 plugins/sample/po/zh_CN.po
diff --git a/configure.ac b/configure.ac
index c7da29b..e5e6441 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,6 +77,7 @@ AC_CONFIG_FILES([
src/kimchi/model/Makefile
plugins/Makefile
plugins/sample/Makefile
+ plugins/sample/po/Makefile.in
plugins/sample/sample.conf
plugins/sample/ui/Makefile
plugins/sample/ui/config/Makefile
diff --git a/plugins/sample/Makefile.am b/plugins/sample/Makefile.am
index a229244..d753ac9 100644
--- a/plugins/sample/Makefile.am
+++ b/plugins/sample/Makefile.am
@@ -17,6 +17,13 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-SUBDIRS = ui
+SUBDIRS = ui po
EXTRA_DIST = API.json sample.conf.in $(wildcard *.py)
+
+all-local:
+ while read L && test -n "$$L"; do \
+ dir=mo/$$L/LC_MESSAGES ; \
+ $(MKDIR_P) $$dir ; \
+ ln -sf ../../../po/$$L.gmo $$dir/sample.mo ; \
+ done < po/LINGUAS
diff --git a/plugins/sample/config.status b/plugins/sample/config.status
new file mode 120000
index 0000000..6cd6b4f
--- /dev/null
+++ b/plugins/sample/config.status
@@ -0,0 +1 @@
+../../config.status
\ No newline at end of file
diff --git a/plugins/sample/po/LINGUAS b/plugins/sample/po/LINGUAS
new file mode 120000
index 0000000..4fb83a5
--- /dev/null
+++ b/plugins/sample/po/LINGUAS
@@ -0,0 +1 @@
+../../../po/LINGUAS
\ No newline at end of file
diff --git a/plugins/sample/po/Makefile.in.in b/plugins/sample/po/Makefile.in.in
new file mode 120000
index 0000000..44028c0
--- /dev/null
+++ b/plugins/sample/po/Makefile.in.in
@@ -0,0 +1 @@
+../../../po/Makefile.in.in
\ No newline at end of file
diff --git a/plugins/sample/po/Makevars b/plugins/sample/po/Makevars
new file mode 100644
index 0000000..60de3f1
--- /dev/null
+++ b/plugins/sample/po/Makevars
@@ -0,0 +1,41 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = sample
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
+# package. (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.) Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright. The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER =
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+# in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+# understood.
+# - Strings which make invalid assumptions about notation of date, time or
+# money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = kimchi-devel(a)ovirt.org
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used. It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/plugins/sample/po/POTFILES.in b/plugins/sample/po/POTFILES.in
new file mode 100644
index 0000000..7dbfb6c
--- /dev/null
+++ b/plugins/sample/po/POTFILES.in
@@ -0,0 +1,2 @@
+# List of source files which contain translatable strings.
+plugins/sample/ui/pages/*.tmpl
diff --git a/plugins/sample/po/en_US.po b/plugins/sample/po/en_US.po
new file mode 100644
index 0000000..1889845
--- /dev/null
+++ b/plugins/sample/po/en_US.po
@@ -0,0 +1,21 @@
+# English translations for kimchi package.
+# Copyright (C) 2014 THE kimchi'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the kimchi package.
+# shhfeng <shaohef(a)linux.vnet.ibm.com>, 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: kimchi 1.2.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-05-17 02:13+0800\n"
+"PO-Revision-Date: 2014-05-17 02:08+0800\n"
+"Last-Translator: shhfeng <shaohef(a)linux.vnet.ibm.com>\n"
+"Language-Team: English\n"
+"Language: en_US\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ASCII\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: pygettext.py 1.5\n"
+
+msgid "SampleTab"
+msgstr "SampleTab"
diff --git a/plugins/sample/po/gen-pot b/plugins/sample/po/gen-pot
new file mode 100755
index 0000000..c1cfb8f
--- /dev/null
+++ b/plugins/sample/po/gen-pot
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+for src in $@; do
+ if [ ${src: -3} == ".py" ]; then
+ cat $src
+ else
+ cat $src | cheetah compile -
+ fi
+done | xgettext --no-location -o sample.pot -L Python -
diff --git a/plugins/sample/po/pt_BR.po b/plugins/sample/po/pt_BR.po
new file mode 100644
index 0000000..0ff1d43
--- /dev/null
+++ b/plugins/sample/po/pt_BR.po
@@ -0,0 +1,24 @@
+# Portuguese translations for kimchi package
+# Copyright (C) 2014 THE kimchi'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the kimchi package.
+# shhfeng <shaohef(a)linux.vnet.ibm.com>, 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: kimchi 1.2.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-05-17 02:13+0800\n"
+"PO-Revision-Date: 2014-05-17 02:09+0800\n"
+"Last-Translator: Crístian Viana <vianac(a)linux.vnet.ibm.com>\n"
+"Language-Team: Aline Manera <alinefm(a)br.ibm.com>\n"
+"Language: pt_BR\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: pygettext.py 1.5\n"
+"X-Poedit-Country: Brazil\n"
+"X-Poedit-Language: Portuguese\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+msgid "SampleTab"
+msgstr "Tab de exemplo"
diff --git a/plugins/sample/po/sample.pot b/plugins/sample/po/sample.pot
new file mode 100644
index 0000000..32ef568
--- /dev/null
+++ b/plugins/sample/po/sample.pot
@@ -0,0 +1,21 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-06-12 15:25+0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL(a)li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "SampleTab"
+msgstr ""
diff --git a/plugins/sample/po/zh_CN.po b/plugins/sample/po/zh_CN.po
new file mode 100644
index 0000000..bba53c3
--- /dev/null
+++ b/plugins/sample/po/zh_CN.po
@@ -0,0 +1,24 @@
+# Chinese translations for kimchi package
+# Copyright (C) 2014 THE kimchi'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the kimchi package.
+# shhfeng <shaohef(a)linux.vnet.ibm.com>, 2014.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: kimchi 1.2.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-05-17 02:13+0800\n"
+"PO-Revision-Date: 2014-05-17 02:10+0800\n"
+"Last-Translator: shhfeng <shaohef(a)linux.vnet.ibm.com>\n"
+"Language-Team: Chinese (simplified)\n"
+"Language: zh_CN\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: pygettext.py 1.5\n"
+"X-Poedit-Country: CHINA\n"
+"X-Poedit-Language: Chinese\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+msgid "SampleTab"
+msgstr "示例标签"
diff --git a/src/kimchi/template.py b/src/kimchi/template.py
index 146e735..0bee8c4 100644
--- a/src/kimchi/template.py
+++ b/src/kimchi/template.py
@@ -88,7 +88,7 @@ def render_cheetah_file(resource, data):
try:
params = {'data': data}
lang = validate_language(get_lang())
- gettext_conf = {'domain': 'kimchi',
+ gettext_conf = {'domain': cherrypy.request.app.root.domain,
'localedir': paths.mo_dir,
'lang': [lang]}
params['lang'] = gettext_conf
--
1.9.3