Example #1
0
 private String getUnformater() {
   if (org.zkoss.zk.ui.impl.Utils.markClientInfoPerDesktop(
       getDesktop(), "org.zkoss.zul.Datebox.unformater.isSent")) {
     return Library.getProperty("org.zkoss.zul.Datebox.unformater");
   }
   return null;
 }
Example #2
0
 private static Object[] getRealSymbols(Locale locale, Datebox box) {
   if (locale != null) {
     final String localeName = locale.toString();
     if (org.zkoss.zk.ui.impl.Utils.markClientInfoPerDesktop(
         box.getDesktop(), box.getClass().getName() + localeName)) {
       Map symbols = (Map) _symbols.get(locale);
       if (symbols == null) symbols = loadSymbols(locale);
       return new Object[] {localeName, symbols};
     }
     return new Object[] {localeName, null};
   }
   return null;
 }
Example #3
0
  private static void load0() throws java.io.IOException {
    final XMLResourcesLocator locator = Utils.getXMLResourcesLocator();

    // 1. parse config.xml
    final ConfigParser parser = new ConfigParser();
    parser.parseConfigXml(null); // only system default configs

    // 2. process lang.xml (no particular dependency)
    for (Enumeration en = locator.getResources("metainfo/zk/lang.xml"); en.hasMoreElements(); ) {
      final URL url = (URL) en.nextElement();
      if (log.isDebugEnabled()) log.debug("Loading " + url);
      try {
        final Document doc = new SAXBuilder(true, false, true).build(url);
        if (ConfigParser.checkVersion(url, doc, true)) parseLang(doc, locator, url, false);
      } catch (Exception ex) {
        log.error("Failed to load " + url, ex);
        throw UiException.Aide.wrap(ex, "Failed to load " + url);
        // abort since it is hardly to work then
      }
    }

    // 5. process other language (from addLanguage)
    if (_langs != null) {
      for (Iterator<Object[]> it = _langs.iterator(); it.hasNext(); ) {
        final Object[] p = it.next();
        loadLang((Locator) p[0], (URL) p[1], false);
      }
      _langs = null; // free memory
    }

    // 4. process lang-addon.xml (with dependency)
    final List<XMLResourcesLocator.Resource> xmls =
        locator.getDependentXMLResources("metainfo/zk/lang-addon.xml", "addon-name", "depends");
    for (XMLResourcesLocator.Resource res : xmls) {
      try {
        if (ConfigParser.checkVersion(res.url, res.document, true))
          parseLang(res.document, locator, res.url, true);
      } catch (Exception ex) {
        log.error("Failed to load " + res.url, ex);
        // keep running
      }
    }

    // 5. process other addon (from addAddon)
    if (_addons != null) {
      for (Iterator<Object[]> it = _addons.iterator(); it.hasNext(); ) {
        final Object[] p = it.next();
        loadLang((Locator) p[0], (URL) p[1], true); // addon
      }
      _addons = null; // free memory
    }

    // 6. process the extension
    if (_exts != null) {
      for (Map.Entry<String, String> me : _exts.entrySet()) {
        final String ext = me.getKey();
        final String lang = me.getValue();
        try {
          LanguageDefinition.addExtension(ext, lang);
        } catch (DefinitionNotFoundException ex) {
          log.warn("Extension " + ext + " ignored since language " + lang + " not found");
        }
      }
      _exts = null;
    }
  }