How to localize Content of a Django application

后端 未结 9 1813
暖寄归人
暖寄归人 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:06

    I think you should operate in two steps:

    1. Get translations
    2. Show translated strings

    For the first step, you should tell Django that the user-inserted strings are to be translated. I think there is no native way to do so. Maybe you can extract the strings from your db putting them in locale-specific files, run 'makemessages' on them, obtaint django.po files and translate.

    Second, use ugettext to show those strings on your web application.

    Hope this can help the ones with your same problem.

提交回复
热议问题