If you don’t consider the website style and layout issues of each country, when creating a table that needs to be changed frequently, there will be one Chinese field and one English field. If you don’t need to change it frequently, you can directly create the configuration file in the program
If you consider issues such as style and layout, build different front-end projects
I agree, you can consider using i18n, and then write the parts that need to be translated in the locale. For details, you can refer to the sandbox of django-oscar
Check it out: django internationalization and localization You can also implement it yourself. General principle: 1. Construct a language corresponding dictionary, for example: lan = {
} 2. There is a global parameter in the project to indicate which language is currently used: cn en xx 3. In py and html (django template), the corresponding content is obtained through the above dictionary. It's more troublesome in js: I thought before that I would put the text (translated) that needs to be displayed in js into the shadow form in html, and then get it in html when js is loaded.
I don’t know if I misunderstood your needs. Shouldn’t it be saved in English and then internationalized?
The database is one, and the places on the page that need to be translated are i18n
If you don’t consider the website style and layout issues of each country, when creating a table that needs to be changed frequently, there will be one Chinese field and one English field. If you don’t need to change it frequently, you can directly create the configuration file in the program
If you consider issues such as style and layout, build different front-end projects
For reference only
I agree, you can consider using i18n, and then write the parts that need to be translated in the locale. For details, you can refer to the sandbox of django-oscar
Check it out: django internationalization and localization
You can also implement it yourself. General principle:
1. Construct a language corresponding dictionary, for example:
lan = {
}
2. There is a global parameter in the project to indicate which language is currently used: cn en xx
3. In py and html (django template), the corresponding content is obtained through the above dictionary. It's more troublesome in js: I thought before that I would put the text (translated) that needs to be displayed in js into the shadow form in html, and then get it in html when js is loaded.