Questions tagged [django-i18n]
Django internationalization provides developers with the ability to build web applications and provide content in multiple languages and locales.
297
questions
0
votes
1answer
29 views
How to make strings from my database show up in my localisation .po file in Django?
in one of my python projects, I'm looping through a list of countries which is stored in my SQLite database:
{% if europe %}
{% for country in europe %}
...
0
votes
2answers
17 views
Translation key-based internationalization with Django
Django's default i18n system uses the code language (for instance, English) as translation keys; translations into other languages must be written from that base language. For instance, in a Django ...
0
votes
0answers
15 views
How to deal with Django translations / .po-files?
We have lot of problem in a project I'm working on now, regarding the texts. What we have now is a generated -po-file (committed in git) and one of the administrators of the site changes this file on ...
0
votes
0answers
11 views
Django makemessages on third-party iframe?
I'm using a third-party library, and I'd like to translate the text on some of the iframes provided by the library on my website.
I can't use makemessages to generate the correct phrases in the .po ...
0
votes
1answer
60 views
Wagtail not redirecting. 500 error instead of 404 when DEBUG = False
The guy here already asked about this and solved it by deleting 500.html and 404.html.
Same for me, when DEBUG is True everything works as expected: Wagtail redirects / to /en, on non-existing pages ...
0
votes
0answers
18 views
django-modeltranslation: Why to I have 3 columns for two translations in database
Here is the relevant section of my settings.py
LANGUAGE_CODE = "de"
gettext = lambda s: s
LANGUAGES = [
("de", gettext("German")),
("en", gettext(&...
1
vote
1answer
19 views
How do I add a breakpoint to a JavaScriptCatalog view?
As per the documentation for JavaScriptCatalog, I added the following lines to the urlpatterns in one of my Django apps:
from django.views.i18n import JavaScriptCatalog
from django.conf.urls import ...
0
votes
1answer
97 views
Django Translations only partially working
I've done makemessages and compilemessages and both files contain the translation that is inside a {% blocktranslate %}. I've even re-run makemessages to make sure nothing changed in the msgid and it ...
0
votes
1answer
136 views
Django Locale not working after deploying to server [ FIXED ]
when i test it locally the translations do worked, but when I deploy it on a server it doesn't work.
Some of the words do get translated but it's not from my locale, it's django's default translation.
...
0
votes
1answer
31 views
Django not picking up overridden translation for third-party applications
I have a third-party application installed which has translation tags in its templates and also provides translations for those in several languages, but I'd like to change a few translations for only ...
0
votes
0answers
37 views
How to add part of the path before the language code for django translate i18n
How to add part of the path before the language code for django i18n_patterns ?
Example:
my project is located at:
http://domain.site/sub/admin/
When changing the language, a redirect to http://domain....
0
votes
0answers
12 views
Django compilemessages doesn't work with some uft-8 characters
I'm setting up internationalization in a Django project using i18n. In /landing/locale/es/LC_MESSAGES, I created a po file with phrases and started python manage.py compilemessages, it worked fine, ...
0
votes
1answer
32 views
Django Form ignores translation and falls back to default
I have recently introduced translation (i18n) to my django app.
It works fine for all templates and error messages.
Not for forms unfortunately. It always falls back to English, even if the rest of ...
0
votes
0answers
30 views
Django LocaleMiddleware only works for LANGUAGE_CODE language
My goal is to have the following:
www.example.com/en provides an English website
www.example.com/de provides a German website
I am using Django 3.1 for this.
My settings.py contains the following:
...
0
votes
0answers
22 views
Why error 500 raise when I use domain.com instead of domain.com/en/ in Django i18n?
I added a second language to my Django project and when in Debug=False mode I enter domain.com I get ERROR 500 but domain.com/en/ works perfectly.
In Debug=True there is no error.
My i18n settings:
...
0
votes
0answers
25 views
DJANGO POST GET not working after i18n translation
I have multiple POST requests from my template for example:
$.ajax({
url: '/apply_payment',
type: 'POST',
data: {
basket: JSON.stringify(basket),
key: $(...
0
votes
1answer
63 views
Django URL translation dependent on URL prefix language code
I am trying to internationalize a Django dictionary application using the Django translation system. I have successfully translated most of the content on the site but I am having problems translating ...
0
votes
0answers
19 views
Localization with i18n in js
I am trying to auto translate the text portion of the following to extend portion with the help of i18n. Nothing is changing and i18n doesn't have native Japanese support .
if (defaultButtons.includes(...
0
votes
1answer
39 views
How to serve different CSS file when user change language in Django i18n translation
I am using Django i18n translation system and there are two languages:
LANGUAGES = (
('fa', _('Persian')),
('en', _('English')),
)
Persian is Right-To-Left and I want to serve another CSS ...
0
votes
1answer
29 views
Django activate translations project wide instead of per view?
I have a Django project where I activate the translations based on the Accept-Language header on each and every view as follows,
from django.utils import translation
translation.activate(request....
0
votes
0answers
24 views
How do I translate a PlaceholderField in Django CMS?
I would like to know how to translate text in a PlaceholderField in Django CMS.
I have a model with a PlaceholderField. I want the cms user to be able to add images beneath a paragraph (can't do this ...
0
votes
1answer
44 views
When I change the language of the website, the slug is not translated causing a 404 error
I'm new programming with Django. I'm currently using version 2.2 for my first project.
So far it's going well, my website consists of a landing page with a product catalog which has to work in two ...
0
votes
0answers
18 views
Getting Django models help_texts in a React App
I'm building a SPA with Django / DRF for the backend and React / material-ui for the frontend.
I'm using Django models help_texts in the DRF APIs. Some directly from the models, others overrided in ...
0
votes
1answer
43 views
Django Internationalization gives Internal Error when Debug is False Only when 500.html is present
Please I am in need of your Help here. I enable Django Internationalization in my app, and it works fine even when debug is False. But recently i tried providing 500.html and 404.html for my server ...
0
votes
0answers
50 views
Django: passing a translated variable to Ajax does not work
I have a number of constants as a list of dicts, with the verbose names of these variables translated using pgettext_lazy (these are translated in their respective django.po and django.mo files):
...
0
votes
0answers
26 views
Django allauth - login now working after i18n implementation
Without making any change on the login code and just by implementing i18n on the whole application, my login forms stopped working. I can see the form in the template, I can fill the input, but either ...
0
votes
0answers
14 views
Django makemessages i18n MemoryError
I am trying to run the makemessages command on server with Django, but every time get a MemoryError message after some five minutes. Can you have an idea what is going wrong? Here is my traceback:
...
0
votes
1answer
20 views
How to change a users language from admin site in Django?
I'm implementing Django's I18N to translate a project and works really smooth. The thing is that I'm working on someone else's project and there was a field in the users profile named "language" which ...
0
votes
1answer
31 views
Set language of PasswordResetForm in Django?
I am manually resetting passwords but wonder how to set the language to the user's language instead of my own. I see there are many extra context fields but which one needs to be set?
for user in qs:
...
1
vote
1answer
76 views
trans And Translate Not Working On Any Pages
Im copying Django Templates straight from Git and pasting them into overridden templates in my project (so there are no syntax errors), but I get this error message on every page that uses translate ...
0
votes
1answer
40 views
NoReverseMatch with unittest
So it's time to ask my first stupid question.
There are two simple identical tests:
def test_home_page_status_code(self):
response = self.client.get('/en/')
self.assertEquals(...
0
votes
1answer
93 views
A 404 error if slug begins with āid-ā on multilingual website with Indonesian language in Django 3.0
http://example.com/de/id-button/ - 200 OK
http://example.com/id/id-button/ - 200 OK
http://example.com/any-other-slug/ - 200 OK
http://example.com/id-button/ - 404 error:
Using the URLconf defined ...
0
votes
1answer
16 views
django + chart.js: page language switch button mess up the charts. What?
I am having a super strange issue in my django app that renders graphs with chart js. I used i18n to handle the translation but after spending hours trying to fix my charts, I found out that when ...
1
vote
0answers
186 views
Django 3 set django_language cookie
In my application the user can store the preferred language. After selecting the language this is stored in the user model an I set the session variables like this:
current_user = request.user
...
0
votes
1answer
32 views
Django specific language for each user is not respected
I need to change the default language for each user, but in my case the translation is not applied with the selected language. I store the preferred language for each user and set it as follows:
# ...
0
votes
2answers
67 views
Django I18n - issues with translating in Python code
I decided to add an English translation to my Russian language website. I decided to start with translating strings in my Python code. This is how I tried to do it:
(project name)/settings.py:
...
0
votes
0answers
67 views
Django i18n: Django translation file with optional arguments
Is it possible to mark an argument as optional within my .po files?
msgid "searchpage_seo_title_%(location)s_%(price)s"
msgstr "My special title %(location)s - without using the price argument"
If I ...
0
votes
0answers
12 views
make ugettext/ugettext_lazy to mark messages for translation in a list
I have a lot (a Lot) of lists that should be marked for translation in django.
Instead of wrapping each element of a list into _(...) I thought I could pass an entire list to a function that would ...
0
votes
0answers
44 views
Django, internationalization and localization. How to translate dynamic content in the best possible way?
I have a news tab on my website. News is parsed from another site, so I can't translate all this content manually in my django.po file. So how can I do it in some other way?
Also, i want to use ...
0
votes
1answer
156 views
Django translation returns page not found (404) for all secondary languages
I am using Django 3.0.4. I am trying to setup multiple languages in my project but for some reason only the default language is accessible.
Here's my setup:
settings.py:
MIDDLEWARE = [
...
'...
2
votes
2answers
80 views
filters inside django trans tag : first translates then applies filters; unlike other tags
I encountered a weird behavior from django trans tag. As you know whenever we use a filter inside a tag, the filter first applies and then gives the result as input to the tag. But this is in reverse ...
1
vote
3answers
427 views
Django DateTimeField received a naive datetime while time zone support is active
I'm using Django 2.2
In my application, timezone support is enabled by USE_TZ=True in the settings file.
I have models with DateTime field created.
I need to filter data based on the date. The date ...
0
votes
0answers
20 views
Use Django's I18n functions with keys in the code instead of default English
Is there a way to use Django's I18n features with keys in the code instead of storing the default language in the code and the others in .po/.mo files?
Something similar to Wikipedia, where the code ...
0
votes
1answer
98 views
Django i18n translations not working in production (Heroku)
My translations are working locally, but in production at Heroku, my site remains in its default language (English) after changing the language.
These are in my settings.py file:
BASE_DIR = os.path....
0
votes
0answers
42 views
How to set the default language for all users or browsers
There are two working versions of the translation on the site - Russian and English using i18n. How to make sure that everyone has a website loaded in Russian and then, at the request of the user, he ...
1
vote
0answers
73 views
During AJAX call of POST method converted to GET method when using with Django i18n pattern
I have used Django i18n pattern in my project to convert my website text between english and german.
I have handled all post methods with common code written in webbase.js file.
After ...
0
votes
1answer
304 views
'utility_tags' is not a registered tag library
While I was applying the i18n translation library to my project, I faced the following error:
django.template.exceptions.TemplateSyntaxError: 'utility_tags' is not a registered tag library.
But I ...
0
votes
1answer
28 views
How to activate translation for all management commands by default?
I need translation to be activated in all of my django management commands by default. Currently I'm putting this line of code in all my management commands:
translation.activate(settings....
0
votes
1answer
127 views
Django trans template tag only displaying placeholder constant string
I have the following tag in templates/home.html:
{% trans "test" %}
Which always prints "test" no matter the language I choose. I know for a fact that the language changes because I print it like ...
0
votes
1answer
39 views
How do I fix this error in my Django settings.py?
I am trying to make some translations using the i18n. I have imported some libraries in my TEMPLATES in the setting.py file.
The problem is that if I import django.core.context_processors.i18n my ...