/** * Set the locale of the current user logged in. <p> * * This method will always set a valid Locale for the current user! * If the provided locale name is not valid (i.e. leads to an Exception * when trying to create the Locale, then the configured default Locale is set.<p> * * The full name must consist of language code, * country code(optional), variant(optional) separated by "_".<p> * * @see Locale#getLanguage() * @see Locale#getCountry() * @see Locale#getVariant() * @param localeName the full locale name * * @throws CmsException if something goes wrong * */ public void setLocale(String localeName) throws CmsException { Locale locale = CmsLocaleManager.getLocale(localeName); System.out.println(getMessages().key( Messages.GUI_SHELL_SETLOCALE_2, locale, m_cms.getRequestContext().currentUser().getName())); m_shell.setLocale(locale); System.out.println(getMessages().key(Messages.GUI_SHELL_SETLOCALE_POST_1, locale)); }
/** * Set the locale of the current user logged in. <p> * * This method will always set a valid Locale for the current user! * If the provided locale name is not valid (i.e. leads to an Exception * when trying to create the Locale, then the configured default Locale is set.<p> * * The full name must consist of language code, * country code(optional), variant(optional) separated by "_".<p> * * @see Locale#getLanguage() * @see Locale#getCountry() * @see Locale#getVariant() * @param localeName the full locale name * * @throws CmsException if something goes wrong * */ public void setLocale(String localeName) throws CmsException { Locale locale = CmsLocaleManager.getLocale(localeName); m_shell.getOut().println( getMessages().key( Messages.GUI_SHELL_SETLOCALE_2, locale, m_cms.getRequestContext().getCurrentUser().getName())); m_shell.setLocale(locale); m_shell.getOut().println(getMessages().key(Messages.GUI_SHELL_SETLOCALE_POST_1, locale)); }