开发者

Can i use an other language instead of english for default django translation

Can I use another language instead of english(say, french) for default django translation.

For example, instead for doing this:

messages.error(request, _('My message in english'))

I do this:

messages.error(request, _('Mon 开发者_StackOverflow中文版message en francais'))


Yeah, you could do that, and it would mostly work, but better would be to write them in English and then provide French translations (via the standard i18n approach), and to set the project's LANGUAGE_CODE to 'fr' as well.

That way, your code will be more easily reusable in other languages, and - perhaps more usefully to you if you're not worried about that - you'll be able to cleanly use French/other language translations already available in any third-party apps you want to add to your site, else you'll be mixing what Django thinks is default English (but is French) and thinks is French (and is French)

Allez! ;o)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜