Skip to content

Commit

Permalink
reproducer for Pylons/pyramid#1473
Browse files Browse the repository at this point in the history
  • Loading branch information
rbu committed Nov 25, 2014
0 parents commit 50f87d9
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 0 deletions.
32 changes: 32 additions & 0 deletions helloworld.py
@@ -0,0 +1,32 @@
# coding: utf-8
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response

from pyramid.i18n import TranslationStringFactory
_ = TranslationStringFactory('dom')


def hello_world(request):
ts = _('Add')
localizer = request.localizer
translated = localizer.translate(ts)
return Response('%s %s!' % (translated, request.matchdict['name']))

if __name__ == '__main__':
config = Configurator(settings={'pyramid.default_locale_name': 'de'})
config.add_route('hello', '/hello/{name}')
config.add_view(hello_world, route_name='hello')
# config.add_translation_dirs('locale', 'locale_override')
## -> Addieren (override)

# config.add_translation_dirs('locale_override', 'locale')
## -> Hinzufügen (non-override)

config.add_translation_dirs('locale_override')
config.add_translation_dirs('locale')
## -> Addieren (override)

app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8123, app)
server.serve_forever()
Binary file added locale/de/LC_MESSAGES/dom.mo
Binary file not shown.
20 changes: 20 additions & 0 deletions locale/de/LC_MESSAGES/dom.po
@@ -0,0 +1,20 @@
#
# German translations for PACKAGE package
# This file is distributed under the same license as the PACKAGE package.
# rbu <rb@sntl-publishing.com>, 2014.
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2014-11-25 11:04+0100\n"
"PO-Revision-Date: 2014-11-25 11:14+0100\n"
"Last-Translator: rbu <rb@sntl-publishing.com>\n"
"Language-Team: German\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: helloworld.py:10
msgid "Add"
msgstr "Hinzufügen"
20 changes: 20 additions & 0 deletions locale/dom.pot
@@ -0,0 +1,20 @@
#
# SOME DESCRIPTIVE TITLE
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2014-11-25 11:04+0100\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"
"Language: \n"

#: ././helloworld.py:10
msgid "Add"
msgstr ""
Binary file added locale_override/de/LC_MESSAGES/dom.mo
Binary file not shown.
20 changes: 20 additions & 0 deletions locale_override/de/LC_MESSAGES/dom.po
@@ -0,0 +1,20 @@
#
# German translations for PACKAGE package
# This file is distributed under the same license as the PACKAGE package.
# rbu <rb@sntl-publishing.com>, 2014.
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2014-11-25 11:04+0100\n"
"PO-Revision-Date: 2014-11-25 11:14+0100\n"
"Last-Translator: rbu <rb@sntl-publishing.com>\n"
"Language-Team: German\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: helloworld.py:10
msgid "Add"
msgstr "Addieren"
20 changes: 20 additions & 0 deletions locale_override/dom.pot
@@ -0,0 +1,20 @@
#
# SOME DESCRIPTIVE TITLE
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2014-11-25 11:04+0100\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"
"Language: \n"

#: ././helloworld.py:10
msgid "Add"
msgstr ""

0 comments on commit 50f87d9

Please sign in to comment.