向django添加自定义语言 [英] adding a custom language to django

查看:143
本文介绍了向django添加自定义语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的网站翻译成欧盟的24种语言。这些包括Malti语言,没有列在django默认支持的语言中。



我想知道是否有一种方法可以将自定义语言添加到django所以它可以使用本机i18n url功能。



谢谢!

解决方案


  1. 我找到了解决方案,你必须在/ django手动添加一个文件夹/ conf / locale /您需要的语言扩展名。实际上,您可以复制过去的en(英文)文件夹,并在缺少语言(在我的情况下为mt))中命名。


  2. 在此文件夹中,您还可以编辑文件formats.py以本地化日期,数字等。


  3. 重新启动django,您的语言将被本地支持。



I'm translating my website into the 24 languages of the European Union. These include the "Malti" language, that is not listed in django default supported languages.

I would like to know if there is a way to add a custom language to django so it can work with the native i18n url function.

Thanks!

解决方案

  1. I found the solution, you have to manually add a folder in /django/conf/locale/ with the language extension you want. Actually you can just copy past the en (english) folder and name it after the missing language (in my case mt).

  2. In this folder you can also edit the file formats.py to localize the dates, numbers etc.

  3. Restart django and your language will be natively supported.

这篇关于向django添加自定义语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆