internationalization

sphinx gettext does not match textdomains in subdirectories when gettext_compact=False

sphinx gettext does not match textdomains in subdirectories when gettext_compact=False Question: I’m currently working on a complex documentation project with python sphinx. My next step is to enable internationalization. Project overview (simplified): doc build # contains sphinx build output images # contains image resources locales # gnu gettext structure (simplified) enLC_MESSAGESindex.po+mo enLC_MESSAGESarticlesconnect.po+mo deLC_MESSAGESindex.po+mo deLC_MESSAGESarticlesconnect.po+mo source …

Total answers: 2

Implementing Django language selection form as buttons

Implementing Django language selection form as buttons Question: I would like to implement the django language selection as a series of buttons, rather than a dropdown select based form. I’ve tried to do this by adding submit, formaction and value attributes to the button, but it is not working correctly. What is the correct way …

Total answers: 2

Django translations does not work

Django translations does not work Question: I’m trying to get Django’s translation system to work, following the tutorial here. Here are my two views (one for direct output, one for template), neither one works. def home(request): output = _(“hello”) # (lazy) return HttpResponse(output) def with_template(request): return render(request, ‘translation_template.html’) here is the template file for the …

Total answers: 10

How to override the django admin translation?

How to override the django admin translation? Question: I’m trying to override the default translations of Django’s admin site. I’m using Django 1.6. My settings.py contains: import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # … LANGUAGE_CODE = ‘nl’ USE_I18N = True USE_L10N = True LOCALE_PATHS = (os.path.join(BASE_DIR, “locale”),) I have copied the file django/contrib/admin/locale/nl/LC_MESSAGES/django.po to my_project/locale/nl/LC_MESSAGES/django.po and …

Total answers: 1

Issue trying to change language from Django template

Issue trying to change language from Django template Question: I need to include two buttons or links to allow users change language between English and Spanish. I’ve read the docs and tried this: <form action=”/i18n/setlang/” method=”post”>{% csrf_token %} <input name=”language” type=”hidden” value=”es” /> <input type=”submit” value=”ES” /> </form> However, every time I click the button, …

Total answers: 9

universal python library for internalization and translation

universal python library for internalization and translation Question: I need to internationalize and translate python application. I look forward for some dictionary collection resides in additional resource files that could be switched runtime and used smoothly inside python code. I’ve searched stackoverflow.com for similar tools but find only platform-specific libraries, e.g. for pylons, for django …

Total answers: 3

Why would the makemessages function for Django language localization ignore html files?

Why would the makemessages function for Django language localization ignore html files? Question: I am trying to run the Django language localization on a project, but makemessages always ignores the html templates in my templates folder. I am running python manage.py makemessages -a from the project root, and all of the strings that are marked …

Total answers: 3

ugettext and ugettext_lazy

ugettext and ugettext_lazy Question: Could you explain what principal difference between ugettext and ugettext_lazy? When I’m trying to return HttpResponse(ugettext_lazy("Hello")) I see nothing, but return HttpResponse(ugettext("Hello")) is working. Why? Asked By: Igor Pochechuev || Source Answers: ugettext is used to load a translation of a string right now. ugettext_lazy returns an object that can eventually …

Total answers: 1