Changeset 99

Timestamp:
04/23/07 16:45:51 (5 years ago)
Author:
saimon
Message:

--Made Action Mailer rfc4646 compatible (with fallbacks ???)
--Made view picking rfc4646 compatible (with fallbacks ???)

Note: both of these introduce code that may break existing apps.

e.g. If someone was using 'he-IL' as the current locale and expected the following template to be found: views/mycontroller/test.he-IL.rhtml then with the new code, this will no longer be found and will default to:

views/mycontroller/test.he-IL.rhtml

Why? 'he-IL' is a valid rfc4646 language tag, so there's no way to know wether we're talking about old rfc3066 usage (which mixed the language and country part) or a valid rfc4646 language tag (which also describes a country variant of a particular language).

Before:
Locale.set('he-IL')

(converted internally to language => 'he', country => 'IL')

After:
Locale.set('he','IL'), the code looks for the following posibble extensions in the view (In the is order):

['he_IL', 'he', 'IL']


'he_IL' - Is the string representation of the current locale where the underscore separates the language part from the country part.

'he' -Is the language part.
'IL' -Is the country part.

Also note that: Locale.set('en-Gb','GB') would give:
['en-GB_GB','en-Gb','en','GB']

where:

'en-Gb' - Is the whole language tag (english with uk language variant).
'en' is the primary language tag part of the whole language tag.

(If fallbacks are defined then the list of possible codes includes the fallbacks as well e.g.
Locale.set('en-Gb','GB',[['en-AU','AU'],['en-NZ','NZ']]) would give:
['en-GB_GB','en-Gb','en','GB','en-AU','AU','en-NZ','NZ']
).


Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved