[mousetrap/gnome3-wip: 156/240] Set up locale files
- From: Heidi Ellis <heidiellis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mousetrap/gnome3-wip: 156/240] Set up locale files
- Date: Mon, 8 Sep 2014 15:25:40 +0000 (UTC)
commit 5e959722a7fcd12920e65258fa0238f974e3e257
Author: Kevin Brown <kevin kevinbrown in>
Date: Tue Jun 24 19:02:17 2014 -0400
Set up locale files
This sets up the directory at mousetrap/locale which will allow it
to be included within the distributed version at a consistent
directory. The `*.mo` files must be generated before the
translations can be used, which will be done by autotools in the
future. Until then, the way to generate the *.mo files is by
running:
msgfmt src/mousetrap/locale/en/LC_MESSAGES/mousetrap.po --output-file
src/mousetrap/locale/en/LC_MESSAGES/mousetrap.mo
The directory structure for translations should be:
mousetrap/locale/[LANG_CODE]/LC_MESSAGES/mousetrap.po
This will conform to the restrictions set in place by Python's
gettext module and allow them to be automatically detected. The
default language is `en` and is left there as a placeholder for
future locales to use. When strings are updated, the master
`mousetrap.po` file must be updated. This can be done by running:
xgettext --language=Python --keyword=_ --output=src/mousetrap/locale/en/LC_MESSAGES/mousetrap.po
--from-code=UTF-8 `find src -name "*.py"`
This will require the header to be updated to reflect the change in
translations.
These commands require the gettext packages to be installed on the
system in order for them to work.
src/mousetrap/i18n.py | 9 +++-
src/mousetrap/locale/en/LC_MESSAGES/mousetrap.po | 60 ++++++++++++++++++++++
2 files changed, 67 insertions(+), 2 deletions(-)
---
diff --git a/src/mousetrap/i18n.py b/src/mousetrap/i18n.py
index 181427a..dc24fb0 100644
--- a/src/mousetrap/i18n.py
+++ b/src/mousetrap/i18n.py
@@ -1,4 +1,9 @@
-import locale
import gettext
+import locale
+import os
+
+LOCALE_DIR = os.path.join(os.path.dirname(__file__), "locale")
+
+translations = gettext.translation("mousetrap", localedir=LOCALE_DIR)
-_ = gettext.gettext
+_ = translations.ugettext
diff --git a/src/mousetrap/locale/en/LC_MESSAGES/mousetrap.po
b/src/mousetrap/locale/en/LC_MESSAGES/mousetrap.po
new file mode 100644
index 0000000..c8cf2de
--- /dev/null
+++ b/src/mousetrap/locale/en/LC_MESSAGES/mousetrap.po
@@ -0,0 +1,60 @@
+# This file is distributed under the same license as MouseTrap.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: MouseTrap\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-06-24 18:45-0400\n"
+"PO-Revision-Date: 2014-06-24 18:45-0400\n"
+"Last-Translator: MouseTrap team\n"
+"Language-Team: English <en li org>\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/mousetrap/gui.py:79
+#, python-format
+msgid "Moving pointer to %s"
+msgstr ""
+
+#: src/mousetrap/gui.py:84
+msgid "Not moving the pointer"
+msgstr ""
+
+#: src/mousetrap/plugins/eyes.py:90
+msgid "Found the face"
+msgstr ""
+
+#: src/mousetrap/plugins/eyes.py:97
+#, python-format
+msgid "Found the left eye at %s"
+msgstr ""
+
+#: src/mousetrap/plugins/eyes.py:104
+#, python-format
+msgid "Found an open eye at %s"
+msgstr ""
+
+#: src/mousetrap/plugins/interface.py:8 src/mousetrap/plugins/interface.py:12
+msgid "Must implement."
+msgstr ""
+
+#: src/mousetrap/vision.py:12
+#, python-format
+msgid "Device #%d does not support video capture interface"
+msgstr ""
+
+#: src/mousetrap/vision.py:13
+msgid "Error while capturing. Camera disconnected?"
+msgstr ""
+
+#: src/mousetrap/vision.py:125
+#, python-format
+msgid "Feature not detected: %s"
+msgstr ""
+
+#: src/mousetrap/main.py:52
+#, python-format
+msgid "Could not import plugin `%s`. Check config file and PYTHONPATH."
+msgstr ""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]