I think this should be pretty simple/straight forward, but it's not. I want to support many languages for my project. I followed a few tutorials and read the doc about it. I think I'm doing everything ok, but I'm still not able to get my text translated. I have two languages, "fr" and "en". "fr" in the default one and "en" requires a translation file.
My project filters contains these folders - templates - locale - vielfaltig (project name) - apps
In my template index.html:
Generated my locale file at the root of my project
Translated text in generated django.po:
In my settings.py:
Go to my site root on localhost:8000 and getting:
When I should get the translated text since I set the language code to "en" in the settings. I checked and the language code for the thread is really "en" but my template doesn't get translated.. qhand am I doing wrong ?
Info on my environment: - Using django-stack 1.5 by Bitnami - Python 2.7.3 - Django 1.5 - Mac osx 10.6 - Testing done with Chrome
Got it working. Don't know how... I restarted my shell and tried a few times things I already tried. Maybe a cache problem somehow somewhere. I hate when this happens, but I'm glad I can continue to work now!
answered 02 May, 16:22
I am new to django, I am working multilingual website...I built sample website based on your steps/guidelines. I was not able to see the text in english even after restarting the shell. could you please provide me your code snippets. I am not sure where I am going wrong.
your help is appreciated
answered 03 May, 02:11
it should be like all languages that you provide in your settings.py
and based on your browser envr language settings django site will be shown in that langauge
answered 03 May, 03:01
I have set language code still I am unable to see text in English, could you please provide me detail steps you followed or sample website code which will help me in setting up multilingual site.
your help is much appreciated.
answered 03 May, 03:42
I'd be glad to help, unfortunately I don't know what went wrong on my side as my code finally worked. Maybe if you post some code I can help you better. I started with this turorial which helped me a lot. After, I followed Django trunk documentation on Translations.
Know that the only thing I added to my setting.py is the LOCALE_PATHS. I tried to add LANGUAGES setting once but it didn't change anything to my problem and it didn't do any bad not to have it once I, so I removed it for now. Notice also that I put under comment the line for "LocaleMiddleware" in MIDDLE_WARE_CLASSES because if it is enabled, Django will ignore the LANGUAGE_CODE setting and will take the language set in browser all the time so you won't be able to switch easily between languages for testing.
Hope this helps,
answered 03 May, 10:05