[Answered ]-Can't get Django localization to work

1👍

Windows uses different locale IDs. The following should work (obtained from the table on Microsoft’s site):

In [15]: locale.setlocale(locale.LC_ALL, 'Portuguese_Brazil')
Out[15]: 'Portuguese_Brazil.1252'
👤ars

1👍

According to Django Track, INPUT_FORMATS setting is ignored if USE_L10N is set to True.

👤powlo

0👍

Maybe a bit OT, but I wanted to add my view on web translation.

I strongly recommend using Bablic. It’s a completely client-side approach to translation. They track the strings that are displayed on your site, build the “dictionary”, and notify you of new or untranslated text. They can also integrated with cloud based translation providers so that even newly submitted content will be translated almost immediately without need for you tracking or making any updates to the server-side code or configuration.

I love it that you don’t need to do the whole collect-strings->send-mo-file-to-translators->compile->deploy->debug->repeat. And as a web-dev this solution has zero friction on my end.

0👍

In some cases is not enable on server and you need run this command to enable locale (in my server Ubuntu example)

sudo locale-gen pt_BR

And then run

python -c "import locale; locale.setlocale(locale.LC_ALL, 'pt_BR')"
👤Jones

Leave a comment