Lazy translations

Django includes lazy versions for all of its translation functions, which have the suffix _lazy(). When using the lazy functions, strings are translated when the value is accessed, rather than when the function is called (this is why they are translated lazily). The lazy translation functions come in handy when strings marked for translation are in paths that are executed when modules are loaded.

Using gettext_lazy() instead of gettext(), strings are translated when the value is accessed rather than when the function is called. Django offers a lazy version for all translation functions.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset