开发者

Django.po with Korean Symbols

开发者 https://www.devze.com 2023-03-09 18:29 出处:网络
I have a question regarding Django i18n and the django.po file. I am new to i18n so please excuse my noobness.

I have a question regarding Django i18n and the django.po file.

I am new to i18n so please excuse my noobness.

I am using the Google Tranlator Toolkit to upload a text file of English words and phrases.

In this case I am converting to Korean.

Here is a sample of four words:

Gender

Date of Birth

Country

City / Town

Here is the output on-screen:

성별

생일

국가

도시

When I click save it saves to a text file.

My questions is is it OK to use the Korean symbols direct into my django.po file?

Everything is working OK in my application so far.

Looking at 开发者_如何学编程the django/contrib/auth/local/ko/LC_MESSAGES/django.po

file I can see it's using a format like:

msgid "Password"

msgstr "비밀번호"

So far it seems to work OK saving the symbols I have

but I'm just wondering if this is the corect way to do this.

So far I'm intending to use google to translate my English

into various languages and then I'll save them each

to their respective django.po file.

Any tips or advise much appreciated.

Thanks!


Good question!

I'm doing the same for my translation into portuguese, but I'm also, not quite sure, if it's the best way to achieve this.

Be careful if you aren't doing the translation manually but using this command

django-admin.py makemessages -l de

every time you update the file, check if everything is correct, because it can do associations, for instance I've writen:

first template:

pt = 'maça e cenoura'

second template:

pt = 'maça e cereja'

doing the automatic translation, it will assume both are equal strings, which they aren't.
I'm not able to explain why, because I don't know why this happen.

A solution could be to use a string 'X' and translate to both languages the text.

msgid = 'X'
pt = 'maça e cenoura'
en = 'apple and carrot' #different files (just as example, I put them together)

But like I told you, I'm also just starting using this feature


python manage.py makemessages -l ko output django.po default is ansi format,

you must convert it to utf-8 to allow non-ansi chars in it.

0

精彩评论

暂无评论...
验证码 换一张
取 消