Package org.nutz.mvc.annotation

Examples of org.nutz.mvc.annotation.Localization


      setup.init(config);
    }
  }

  private void evalLocalization(NutConfig config, Class<?> mainModule) {
    Localization lc = mainModule.getAnnotation(Localization.class);
    if (null != lc) {
      if (log.isDebugEnabled())
        log.debugf("Localization message: '%s'", lc.value());

      Map<String, Map<String, Object>> msgss = Mirror.me(lc.type()).born().load(lc.value());
      config.setAttributeIgnoreNull(Localization.class.getName(), msgss);
    } else if (log.isDebugEnabled()) {
      log.debug("!!!Can not find localization message resource");
    }
  }
View Full Code Here


            setup.init(config);
        }
    }

    private void evalLocalization(NutConfig config, Class<?> mainModule) {
        Localization lc = mainModule.getAnnotation(Localization.class);
        if (null != lc) {
            if (log.isDebugEnabled())
                log.debugf("Localization: %s('%s') %s dft<%s>",
                           lc.type().getName(),
                           lc.value(),
                           Strings.isBlank(lc.beanName()) ? "" : "$ioc->" + lc.beanName(),
                           lc.defaultLocalizationKey());

            MessageLoader msgLoader = null;
            // 通过 Ioc 方式加载 MessageLoader ...
            if (!Strings.isBlank(lc.beanName())) {
                msgLoader = config.getIoc().get(lc.type(), lc.beanName());
            }
            // 普通方式加载
            else {
                msgLoader = Mirror.me(lc.type()).born();
            }
            // 加载数据
            Map<String, Map<String, Object>> msgss = msgLoader.load(lc.value());

            // 保存消息 Map
            Mvcs.setMessageSet(msgss);

            // 如果有声明默认语言 ...
            if (!Strings.isBlank(lc.defaultLocalizationKey()))
                Mvcs.setDefaultLocalizationKey(lc.defaultLocalizationKey());

        }
        // 否则记录一下
        else if (log.isDebugEnabled()) {
            log.debug("@Localization not define");
View Full Code Here

            setup.init(config);
        }
    }

    protected void evalLocalization(NutConfig config, Class<?> mainModule) {
        Localization lc = mainModule.getAnnotation(Localization.class);
        if (null != lc) {
            if (log.isDebugEnabled())
                log.debugf("Localization: %s('%s') %s dft<%s>",
                           lc.type().getName(),
                           lc.value(),
                           Strings.isBlank(lc.beanName()) ? "" : "$ioc->" + lc.beanName(),
                           lc.defaultLocalizationKey());

            MessageLoader msgLoader = null;
            // 通过 Ioc 方式加载 MessageLoader ...
            if (!Strings.isBlank(lc.beanName())) {
                msgLoader = config.getIoc().get(lc.type(), lc.beanName());
            }
            // 普通方式加载
            else {
                msgLoader = Mirror.me(lc.type()).born();
            }
            // 加载数据
            Map<String, Map<String, Object>> msgss = msgLoader.load(lc.value());

            // 保存消息 Map
            Mvcs.setMessageSet(msgss);

            // 如果有声明默认语言 ...
            if (!Strings.isBlank(lc.defaultLocalizationKey()))
                Mvcs.setDefaultLocalizationKey(lc.defaultLocalizationKey());

        }
        // 否则记录一下
        else if (log.isDebugEnabled()) {
            log.debug("@Localization not define");
View Full Code Here

TOP

Related Classes of org.nutz.mvc.annotation.Localization

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.