Author: thomas.heute(a)jboss.com
Date: 2010-08-24 14:32:48 -0400 (Tue, 24 Aug 2010)
New Revision: 3921
Modified:
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
Log:
GTNPORTAL-1301: Show "Simplified Chinese" for zh_CN and "Traditional
Chinese" for zh_TW
Avoiding JDK 6 feature
Modified:
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java
===================================================================
---
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java 2010-08-24
17:05:59 UTC (rev 3920)
+++
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java 2010-08-24
18:32:48 UTC (rev 3921)
@@ -46,6 +46,7 @@
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.MissingResourceException;
/**
* Created by The eXo Platform SARL Author : Dang Van Minh minhdv81(a)yahoo.com
@@ -153,7 +154,6 @@
{
LocaleConfig config = i.next();
Locale locale = config.getLocale();
- displayName = capitalizeFirstLetter(locale.getDisplayName(currentLocale));
language = locale.getLanguage();
country = locale.getCountry();
@@ -164,18 +164,22 @@
ResourceBundle localeResourceBundle;
+
+ displayName = null;
try
{
localeResourceBundle = getResourceBundle(currentLocale);
String key = "Locale." + language;
- if (localeResourceBundle.containsKey(key))
- {
- displayName = localeResourceBundle.getString(key);
- }
+ String translation = localeResourceBundle.getString(key);
+ displayName = translation;
}
+ catch (MissingResourceException e)
+ {
+ displayName = capitalizeFirstLetter(locale.getDisplayName(currentLocale));
+ }
catch (Exception e)
{
- // ignore, use default displayName
+
}
option = new SelectItemOption<String>(displayName, language);
@@ -282,4 +286,5 @@
ResourceBundle res = service.getResourceBundle("locale.portal.webui",
locale);
return res;
}
+
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2010-08-24
17:05:59 UTC (rev 3920)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2010-08-24
18:32:48 UTC (rev 3921)
@@ -43,6 +43,7 @@
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.MissingResourceException;
@ComponentConfig(template =
"system:/groovy/portal/webui/portal/UILanguageSelector.gtmpl", events = {
@EventConfig(listeners = UILanguageSelector.SaveActionListener.class),
@@ -73,45 +74,48 @@
String key = "Locale." + lang;
String displayName = null;
- if (currentLocaleResourceBundle.containsKey(key))
+ try
{
- displayName = currentLocaleResourceBundle.getString(key);
+ String translation = currentLocaleResourceBundle.getString(key);
+ displayName = translation;
}
- else
+ catch (MissingResourceException e)
{
displayName =
capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale));
}
-
+
String localedName = null;
- if (localeResourceBundle.containsKey(key))
+ try
{
- localedName = localeResourceBundle.getString(key);
+ String translation = localeResourceBundle.getString(key);
+ localedName = translation;
}
- else
+ catch (MissingResourceException e)
{
localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale));
}
-
if (country != null && country.length() > 0)
{
lang = lang + "_" + country;
key = "Locale." + lang;
-
- if (currentLocaleResourceBundle.containsKey(key))
+
+ try
{
- displayName = currentLocaleResourceBundle.getString(key);
+ String translation = currentLocaleResourceBundle.getString(key);
+ displayName = translation;
}
- else
+ catch (MissingResourceException e)
{
displayName =
capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale)) + " - " +
capitalizeFirstLetter(locale.getDisplayCountry(currentLocale));
}
-
- if (localeResourceBundle.containsKey(key))
- {
- localedName = localeResourceBundle.getString(key);
+
+ try
+ {
+ String translation = localeResourceBundle.getString(key);
+ localedName = translation;
}
- else
+ catch (MissingResourceException e)
{
localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale)) +
" - " + capitalizeFirstLetter(locale.getDisplayCountry(locale));
}
@@ -204,4 +208,4 @@
}
-}
\ No newline at end of file
+}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2010-08-24
17:05:59 UTC (rev 3920)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2010-08-24
18:32:48 UTC (rev 3921)
@@ -75,6 +75,7 @@
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.MissingResourceException;
@ComponentConfigs({
@ComponentConfig(lifecycle = UIFormLifecycle.class, template =
"system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@@ -196,7 +197,6 @@
while (iterator.hasNext())
{
LocaleConfig localeConfig = (LocaleConfig)iterator.next();
- String displayName =
capitalizeFirstLetter(localeConfig.getLocale().getDisplayName(currentLocale));
ResourceBundle localeResourceBundle = getResourceBundle(currentLocale);
String key = "Locale." + localeConfig.getLocale().getLanguage();
@@ -205,10 +205,16 @@
key += "_" + localeConfig.getLocale().getCountry();
}
- if (localeResourceBundle.containsKey(key))
+ String displayName = null;
+ try
{
- displayName = localeResourceBundle.getString(key);
+ String translation = localeResourceBundle.getString(key);
+ displayName = translation;
}
+ catch (MissingResourceException e)
+ {
+ displayName =
capitalizeFirstLetter(localeConfig.getLocale().getDisplayName(currentLocale));;
+ }
SelectItemOption<String> option =
new SelectItemOption<String>(displayName, localeConfig