Skip to content

Commit

Permalink
Add language folders
Browse files Browse the repository at this point in the history
  • Loading branch information
titilambert committed Aug 30, 2016
1 parent c333528 commit fc90319
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ doc-generate:
### Test targets
#######################################
lang-scan:
pygettext3.5 --output-dir=locale/ -k gtt -va -x tuxeatpi/libs/lang.py tuxeatpi/*.py tuxeatpi/*/*.py
cd locale && msgmerge --update --no-fuzzy-matching --backup=off en/LC_MESSAGES/tuxeatpi.po messages.pot
cd locale && msgmerge --update --no-fuzzy-matching --backup=off fr/LC_MESSAGES/tuxeatpi.po messages.pot
pygettext3.5 --output-dir=tuxeatpi/locale/ -k gtt -va -x tuxeatpi/libs/lang.py tuxeatpi/*.py tuxeatpi/*/*.py
cd tuxeatpi/locale && msgmerge --update --no-fuzzy-matching --backup=off en/LC_MESSAGES/tuxeatpi.po messages.pot
cd tuxeatpi/locale && msgmerge --update --no-fuzzy-matching --backup=off fr/LC_MESSAGES/tuxeatpi.po messages.pot

lang-gen:
cd locale/fr/LC_MESSAGES/ && msgfmt tuxeatpi.po -o tuxeatpi.mo
cd locale/en/LC_MESSAGES/ && msgfmt tuxeatpi.po -o tuxeatpi.mo
cd tuxeatpi/locale/fr/LC_MESSAGES/ && msgfmt tuxeatpi.po -o tuxeatpi.mo
cd tuxeatpi/locale/en/LC_MESSAGES/ && msgfmt tuxeatpi.po -o tuxeatpi.mo

#######################################
### Test targets
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
url="https://github.com/TuxEatPi/tuxeatpi",
download_url="https://github.com/TuxEatPi/tuxeatpi/archive/0.0.1.tar.gz",
package_data={'': ['LICENSE.txt']},
data_files = [('locale', ['locale/fr/LC_MESSAGES/tuxeatpi.po',
'locale/en/LC_MESSAGES/tuxeatpi.po',
]
)],
package_dir={'tuxeatpi': 'tuxeatpi'},
include_package_data=True,
license='Apache 2.0',
Expand Down
6 changes: 3 additions & 3 deletions tuxeatpi/libs/lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ def load_languages():
TODO: make it more dynamic
"""
# Prepare
gettext.bindtextdomain('tuxeatpi', 'locale')
gettext.bindtextdomain('tuxeatpi', 'tuxeatpi/locale')
gettext.textdomain('tuxeatpi')
# Load languages
_lang_en = gettext.translation('tuxeatpi', localedir='locale', languages=['en'], fallback=True)
_lang_fr = gettext.translation('tuxeatpi', localedir='locale', languages=['fr'])
_lang_en = gettext.translation('tuxeatpi', localedir='tuxeatpi/locale', languages=['en'], fallback=True)
_lang_fr = gettext.translation('tuxeatpi', localedir='tuxeatpi/locale', languages=['fr'])
# Put languages in dict
LANGUAGES['eng-USA'] = _lang_en
LANGUAGES['fra-FRA'] = _lang_fr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2016-08-29 23:44-0400\n"
"POT-Creation-Date: 2016-08-30 17:25-0400\n"
"PO-Revision-Date: 2016-08-29 23:41-0400\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand All @@ -17,11 +17,11 @@ msgstr ""
"X-Generator: Poedit 1.8.8\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: tuxeatpi/actions/tux.py:35
#: tuxeatpi/actions/tux.py:34
msgid "My name is {}"
msgstr "My name is {}"

#: tuxeatpi/actions/tux.py:46
#: tuxeatpi/actions/tux.py:45
msgid "I'm born on {}"
msgstr "I'm born on {}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2016-08-29 23:44-0400\n"
"POT-Creation-Date: 2016-08-30 17:25-0400\n"
"PO-Revision-Date: 2016-08-29 22:46-0400\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand All @@ -17,11 +17,11 @@ msgstr ""
"X-Generator: Poedit 1.8.8\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#: tuxeatpi/actions/tux.py:35
#: tuxeatpi/actions/tux.py:34
msgid "My name is {}"
msgstr "Mon nom est {}"

#: tuxeatpi/actions/tux.py:46
#: tuxeatpi/actions/tux.py:45
msgid "I'm born on {}"
msgstr "Je suis né {}"

Expand Down
33 changes: 33 additions & 0 deletions tuxeatpi/locale/messages.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2016-08-30 17:25-0400\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=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"


#: tuxeatpi/actions/tux.py:34
msgid "My name is {}"
msgstr ""

#: tuxeatpi/actions/tux.py:45
msgid "I'm born on {}"
msgstr ""

#: tuxeatpi/nlu/nlu.py:51
msgid "I need a confirmation, Could you repeat please ?"
msgstr ""

#: tuxeatpi/nlu/nlu.py:55
msgid "Sorry, I just don't get it"
msgstr ""

0 comments on commit fc90319

Please sign in to comment.