Even after you rerun these commands?

python manage.py makemessages -l zh_Hant

python manage.py compilemessages


On Fri, Mar 22, 2019 at 11:41 AM ANi <afji2...@gmail.com> wrote:

> Oh yes, thank you, Aldian.
> But it doesn't work, either. :-\
>
>
> Aldian Fazrihady於 2019年3月22日星期五 UTC+8上午11時20分54秒寫道:
>>
>> Hi ANi,
>>
>> I think the settings should you lower case letter like this:
>>
>> LANGUAGE = [
>>  ('en-us', 'English'),
>>  ('zh-hant','繁體中文'),
>> ]
>>
>> LANGUAGE_CODE = 'zh-hant'
>>
>> And the locale folder should use underscore instead of dash, and use
>> uppercase 'H', like this:
>> - locale
>>          - zh_Hant
>>
>> Regards,
>>
>> Aldian Fazrihady
>> https://www.aldianfazrihady.com/
>>
>> On Fri, Mar 22, 2019 at 11:12 AM ANi <afji...@gmail.com> wrote:
>>
>>> Hello.
>>> The only word that has been translated is "name", but it seems that it
>>> is the default one in Django.
>>> So basically my translation does not work at all..........
>>> please help
>>>
>>> Here is what I've done so far...
>>>
>>> settings.py
>>> MIDDLEWARE = [
>>>  ...
>>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>>  'django.middleware.locale.LocaleMiddleware',
>>>  ...
>>> ]
>>>
>>>
>>> LANGUAGE = [
>>>  ('en-us', 'English'),
>>>  ('zh-Hant','繁體中文'),
>>> ]
>>>
>>>
>>> LANGUAGE_CODE = 'zh-Hant'
>>>
>>>
>>> USE_I18N = True
>>>
>>> USE_L10N = True
>>>
>>> ...
>>>
>>>
>>> LANGUAGE_PATHS = os.path.join(BASE_DIR, "locale")
>>>
>>>
>>> part of django.po
>>>
>>> #: .\main\models\center.py:43 .\main\models\company.py:18
>>> #: .\main\models\company.py:33 .\main\models\log.py:70
>>> #: .\main\models\select.py:17 .\main\models\select.py:33
>>> #: .\main\models\item.py:95 .\templates\main\main.html:11
>>> msgid "name"
>>> msgstr "名稱"
>>>
>>>
>>> #: .\main\models\item.py:98 .\templates\main\main.html:13
>>> msgid "value"
>>> msgstr "價值"
>>>
>>>
>>> #: .\main\models\item.py:102 .\main\models\log.py:98
>>> msgid "currency"
>>> msgstr "幣別"
>>>
>>>
>>>
>>> part of main.html
>>> {% load static %}
>>> {% load filters %}
>>> {% load i18n %}
>>> {% block container %}
>>>  <table id="asset-table" class="tablesorter-header-inne
>>> tablesorter-dropbox">
>>>  <thead>
>>>  <tr>
>>>  <th field="name" align="right" sortable="true">{% trans 'name' %}</th>
>>>  <th field="value" align="right" sortable="true">{% tans 'value' %}</th>
>>>  ...
>>>
>>>
>>> part of item.py
>>> from django.utils.translation import gettext_lazy as _
>>> ...
>>>
>>> class Asset(models.Model):
>>>      name = models.CharField(_('name'), max_length=255)
>>>      value = models.IntegerField(_('value'))
>>>      currency = models.ForeignKey(Currency,
>>>                                   null=True,
>>>                                   on_delete=models.SET_NULL,
>>>                                    verbose_name=_('currency'))
>>>      ...
>>>
>>> filte structure
>>> myproject
>>>      - main_app
>>>      - common-statics
>>>      - templates
>>>      - myproject
>>>      - locale
>>>          - zh-hant
>>>            -LC_MESSAGES
>>>              - django.mo
>>>              - django.po
>>>
>>>
>>> thanks!
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/d981053e-29d9-4d6b-943f-04d04b735cf9%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/d981053e-29d9-4d6b-943f-04d04b735cf9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fe9682be-358a-433b-af3a-ba8e6e3afd12%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/fe9682be-358a-433b-af3a-ba8e6e3afd12%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN7EoAbzZap_1iq-GtRL3BPdqgvMTWu175He%2BPA4r4zDiZ3RBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to