Package java.util

Examples of java.util.ResourceBundle


        /* try the cache first */
  String key = getKey();
        String[] dateTimePatterns = cachedLocaleData.get(key);
        if (dateTimePatterns == null) { /* cache miss */
            ResourceBundle r = LocaleData.getDateFormatData(loc);
      if (!isGregorianCalendar()) {
    try {
        dateTimePatterns = r.getStringArray(getCalendarName() + ".DateTimePatterns");
    } catch (MissingResourceException e) {
    }
      }
      if (dateTimePatterns == null) {
    dateTimePatterns = r.getStringArray("DateTimePatterns");
      }
            /* update cache */
            cachedLocaleData.put(key, dateTimePatterns);
        }
  formatData = DateFormatSymbols.getInstance(loc);
View Full Code Here


        }

        /* try the cache first */
        String[] numberPatterns = (String[])cachedLocaleData.get(desiredLocale);
        if (numberPatterns == null) { /* cache miss */
            ResourceBundle resource = LocaleData.getNumberFormatData(desiredLocale);
            numberPatterns = resource.getStringArray("NumberPatterns");
            /* update cache */
            cachedLocaleData.put(desiredLocale, numberPatterns);
        }

        DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(desiredLocale);
View Full Code Here

        Locale def = Locale.getDefault();
        // try to get the pattern from the cache
        String pattern = (String) cachedLocaleData.get(def);
        if (pattern == null) {  /* cache miss */
            // Get the pattern for the default locale.
            ResourceBundle rb = LocaleData.getNumberFormatData(def);
            String[] all = rb.getStringArray("NumberPatterns");
            pattern = all[0];
            /* update cache */
            cachedLocaleData.put(def, pattern);
        }

View Full Code Here

        // get resource bundle data - try the cache first
        boolean needCacheUpdate = false;
        Object[] data = (Object[]) cachedLocaleData.get(locale);
        if (data == null) {  /* cache miss */
            data = new Object[3];
            ResourceBundle rb = LocaleData.getNumberFormatData(locale);
            data[0] = rb.getStringArray("NumberElements");
            needCacheUpdate = true;
        }

        String[] numberElements = (String[]) data[0];

View Full Code Here

    /**
     * Creates a panel containing all of the Runtime version information
     */
    private void createVersionPanel() {
        version = new JPanel();
        ResourceBundle bundle = ResourceBundle.getBundle("buildid");

        version.setLayout(new GridLayout(0, 2));
        addItem(resources.getString("aboutJbotherVersion"),
                com.valhalla.jbother.JBother.JBOTHER_VERSION);
        addItem(resources.getString("aboutBildId"), bundle
                .getString("build.number"));
        addItem(resources.getString("aboutCreatedBy"), "Adam Olsen");
        addItem(resources.getString("aboutPluginApiVersion"), PluginLoader
                .getAPIVersion()
                + "");
View Full Code Here

    MessageInterpolator interpolator = null;
   
    if (localesMap.containsKey(clientLocale.toString())) {
      interpolator = localesMap.get(clientLocale.toString());
    } else {
      ResourceBundle clientDefaultMessages = ResourceBundle.getBundle("org/hibernate/validator/ValidationMessages", clientLocale);
     
      try {
        ResourceBundle clientCustomMessages = ResourceBundle.getBundle("ValidationMessages", clientLocale);
       
      } catch (MissingResourceException e) {
        interpolator = new ResourceBundleMessageInterpolator(clientDefaultMessages);
      }
      localesMap.put(clientLocale.toString(), interpolator);
View Full Code Here

  public void contextInitialized(ServletContextEvent event) {
   
    try {         
     
      ResourceBundle rb = Utility.readPropFile();
      logger.debug("Could not find Resource file");
     
      SpreadsheetCompiler converter = new SpreadsheetCompiler();
      String xlResource =rb.getString("excel.decisiontable.path");
      logger.debug("name of Excel file:"+xlResource);
     
      InputStream is = getClass().getResourceAsStream(xlResource);
      String drl = converter.compile(is, InputType.XLS );     
     
View Full Code Here

  protected static String getMessage(String source, Locale locale, long id, String... parameters) {
    return getRawMessage(source, locale, id).toString(parameters);
  }

  protected static Message getRawMessage(String source, Locale locale, long id) {
    ResourceBundle bundle = ResourceBundle.getBundle(source, locale);
    return Message.getInstance(bundle.getString(String.valueOf(id)));
  }
View Full Code Here

public class BundleTextResourceTest {

  @Test
  public void testGetText() {
    Locale locale = new Locale("zh", "CN");
    ResourceBundle bundle = ResourceBundle.getBundle("message", locale);
    assertNotNull(bundle);
    BundleTextResource tr = new BundleTextResource();
    tr.setLocale(locale);
    tr.setBundle(bundle);
    assertEquals(tr.getText("hello.world"), "nihao");
View Full Code Here

     */
    public static String formatMessage(Locale locale,
        String key, Object[] arguments)
        throws MissingResourceException {

        ResourceBundle resourceBundle = null;
        if (locale != null) {
            resourceBundle =
                PropertyResourceBundle.getBundle(BASE_NAME, locale);
        }
        else {
            resourceBundle =
                PropertyResourceBundle.getBundle(BASE_NAME);
        }

        // format message
        String msg;
        try {
            msg = resourceBundle.getString(key);
            if (arguments != null) {
                try {
                    msg = java.text.MessageFormat.format(msg, arguments);
                }
                catch (Exception e) {
                    msg = resourceBundle.getString("FormatFailed");
                    msg += " " + resourceBundle.getString(key);
                }
            }
        }
       
        // error
        catch (MissingResourceException e) {
            msg = resourceBundle.getString("BadMessageKey");
            throw new MissingResourceException(key, msg, key);
        }

        // no message
        if (msg == null) {
View Full Code Here

TOP

Related Classes of java.util.ResourceBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.