Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Locale Manager Configuration: locale_beans.xml

The locale manager is highly configurable. The locale manager is setup such that it'll take a variable number of preferences and one resolution logic. To add preferences to the locale manager, one has to implement ILocalePreferenceProvider. Once you have the provider, you can just add it to the list on the configuration XML file.

<property name="localePreferenceProviders">
    <list>
        <ref bean="userLocalePreferenceProvider" />
        <ref bean="/uP2Context/browserLocalePreferenceProvider" />
        <ref bean="systemLocalePreferenceProvider" />
        <ref bean="localeListPreferenceProvider" />
    </list>
</property>

The resolution logic for the locale manager is swappable. The current resolution logic is best match. It will try to find an exact locale match from the list of available locales, if it cannot find an exact match it will try to find a language match. If one prefer to use a different resolution logic, just implement ILocaleResolutionProvider.

<property name="localeResolutionProvider">
    <bean class="org.jasig.portal.i18n.MatchLocaleResolutionProvider" />
</property>

List Preference Provider

For flexibility, we have a list preference provider that allows the admin to set a list of locale preferences.

<bean id="localeListPreferenceProvider" class="org.jasig.portal.i18n.LocaleListPreferenceProvider">
    <property name="localePreferences">
        <list>
            <value>en_US</value>
            <value>en</value>
            <value>fr_CA</value>
        </list>
    </property>
</bean>
  • No labels