public JiveBeanInfo() { //Get the locale that should be used, then load the resource bundle. Locale currentLocale = JiveGlobals.getLocale(); try { bundle = ResourceBundle.getBundle("bean_" + getName(), currentLocale); } catch (Exception e) { // Ignore any exception when trying to load bundle. } }
/** * Formats a Date object to return a date using the global locale. * * @param date the Date to format. * @return a String representing the date. */ public static String formatDate(Date date) { if (dateFormat == null) { if (properties != null) { dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, getLocale()); dateFormat.setTimeZone(getTimeZone()); } else { DateFormat instance = DateFormat.getDateInstance(DateFormat.MEDIUM, getLocale()); instance.setTimeZone(getTimeZone()); return instance.format(date); } } return dateFormat.format(date); }
/** * Returns an internationalized string loaded from a resource bundle using * the locale specified by JiveGlobals.getLocale() substituting the passed * in arguments. Substitution is handled using the * {@link java.text.MessageFormat} class. * * @param key the key to use for retrieving the string from the * appropriate resource bundle. * @param arguments a list of objects to use which are formatted, then * inserted into the pattern at the appropriate places. * @return the localized string. */ public static String getLocalizedString(String key, List<?> arguments) { Locale locale = JiveGlobals.getLocale(); ResourceBundle bundle = ResourceBundle.getBundle(resourceBaseName, locale); return getLocalizedString(key, locale, arguments, bundle); }
/** * Formats a Date object to return a time using the global locale. * * @param date the Date to format. * @return a String representing the time. */ public static String formatTime(Date date) { if (timeFormat == null) { if (properties != null) { timeFormat = DateFormat.getTimeInstance(DateFormat.SHORT, getLocale()); timeFormat.setTimeZone(getTimeZone()); } else { DateFormat instance = DateFormat.getTimeInstance(DateFormat.SHORT, getLocale()); instance.setTimeZone(getTimeZone()); return instance.format(date); } } return timeFormat.format(date); }
public AuditorImpl(AuditManager manager) { auditManager = manager; dateFormat = FastDateFormat.getInstance("yyyyMMdd", TimeZone.getTimeZone("UTC")); auditFormat = FastDateFormat.getInstance("MMM dd, yyyy hh:mm:ss:SSS a", JiveGlobals.getLocale()); }
/** * Formats a Date object to return a date and time using the global locale. * * @param date the Date to format. * @return a String representing the date and time. */ public static String formatDateTime(Date date) { if (dateTimeFormat == null) { if (properties != null) { dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, getLocale()); dateTimeFormat.setTimeZone(getTimeZone()); } else { DateFormat instance = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, getLocale()); instance.setTimeZone(getTimeZone()); return instance.format(date); } } return dateTimeFormat.format(date); }
Locale jiveLocale = JiveGlobals.getLocale();
/** * Returns an internationalized string loaded from a resource bundle. * The locale used will be the locale specified by JiveGlobals.getLocale(). * * @param key the key to use for retrieving the string from the * appropriate resource bundle. * @return the localized string. */ public static String getLocalizedString(String key) { Locale locale = JiveGlobals.getLocale(); try { ResourceBundle bundle = ResourceBundle.getBundle(resourceBaseName, locale); return getLocalizedString(key, locale, null, bundle); } catch (MissingResourceException mre) { Log.error(mre.getMessage()); return key; } }
Config.set(context, Config.FMT_LOCALE, JiveGlobals.getLocale()); String pluginName = parts[1]; ResourceBundle bundle = LocaleUtils.getPluginResourceBundle(pluginName); LocalizationContext ctx = new LocalizationContext(bundle, JiveGlobals.getLocale()); Config.set(request, Config.FMT_LOCALIZATION_CONTEXT, ctx); Config.set(context, Config.FMT_LOCALE, JiveGlobals.getLocale());
locale = JiveGlobals.getLocale();
private String getAvailablePluginsUpdateRequest() { Element xmlRequest = docFactory.createDocument().addElement("available"); // Add locale so we can get current name and description of plugins Element locale = xmlRequest.addElement("locale"); locale.addText(JiveGlobals.getLocale().toString()); return xmlRequest.asXML(); }
locale = JiveGlobals.getLocale();
/** * Retrieve the <code>ResourceBundle</code> that is used with this plugin. * * @param pluginName the name of the plugin. * @return the ResourceBundle used with this plugin. * @throws Exception thrown if an exception occurs. */ public static ResourceBundle getPluginResourceBundle(String pluginName) throws Exception { final Locale locale = JiveGlobals.getLocale(); String i18nFile = getI18nFile(pluginName); // Retrieve classloader from pluginName. final XMPPServer xmppServer = XMPPServer.getInstance(); PluginManager pluginManager = xmppServer.getPluginManager(); Plugin plugin = pluginManager.getPlugin(pluginName); if (plugin == null) { throw new NullPointerException("Plugin could not be located."); } ClassLoader pluginClassLoader = pluginManager.getPluginClassloader(plugin); return ResourceBundle.getBundle(i18nFile, locale, pluginClassLoader); }
Locale locale = JiveGlobals.getLocale(); // default to server locale. final Session session = SessionManager.getInstance().getSession( result.getTo() ); if ( session != null && session.getLanguage() != null ) {
public JiveBeanInfo() { //Get the locale that should be used, then load the resource bundle. Locale currentLocale = JiveGlobals.getLocale(); try { bundle = ResourceBundle.getBundle("bean_" + getName(), currentLocale); } catch (Exception e) { // Ignore any exception when trying to load bundle. } }
/** * Returns an internationalized string loaded from a resource bundle using * the locale specified by JiveGlobals.getLocale() substituting the passed * in arguments. Substitution is handled using the * {@link java.text.MessageFormat} class. * * @param key the key to use for retrieving the string from the * appropriate resource bundle. * @param arguments a list of objects to use which are formatted, then * inserted into the pattern at the appropriate places. * @return the localized string. */ public static String getLocalizedString(String key, List<?> arguments) { Locale locale = JiveGlobals.getLocale(); ResourceBundle bundle = ResourceBundle.getBundle(resourceBaseName, locale); return getLocalizedString(key, locale, arguments, bundle); }
public AuditorImpl(AuditManager manager) { auditManager = manager; dateFormat = FastDateFormat.getInstance("yyyyMMdd", TimeZone.getTimeZone("UTC")); auditFormat = FastDateFormat.getInstance("MMM dd, yyyy hh:mm:ss:SSS a", JiveGlobals.getLocale()); }
/** * Returns an internationalized string loaded from a resource bundle. * The locale used will be the locale specified by JiveGlobals.getLocale(). * * @param key the key to use for retrieving the string from the * appropriate resource bundle. * @return the localized string. */ public static String getLocalizedString(String key) { Locale locale = JiveGlobals.getLocale(); try { ResourceBundle bundle = ResourceBundle.getBundle(resourceBaseName, locale); return getLocalizedString(key, locale, null, bundle); } catch (MissingResourceException mre) { Log.error(mre.getMessage()); return key; } }
private String getAvailablePluginsUpdateRequest() { Element xmlRequest = docFactory.createDocument().addElement("available"); // Add locale so we can get current name and description of plugins Element locale = xmlRequest.addElement("locale"); locale.addText(JiveGlobals.getLocale().toString()); return xmlRequest.asXML(); }