But the browsers' language settings can be misleading in some cases.
I thought restricting the LANGUAGES will do, and add the following
lines to my settings, as suggested in the documentation:
gettext_noop = lambda s: s
LANGUAGES = (
('tr', gettext_noop('Turkish')),
)
but this doesn't solve the issue. Now I cannot get the translation
even when 'Turkish' is added to my browsers list of accepted
languages.
Thanks for any suggestions...
oMat
On Mon, Feb 26, 2007 at 01:14:11PM -0000, omat * gezgin.com wrote:
> but this doesn't solve the issue. Now I cannot get the translation
> even when 'Turkish' is added to my browsers list of accepted
> languages.
1. Which version of Django?
2. Where are you trying to see the translation? Admin, or your
application?
With kind regards,
--
Baurzhan Ismagulov
http://www.kz-easy.com/
revision 4608 form svn
> 2. Where are you trying to see the translation? Admin, or your
> application?
my application
Thanks...
Do I understand correctly that you want to have your application in
Turkish only? If so, what is the problem with writing all texts in
Turkish and not using the i18n infrastructure at all?
This is a generic application to handle user registration tasks and I
want to use it on other installations which will be requiring
internationalization.
Another thing, I don't want to hard code messages like form validation
errors.
Thanks,
oMat
I had this problem on my site. I don't know if it's a bug or not but I
managed to make it work by choosing English as a default language and
Russian (in my case) as a translation. As I understand, with gettext you
can't have exactly one language because it has separate concepts of a
default language and translations.
To me, It sounds like a bug on Django side.
How did you solve your problem? Did you define the languages in the
setting file like:
LANGUAGES = (
('ru', 'Russian'),
('en', 'English'),
)
Does the order matter?
oMat
I haven't tested this, but it seems that you need to list both 'en' and
'tr' in LANGUAGES and set LANGUAGE_CODE to 'tr'. If all mechanisms in
django/utils/translation/trans_real.py:get_language_from_request fail,
the user should get Turkish.
I feel like limiting the language options with overriding the
LANGUAGES list should do, but I couldn't.
If there is a way to override the precedence of language
determination, this will also do, but I don't think there is.
Thanks,
oMat
* Write messages in Turkish and provide an English translation for the
projects that need it, but not for this one (untested).
* Hack this specific django installation to always return LANGUAGE_CODE
in get_language_from_request. I've tested this, it works. A better way
would be to use smth. like FORCE_LANGUAGE if set, otherwise fall back
to the stuff django does now. Then you can use the same django
installation for different projects.
> * Write messages in Turkish and provide an English translation for the
> projects that need it, but not for this one (untested).
This would be an interesting hack but there already exists a Turkish
translation. Reversing it would be a burden. Also, it wouldn't solve
the case for preset messages like form validation error messages.
> * Hack this specific django installation to always return LANGUAGE_CODE
> in get_language_from_request. I've tested this, it works. A better way
Maintenance nightmares
> would be to use smth. like FORCE_LANGUAGE if set, otherwise fall back
> to the stuff django does now. Then you can use the same django
> installation for different projects.
I agree. It would be great to have an option in the settings file. I
posted thşs suggestion in the on-going discussion on the upcoming
django release:
http://groups.google.com/group/django-users/browse_thread/thread/287912177d469a64
Thanks,
oMat