Changeset 848
- Timestamp:
- 10/12/05 06:48:27 (3 years ago)
- Files:
-
- django/branches/i18n/django/conf/locale/pt_BR (moved) (moved from django/branches/i18n/django/conf/locale/pt-br)
- django/branches/i18n/django/utils/translation.py (modified) (2 diffs)
- django/branches/i18n/docs/translation.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/i18n/django/utils/translation.py
r841 r848 272 272 lang = el 273 273 order = 100 274 if lang.find('-') >= 0: 275 (lang, sublang) = lang.split('-') 276 lang = lang.lower() + '_' + sublang.upper() 274 277 return (lang, order) 275 278 … … 280 283 281 284 for lang, order in langs: 282 if lang == 'en' or os.path.isfile(os.path.join(globalpath, lang, 'LC_MESSAGES', 'django.mo')):285 if lang == 'en' or lang.startswith('en_') or gettext_module.find('django', globalpath, [lang]): 283 286 _accepted[accept] = lang 284 287 return lang 285 elif lang.find('-') >= 0:286 (lang, sublang) = lang.split('-', 1)287 if lang == 'en' or os.path.isfile(os.path.join(globalpath, lang, 'LC_MESSAGES', 'django.mo')):288 _accepted[accept] = lang289 return lang290 288 291 289 return settings.LANGUAGE_CODE django/branches/i18n/docs/translation.txt
r840 r848 180 180 will be used as the language code. If the session doesn't contain a language 181 181 setting, the middleware will look at the cookies for a django_language cookie. 182 If that is found, it gives the language code. If neither the session nor the 183 cookie carry a language code, the middleware will look at the HTTP header 184 Accept-Language. This header is sent by your browser and tells the server what 185 languages you prefer. Languages are ordered by some choice value - the higher, 186 the more you prefer the language. 182 If that is found, it gives the language code. 183 184 The format for the explicit django_language parameters is allways the 185 locale to use - for example it's pt_BR for Brazilian. If a base language 186 is available, but the sublanguage specified is not, the base language is used. 187 For example if you specify de_AT (Austrian German), but there is only a 188 language de available, that language is used. 189 190 If neither the session nor the cookie carry a language code, the middleware 191 will look at the HTTP header Accept-Language. This header is sent by your 192 browser and tells the server what languages you prefer. Languages are ordered 193 by some choice value - the higher, the more you prefer the language. 187 194 188 195 So the middleware will iterate over that header, ordered by the preference … … 231 238 tools like recode or iconv to change the charset of the file and then change 232 239 the charset definition in the file (it's in the Content-Type: line). 240 241 The language code for storage is in locale format - so it is pt_BR for 242 Brazilian or de_AT for Austrian German. 233 243 234 244 Every message in the message file is of the same format. One line is the msgid.
