all, I'm attempting to create a multi-lingual website which must support (among others) both US-English and UK-English.
My settings contains:
LANGUAGES = (
('de', u'Deutsch'),
('en_GB', u'English (UK)'),
('en', u'English (US)'),
('es', u'Español'),
('fr', u'Français'),
('pt', u'Português'),
)
All of the other languages are all working fine; the user can switch languages and things work well. The problem is en_GB.
I've tried changing the above configuration to 'en-GB', 'en-gb or 'en_gb' with no change in behavior.
It would appear that the middleware only supports the first two letters for language pathing? How can I properly support multiple dialects of the base language? This could easily be es-US, es-MX, es-ES or fr-FR, fr-CA or de-DE, de-AT, de-CH, etc.
I'm using Django-CMS 2.3.5 (which is the latest production release as of this writing) on Django 1.4.5 on Python 2.7.2.
UPDATE: I appear to now have it working. I think there were two things that were preventing progress for me. 1) when it comes to English, it is probably best to not have one as 'en' and another as 'en-gb'. 2) in all my experimenting, I suspect I had messed up Django-CMS' records in the DB. Deleting all my pages and starting over seems to have fixed this (NOTE: This would suck in a production environment even more than it does here!)
In the end, I've found these settings to work for me:
LANGUAGE_CODE = 'en-us'
LANGUAGES = (
('en-us', u'English (US)'),
('de', u'Deutsch'),
('en-gb', u'English (UK)'),
('es', u'Español'),
('fr', u'Français'),
('pt', u'Português'),
)
CMS_LANGUAGES = LANGUAGES
CMS_LANGUAGE_CONF = {
'de': ['en-gb', 'en-us', 'fr', 'es', 'pt'],
'en-gb': ['en-us', 'fr', 'es', 'de', 'pt'],
'en-us': ['en-gb', 'fr', 'es', 'de', 'pt'],
'es': ['pt', 'fr', 'en-gb', 'en-us', 'de'],
'fr': ['es', 'pt', 'en-gb', 'en-us', 'de'],
'pt': ['es', 'fr', 'en-gb', 'en-us', 'de'],
}
CMS_HIDE_UNTRANSLATED = False
Also, apparently Django-CMS' template tag page_language_url will only return lower-case language path elements, so en_GB/en-GB may work on one level, but the UI will fail to match the selected language because of this.
Django I18N Docs explain two codes as shown below. en_GB is the Great Britain (UK) locale. en-CA is English as spoken in Canada.
LANGUAGES = (
('en-us', u'English (US)'),
('de', u'Deutsch'),
('en-gb', u'English (UK)'),
('es', u'Español'),
('fr', u'Français'),
('pt', u'Português'),
)
LANGUAGE_CODE = 'en-us'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With