Refine search
/** * Get a string from the underlying resource bundle and format * it with the given set of arguments. * * @param key * @param args */ public String getString(final String key, final Object... args) { String value = getString(key); if (value == null) { value = key; } MessageFormat mf = new MessageFormat(value); mf.setLocale(locale); return mf.format(args, new StringBuffer(), null).toString(); }
FalseFriendRuleHandler(Language textLanguage, Language motherTongue) { messages = ResourceBundle.getBundle( JLanguageTool.MESSAGE_BUNDLE, motherTongue.getLocale()); formatter = new MessageFormat(""); formatter.setLocale(motherTongue.getLocale()); this.textLanguage = textLanguage; this.motherTongue = motherTongue; }
/** * Replace MessageFormat(String, Locale) constructor (not available until JDK 1.4). * @param pattern string * @param locale Locale * @return MessageFormat */ private MessageFormat createMessageFormat(final String pattern, final Locale locale) { final MessageFormat result = new MessageFormat(pattern); if (locale != null) { result.setLocale(locale); result.applyPattern(pattern); } return result; }
format = new MessageFormat(((ResourceBundle) object).getString(key)); format.setLocale(getBundle().getLocale()); formats.put(key, format);
MessageFormat messageFormat = new MessageFormat(""); messageFormat.setLocale(bundle.getLocale()); messageFormat.applyPattern(value); try {
MessageFormat mf = new MessageFormat(result); mf.setLocale(locale); mf.format(objects, buffer, passedField); handleArgumentField(begin, buffer.length(), argumentNumbers[i], position, fields);
/** * Replace MessageFormat(String, Locale) constructor (not available until JDK 1.4). * @param pattern string * @param locale Locale * @return MessageFormat */ private MessageFormat createMessageFormat(final String pattern, final Locale locale) { final MessageFormat result = new MessageFormat(pattern); if (locale != null) { result.setLocale(locale); result.applyPattern(pattern); } return result; }
/** * load the bundle * * @param locale * @return - the resource bundle for the given locale */ public static ResourceBundle loadBundle(Locale locale) { resourceBundle = ResourceBundle.getBundle("i18n/" + APPLICATION_PREFIX, locale); formatter = new MessageFormat(""); formatter.setLocale(locale); return resourceBundle; }
private void init(ResourceBundle bundle) { if (null != bundle) { _bundle = bundle; _formatter = new MessageFormat(""); //$NON-NLS-1$ _formatter.setLocale(_bundle.getLocale()); } else { _bundle = null; _formatter = new MessageFormat(""); //$NON-NLS-1$ } }
public String toString() { String message = bundle.getString(definition.key); MessageFormat format = new MessageFormat(message); format.setLocale(bundle.getLocale()); String formattedMessage = format.format(args); return formattedMessage; } }
/** * Creates a <code>MessageFormat</code> object and set the <code>Locale</code> to default and formats the message */ private void errorMsg(String key, Object[] args) { MessageFormat mf = new MessageFormat(key); mf.setLocale(Locale.getDefault()); LOGGER.log(Level.SEVERE, mf.format(args)); }
private void init(ResourceBundle bundle) { if (null != bundle) { _bundle = bundle; _formatter = new MessageFormat(""); //$NON-NLS-1$ _formatter.setLocale(_bundle.getLocale()); } else { _bundle = null; _formatter = new MessageFormat(""); //$NON-NLS-1$ } }
public static String message( Locale locale, String bundleName, Class<?> type, String key, Object... args ) { ResourceBundle bundle = ResourceBundle.getBundle( bundleName, locale ); String template = bundle.getString( type.getName() + '.' + key ); MessageFormat format = new MessageFormat( template ); format.setLocale( locale ); return format.format( args ); } }
public static String message( Locale locale, String bundleName, Class<?> type, String key, Object... args ) { ResourceBundle bundle = ResourceBundle.getBundle( bundleName, locale ); String template = bundle.getString( type.getName() + '.' + key ); MessageFormat format = new MessageFormat( template ); format.setLocale( locale ); return format.format( args ); } }
/** * Creates a <code>MessageFormat</code> object and set the <code>Locale</code> to default and formats the message */ private void errorMsg(String key, Object[] args) { MessageFormat mf = new MessageFormat(key); mf.setLocale(Locale.getDefault()); LOGGER.log(Level.SEVERE, mf.format(args)); }
private String getFormattedString(String msgtext, Object[] params) { String localizedStr = null; if (params == null || msgtext == null ) { return msgtext; } StringBuffer b = new StringBuffer(100); MessageFormat mf = new MessageFormat(msgtext); if (locale != null) { mf.setLocale(locale); b.append(mf.format(params)); localizedStr = b.toString(); } return localizedStr; }
private String getFormattedString(String msgtext, Object[] params) { String localizedStr = null; if (params == null || msgtext == null ) { return msgtext; } StringBuffer b = new StringBuffer(100); MessageFormat mf = new MessageFormat(msgtext); if (locale != null) { mf.setLocale(locale); b.append(mf.format(params)); localizedStr = b.toString(); } return localizedStr; }
private String getFormattedString(String msgtext, Object[] params) { String localizedStr = null; if (params == null || msgtext == null ) { return msgtext; } StringBuffer b = new StringBuffer(100); MessageFormat mf = new MessageFormat(msgtext); if (locale != null) { mf.setLocale(locale); b.append(mf.format(params)); localizedStr = b.toString(); } return localizedStr; }
private String getFormattedString(String msgtext, Object[] params) { String localizedStr = null; if (params == null || msgtext == null ) { return msgtext; } StringBuffer b = new StringBuffer(100); MessageFormat mf = new MessageFormat(msgtext); if (locale != null) { mf.setLocale(locale); b.append(mf.format(params)); localizedStr = b.toString(); } return localizedStr; }
private String getFormattedString(String msgtext, Object[] params) { String localizedStr = null; if (params == null || msgtext == null ) { return msgtext; } StringBuffer b = new StringBuffer(100); MessageFormat mf = new MessageFormat(msgtext); if (locale != null) { mf.setLocale(locale); b.append(mf.format(params)); localizedStr = b.toString(); } return localizedStr; }