Previous Page Next Page

Q&A

Q.Is there a way to add translations to JavaScript in the templates?
A.Yes. Django provides a javascript_catalog view that outputs a JavaScript code library with functions that mimic the gettext interface as well as translation strings. You can use the javascript_catalog view to dynamically generate translated JavaScript to use in your views.
Q.Is there a way to restrict the languages that can be used on the website?
A.Yes. You can specify a subset of languages in the LANGUAGES setting of the settings.py file. For example, the following setting restricts the languages to English and Spanish:
LANGUAGES = (
    ('en', 'English'),
    ('es', 'Spanish'),
)

Q.Is there a way to turn off internationalization if I don't need it?
A.Yes. If you do not need internationalization, you can turn it off by setting USE_I18N to False in the settings.py file:
USE_I18N=False

Previous Page Next Page