kghs03
kghs03

Reputation: 11

Django i18n issue on heroku

I am developing a Django web application and deploy this application to heroku. I use i18n to implement multi-language function. this is my po file

/locale/zh_hant/LC_MESSAGES/django.po

#: lib/templates/langs/index.html:7
msgid "name"
msgstr "名稱"

#: myShopCar/settings.py:211
msgid "German"
msgstr "德文"

#: myShopCar/settings.py:212
msgid "English"
msgstr "英文"

#: myShopCar/settings.py:213
msgid "Tranditional Chinese"
msgstr "繁體中文"

#: myShopCar/settings.py:214
msgid "Simplied Chinese"
msgstr "簡體中文"

this is my template

/lib/templates/langs/index.html

{% load i18n %}

{% get_current_language as LANGUAGE_CODE %}

{{ LANGUAGE_CODE }}

{% trans "name" %}
{% trans "login" %}

it works well and translates correctly on my computer and heroku.

later, i execute the command

django-admin makemessages -l zh_hant

, then msgid "login" was added to django.po, and I changed msgstr "名稱" to msgstr "名字"

/locale/zh_hant/LC_MESSAGES/django.po

#: lib/templates/langs/index.html:8
msgid "login"
msgstr "登入"

#: lib/templates/langs/index.html:7
msgid "name"
msgstr "名字"

#: myShopCar/settings.py:211
msgid "German"
msgstr "德文"

#: myShopCar/settings.py:212
msgid "English"
msgstr "英文"

#: myShopCar/settings.py:213
msgid "Tranditional Chinese"
msgstr "繁體中文"

#: myShopCar/settings.py:214
msgid "Simplied Chinese"
msgstr "簡體中文"

it also works well on my computer.

on my computer

then i deployed my application to heroku, but it doesn't works correctly on heroku this time.

heroku

it seems that heroku did not reload the new .mo file after new deploy.

Is there anything I lost? thank you for your help...

Upvotes: 0

Views: 138

Answers (1)

tina
tina

Reputation: 1

I have the same issue with you. If you rename the locale folder from zh_hant to zh_Hant It should be work!

Upvotes: 0

Related Questions