简体   繁体   English

Django国际化和本地化性能有何不同?

[英]Django internationalization and localization performance difference?

Regarding setting Django's USE_I18N = False in settings.py the documentation say: 关于在settings.py中设置Django的USE_I18N = False ,文档说:

A boolean that specifies whether Django's internationalization system should be enabled. 一个布尔值,指定是否应启用Django的国际化系统。 This provides an easy way to turn it off, for performance. 这提供了一种将其关闭以提高性能的简便方法。

and: 和:

If you don't use internationalization, you should take the two seconds to set USE_I18N = False in your settings file. 如果不使用国际化,则应花两秒钟在设置文件中设置USE_I18N = False。

This makes it sound like a big deal. 这听起来很重要。 Can anybody give me some information on how much performance I'm really gaining by turning it off until I need it? 有人能给我一些有关我将其关闭直到真正需要时真正获得的性能的信息吗?

It's not a big deal. 没什么大不了的。 The only real change affects the *gettext family of functions available in the django.utils.translation package. 唯一真正的变化会影响django.utils.translation包中可用的* gettext系列功能。 If you set USE_I18N=False then Django will replace these functions with a faster implementation that doesn't actually try to translate the text. 如果您将USE_I18N = False设置为False,那么Django将以更快的实现方式替换这些功能,而该实现方式实际上并不尝试翻译文本。 If you're not using any of the Django translation utils then it shouldn't matter one way or the other. 如果您不使用任何Django翻译工具,那么无论哪种方式都没有关系。 Even if you are using these functions, they're fast enough that any performance gains will be imperceptible. 即使您使用这些功能,它们的速度也足够快,以至于看不到任何性能提升。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM