blob: e84868c7cb7f5ae771b17a9219adf848257d6369 [file] [log] [blame]
<!-- -->
<!-- Copyright 2008 Google Inc. -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); you -->
<!-- may not use this file except in compliance with the License. You may -->
<!-- may obtain a copy of the License at -->
<!-- -->
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
<!-- -->
<!-- Unless required by applicable law or agreed to in writing, software -->
<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -->
<!-- implied. License for the specific language governing permissions and -->
<!-- limitations under the License. -->
<!-- Internationalization support. -->
<!-- -->
<module>
<!-- Browser-sensitive code should use the 'locale' client property. -->
<!-- 'default' is always defined. -->
<define-property name="locale" values="default" />
<property-provider name="locale">
<![CDATA[
try {
var locale;
// Look for the locale as a url argument
if (locale == null) {
var args = location.search;
var startLang = args.indexOf("locale=");
if (startLang >= 0) {
var language = args.substring(startLang);
var begin = language.indexOf("=") + 1;
var end = language.indexOf("&");
if (end == -1) {
end = language.length;
}
locale = language.substring(begin, end);
}
}
if (locale == null) {
// Look for the locale on the web page
locale = __gwt_getMetaProperty("locale")
}
if (locale == null) {
// Look for an override computed by other means in the selection script
locale = $wnd['__gwt_Locale'];
}
if (locale == null) {
return "default";
}
while (!__gwt_isKnownPropertyValue("locale", locale)) {
var lastIndex = locale.lastIndexOf("_");
if (lastIndex == -1) {
locale = "default";
break;
} else {
locale = locale.substring(0,lastIndex);
}
}
return locale;
} catch(e){
alert("Unexpected exception in locale detection, using default: " + e);
return "default";
}
]]>
</property-provider>
<generate-with class="com.google.gwt.i18n.rebind.LocalizableGenerator">
<when-type-assignable class="com.google.gwt.i18n.client.Localizable" />
</generate-with>
<generate-with class="com.google.gwt.i18n.rebind.LocaleInfoGenerator">
<when-type-is class="com.google.gwt.i18n.client.impl.LocaleInfoImpl" />
</generate-with>
<generate-with class="com.google.gwt.i18n.rebind.CurrencyListGenerator">
<when-type-is class="com.google.gwt.i18n.client.impl.CurrencyList" />
</generate-with>
</module>