I wanted to post about a little problem I have while developing
multilingual site I'm working on.
I plan to include content in various languages, focusing on 3 at the
moment: English, Spanish and Portuguese.
I have followed the docs on i18n and this are working great, except for
one little detail. I'm not able to switch current language to
Portuguese(pt) language, while I can change to Brazilian
Portuguese(pt_br). I see that Portuguese(pt) locale does not exist in
the framework, but does that prevent me from using it on my site?
Below are the appropriate settings I use in settings.py:
-------------------------------------------------------
LANGUAGE_CODE = 'en'
LANGUAGES = (
#('de', 'Deutsch'),
('en', 'English'),
('es', 'Español'),
#('fr', 'Français'),
#('hu', 'Magyar'),
#('it', 'Italiano'),
#('ja', '日本語'),
#('pl', 'Polski'),
('pt', 'Português'),
#('ro', 'Română'),
#('ru', 'Руский'),
#('zh', '中文'),
)
USE_I18N = True
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
)
--------------------------------------------------------
Has anyone working on Portuguese sites encountered the same problem?
Should I use Brazilian Portuguese instead?
I'd appreciate some help with figuring out how to go about adding that
locale to my site in simplest and sensible way.
The simplest way is to produce a translation for the 'pt' locale ;)
See this for information:
http://www.djangoproject.com/documentation/i18n/#how-to-create-language-files
You might also want to check on the django-i18n mailing list to see if
anyone else is working on a 'pt' translation, and coordinate efforts.
Once the translation is ready, you can begin using it, and if you like
you can open a ticket in the Django Trac for it to have it added to
the framework.
--
"May the forces of evil become confused on the way to your house."
-- George Carlin
Thanks, James! I would do it if I spoke Portuguese :) Unfortunately, I'm
just a developer with a requirement for Portuguese translations.
Maybe I should copy 'pt_br' locale to 'pt' and when I add this language
to my project, I'll ask translators to go through the Brazilian
Portuguese .po file and make it 'Portuguese'.
Nuno Mariz
That'd be great! Looking forward to it being included in the framework!