Trying to add a translation of a page in django cms, which is Uzbek, not supported by django CMS. I added this inside settings.py
# CMS_LANGUAGES = {
...
, {
'code': 'uz',
'name': gettext('Uzbek'),
'redirect_on_fallback': False,
'public': True,
'hide_untranslated': True,
}
}
LANGUAGES = (
## Customize this
('en', gettext('en')),
('ru', gettext('ru')),
('uz', gettext('uz')), # <- this one
)
but when I access http://127.0.0.1:8000/uz/, the output is:
The current path, /ru/uz/, didn't match any of these.
So, in accordance to some googling, I decided to add my own language .po files. Then added in settigs.py:
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
LOCALE_PATHS = (
os.path.join(PACKAGE_ROOT, 'locale'),
)
EXTRA_LANG_INFO = {
'uz': {
'bidi': False, # right-to-left
'code': 'uz',
'name': 'Uzbek',
'name_local': 'Ozbek', # unicode codepoints here
},
}
# Add custom languages not provided by Django
import django.conf.locale
LANG_INFO = dict(django.conf.locale.LANG_INFO, **EXTRA_LANG_INFO)
django.conf.locale.LANG_INFO = LANG_INFO
# Languages using BiDi (right-to-left) layout
LANGUAGES_BIDI = global_settings.LANGUAGES_BIDI + ["uz"]
then in terminal:
./manage.py makemessages -l uz
./manage.py compilemessages
restarted and reload browser outputs following error:
raise ValueError('invalid token in plural form: %s' % value)
ValueError: invalid token in plural form: EXPRESSION
Could you please help to resolve my issue, any recomendation please to add Uzbek translation to my page?
@vThaian @DmytroLitvinov @FSE-DEV could you please help
Hello, @abduakhatov .
Have you tried to find an answer at StackOverflow?
I found a similar ticket at Django project.
Take a look at this commit. Maybe it is your case?
@DmytroLitvinov Thank you! it worked. I should confess that with this answer you not only resolved my headache, but also taught me the most important lesson; To be honest I overwatched all sources, but because of my unprofessionalism and un-attentiveness, I missed a key point. This does not feels so painful, as feeling that sometimes just googling is not enough!
@abduakhatov you are welcome ;)
Seek and you will find; knock and the door will be opened to you.
Have a nice working week.
Most helpful comment
Hello, @abduakhatov .
Have you tried to find an answer at StackOverflow?
I found a similar ticket at Django project.
Take a look at this commit. Maybe it is your case?