@Override public String getMessage() { String msg = super.getMessage(); if (msg != null && msg.length() > 0) { return msg; } else { return LocalizationManager.get().getLocalizedTextString(this); } }
public String getLocalizedTextString( Locale locale, String id, Map<String, Object> parameters ) { ILocalizedText t = getLocalizedText( locale, id ); if ((t == null) && !locale.equals(locale)) { t = getLocalizedText(locale, id ); } if ((t == null) && !locale.getLanguage().equals( "en" )) { t = getLocalizedText( new Locale( "en" ), id ); } return (t == null)? null : t.format( parameters ); }
private ILocalizedText getLocalizedText( Locale locale, String id ) { ILocalizedText t = getLocalizedTextInner( locale, id ); if ((t == null) && (locale.getCountry().length() > 0) && (locale.getVariant().length() > 0)) { t = getLocalizedTextInner( new Locale( locale.getLanguage(), locale.getCountry() ), id ); } if ((t == null) && (locale.getCountry().length() > 0)) { t = getLocalizedTextInner( new Locale( locale.getLanguage() ), id ); } return t; }
void validateDumpConfig(ConfigurationBuffer configurationBuffer) throws ConfigurationException { if (dumpConfigFile != null) { final String text = FileConfigurator.formatBuffer(configurationBuffer, "royale-config", LocalizationManager.get(), "flex2.configuration"); try { final Writer writer = new FileWriter(dumpConfigFile); IOUtils.write(text, writer); IOUtils.closeQuietly(writer); } catch (IOException e) { throw new ConfigurationException.IOError(dumpConfigFile); } } }
/** * Constructor */ public Configurator(Class<? extends Configuration> configurationClass) { this.configurationClass = configurationClass; args = new LinkedHashMap<String, Object>(); more = new LinkedHashMap<String, Object>(); tokens = new TreeMap<String, String>(); keepLinkReport = false; keepSizeReport = false; keepConfigurationReport = false; reportMissingLibraries = true; warnOnRoyaleOnlyOptionUsage = false; isConfigurationDirty = true; configurationDefaultVariable = ICompilerSettingsConstants.FILE_SPECS_VAR; // the default variable of the configuration. configurationPathResolver = new ConfigurationPathResolver(System.getProperty("user.dir")); configurationProblems = new ArrayList<ICompilerProblem>(); // initialize the localization manager. LocalizationManager.get().addLocalizer(new ResourceBundleLocalizer()); }
/** * Configures the LocalizationManager's locale, which is used when reporting compile time errors, warnings, and * info. * * @param toolsLocale A locale in Java format. For example, "en" or "ja_JP". * @throws ConfigurationException When the specified toolsLocale is not available a ToolsLocaleNotAvailable error is * reported. */ @Config @Mapping("tools-locale") public void setToolsLocale(ConfigurationValue cv, String toolsLocale) throws ConfigurationException { Locale[] locales = Locale.getAvailableLocales(); for (int i = 0; i < locales.length; i++) { if (locales[i].toString().equals(toolsLocale)) { this.toolsLocale = locales[i]; LocalizationManager.get().setLocale(locales[i]); return; } } throw new ConfigurationException.ToolsLocaleNotAvailable(cv.getVar(), cv.getSource(), cv.getLine()); }
public String getLocalizedTextString( Object object ) { String s = getLocalizedTextString(locale, object ); return s; }
@Override public String format( Map<String, Object> parameters ) { return LocalizationManager.replaceInlineReferences( text, parameters ); } private String text;
void validateDumpConfig(ConfigurationBuffer configurationBuffer) throws ConfigurationException { if (dumpConfigFile != null) { final String text = FileConfigurator.formatBuffer(configurationBuffer, "royale-config", LocalizationManager.get(), "flex2.configuration"); try { final Writer writer = new FileWriter(dumpConfigFile); IOUtils.write(text, writer); IOUtils.closeQuietly(writer); } catch (IOException e) { throw new ConfigurationException.IOError(dumpConfigFile); } } }
/** * Constructor */ public Configurator(Class<? extends Configuration> configurationClass) { this.configurationClass = configurationClass; args = new LinkedHashMap<String, Object>(); more = new LinkedHashMap<String, Object>(); tokens = new TreeMap<String, String>(); keepLinkReport = false; keepSizeReport = false; keepConfigurationReport = false; reportMissingLibraries = true; warnOnRoyaleOnlyOptionUsage = false; isConfigurationDirty = true; configurationDefaultVariable = ICompilerSettingsConstants.FILE_SPECS_VAR; // the default variable of the configuration. configurationPathResolver = new ConfigurationPathResolver(System.getProperty("user.dir")); configurationProblems = new ArrayList<ICompilerProblem>(); // initialize the localization manager. LocalizationManager.get().addLocalizer(new ResourceBundleLocalizer()); }
/** * Configures the LocalizationManager's locale, which is used when reporting compile time errors, warnings, and * info. * * @param toolsLocale A locale in Java format. For example, "en" or "ja_JP". * @throws ConfigurationException When the specified toolsLocale is not available a ToolsLocaleNotAvailable error is * reported. */ @Config @Mapping("tools-locale") public void setToolsLocale(ConfigurationValue cv, String toolsLocale) throws ConfigurationException { Locale[] locales = Locale.getAvailableLocales(); for (int i = 0; i < locales.length; i++) { if (locales[i].toString().equals(toolsLocale)) { this.toolsLocale = locales[i]; LocalizationManager.get().setLocale(locales[i]); return; } } throw new ConfigurationException.ToolsLocaleNotAvailable(cv.getVar(), cv.getSource(), cv.getLine()); }
public static String getDescription(ConfigurationBuffer buffer, String var, LocalizationManager l10n, String l10nPrefix) { String key = (l10nPrefix == null) ? var : (l10nPrefix + "." + var); String description = l10n.getLocalizedTextString(key, null); return description; }
@Override public String format( Map<String, Object> parameters ) { return LocalizationManager.replaceInlineReferences( text, parameters ); } private String text;
/** * Print detailed help information if -help is provided. */ private void processHelp(final List<ConfigurationValue> helpVar) { final Set<String> keywords = new LinkedHashSet<String>(); for (final ConfigurationValue val : helpVar) { for (final Object element : val.getArgs()) { String keyword = (String)element; while (keyword.startsWith("-")) keyword = keyword.substring(1); keywords.add(keyword); } } if (keywords.size() == 0) keywords.add("help"); final String usages = CommandLineConfigurator.usage( getProgramName(), DEFAULT_VAR, configBuffer, keywords, LocalizationManager.get(), L10N_CONFIG_PREFIX); System.out.println(getStartMessage()); System.out.println(usages); }
@Override public String getMessage() { String msg = super.getMessage(); if (msg != null && msg.length() > 0) { return msg; } else { return LocalizationManager.get().getLocalizedTextString(this); } }
public static String getDescription(ConfigurationBuffer buffer, String var, LocalizationManager l10n, String l10nPrefix) { String key = (l10nPrefix == null) ? var : (l10nPrefix + "." + var); String description = l10n.getLocalizedTextString(key, null); return description; }
private ILocalizedText getLocalizedText( Locale locale, String id ) { ILocalizedText t = getLocalizedTextInner( locale, id ); if ((t == null) && (locale.getCountry().length() > 0) && (locale.getVariant().length() > 0)) { t = getLocalizedTextInner( new Locale( locale.getLanguage(), locale.getCountry() ), id ); } if ((t == null) && (locale.getCountry().length() > 0)) { t = getLocalizedTextInner( new Locale( locale.getLanguage() ), id ); } return t; }
public String getLocalizedTextString( Locale locale, String id, Map<String, Object> parameters ) { ILocalizedText t = getLocalizedText( locale, id ); if ((t == null) && !locale.equals(locale)) { t = getLocalizedText(locale, id ); } if ((t == null) && !locale.getLanguage().equals( "en" )) { t = getLocalizedText( new Locale( "en" ), id ); } return (t == null)? null : t.format( parameters ); }
/** * Print detailed help information if -help is provided. */ private void processHelp(final List<ConfigurationValue> helpVar) { final Set<String> keywords = new LinkedHashSet<String>(); for (final ConfigurationValue val : helpVar) { for (final Object element : val.getArgs()) { String keyword = (String)element; while (keyword.startsWith("-")) keyword = keyword.substring(1); keywords.add(keyword); } } if (keywords.size() == 0) keywords.add("help"); final String usages = CommandLineConfigurator.usage( getProgramName(), DEFAULT_VAR, configBuffer, keywords, LocalizationManager.get(), L10N_CONFIG_PREFIX); System.out.println(getStartMessage()); System.out.println(usages); }
public String getLocalizedTextString( Object object ) { String s = getLocalizedTextString(locale, object ); return s; }