diff --git a/rosetta/poutil.py b/rosetta/poutil.py index aa18107..df776a7 100644 --- a/rosetta/poutil.py +++ b/rosetta/poutil.py @@ -134,10 +134,10 @@ def find_pos(lang, project_apps=True, django_apps=False, third_party_apps=False) langs = [lang, ] if u'-' in lang: _l, _c = map(lambda x: x.lower(), lang.split(u'-', 1)) - langs += [u'%s_%s' % (_l, _c), u'%s_%s' % (_l, _c.upper()), ] + langs += [u'%s_%s' % (_l, _c), u'%s_%s' % (_l, _c.upper()), u'%s_%s' % (_l, _c.capitalize()),] elif u'_' in lang: _l, _c = map(lambda x: x.lower(), lang.split(u'_', 1)) - langs += [u'%s-%s' % (_l, _c), u'%s-%s' % (_l, _c.upper()), ] + langs += [u'%s-%s' % (_l, _c), u'%s-%s' % (_l, _c.upper()), u'%s_%s' % (_l, _c.capitalize()),] paths = map(os.path.normpath, paths) paths = list(set(paths)) diff --git a/rosetta/tests/tests.py b/rosetta/tests/tests.py index fc552d0..eb7eba5 100644 --- a/rosetta/tests/tests.py +++ b/rosetta/tests/tests.py @@ -48,7 +48,8 @@ class RosettaTestCase(TestCase): settings.LANGUAGES = ( ('xx', 'dummy language'), ('fr_FR.utf8', 'French (France), UTF8'), - ('bs-Cyrl-BA', u'Bosnian (Cyrillic) (Bosnia and Herzegovina)') + ('bs-Cyrl-BA', u'Bosnian (Cyrillic) (Bosnia and Herzegovina)'), + ('yy-Anot', u'Yet Another dummy language'), ) self.__session_engine = settings.SESSION_ENGINE @@ -714,6 +715,11 @@ class RosettaTestCase(TestCase): r = self.client.get(reverse('rosetta-pick-file')) self.assertTrue(os.path.normpath('locale/bs-Cyrl-BA/LC_MESSAGES/django.po') in str(r.content)) + def test_37_issue_133_complex_locales(self): + r = self.client.get(reverse('rosetta-pick-file') + '?filter=all') + r = self.client.get(reverse('rosetta-pick-file')) + self.assertTrue(os.path.normpath('locale/yy_Anot/LC_MESSAGES/django.po') in str(r.content)) + # Stubbed access control function def no_access(user): diff --git a/testproject/locale/yy_Anot/LC_MESSAGES/django.po b/testproject/locale/yy_Anot/LC_MESSAGES/django.po new file mode 100644 index 0000000..5d9c151 --- /dev/null +++ b/testproject/locale/yy_Anot/LC_MESSAGES/django.po @@ -0,0 +1,34 @@ +# 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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-14 02:28-0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +#: templates/test.html:3 +msgid "Some text to translate" +msgstr "" + +#: templates/test.html:5 +#, python-format +msgid "" +"\n" +"one bottle of beer on the wall\n" +msgid_plural "" +"\n" +"%(num_bottles)s bottles of beer on the wall\n" +msgstr[0] "" +msgstr[1] ""