1 5 package org.exoplatform.portal.session; 6 7 import java.util.Locale ; 8 import java.util.ResourceBundle ; 9 import org.exoplatform.container.PortalContainer; 10 import org.exoplatform.services.resources.LocaleConfig; 11 import org.exoplatform.services.resources.LocaleConfigService; 12 17 public class PortalResources { 18 private static String [] PORTAL_RESOURCES = {"locale.portal.portal"} ; 19 private ResourceBundle portalResource_ ; 20 private ResourceBundle portalOwnerResource_ ; 21 private LocaleConfig localeConfig_ ; 22 23 public PortalResources() { 24 25 } 26 27 public void changeLocaleConfig(String locale, String owner) { 28 LocaleConfigService manager = 29 (LocaleConfigService)PortalContainer.getInstance(). 30 getComponentInstanceOfType(LocaleConfigService.class) ; 31 localeConfig_ = manager.getLocaleConfig(locale); 32 portalResource_ = localeConfig_.getMergeResourceBundle(PORTAL_RESOURCES); 33 portalOwnerResource_ = localeConfig_.getOwnerResourceBundle(owner) ; 34 } 35 36 public LocaleConfig getLocaleConfig() { return localeConfig_ ; } 37 38 public Locale getLocale() { return localeConfig_.getLocale() ; } 39 40 public ResourceBundle getPortalResourceBundle() { 41 return portalResource_ ; 42 } 43 44 public ResourceBundle getPortalOwnerResourceBundle() { 45 return portalOwnerResource_ ; 46 } 47 48 public ResourceBundle getApplicationResource() { 49 return portalResource_ ; 50 } 51 52 public ResourceBundle getApplicationOwnerResource() { 53 return portalOwnerResource_ ; 54 } 55 56 public ResourceBundle getApplicationResource(String name) { 57 return localeConfig_.getResourceBundle(name) ; 58 } 59 60 public ResourceBundle getApplicationOwnerResource(String owner) { 61 return localeConfig_.getOwnerResourceBundle(owner) ; 62 } 63 } | Popular Tags |