How to localize Content of a Django application

后端 未结 9 1815
暖寄归人
暖寄归人 2020-12-24 09:16

Hey, i am currently working on a django app for my studies, and came to the point of l18n. Localizing the site itself was very easy, but now i have to allow users, to transl

9条回答
  •  误落风尘
    2020-12-24 10:08

    "i must provide a way of translating theses names and descriptions to the users."

    "Is there a natural way in django to do this?"

    Are you asking if Django can translate from language to language? Are you asking about something like http://translate.google.com/ ?

    I don't think Django can translate user input into another language.

    If you are going to do the translation for your users, this must be part of your data model.

    Django's i18n filter allows you to have a table of translation strings. The documentation says this.

    1. Embed translation strings in your Python code and templates.
    2. Get translations for those strings, in whichever languages you want to support. This is something you do manually, by hiring translators or knowing a lot of languages yourself.
    3. Activate the locale middleware in your Django settings.

提交回复
热议问题