Search in sources :

Example 21 with CoreLocale

use of app.hongs.CoreLocale in project HongsCORE by ihongs.

the class JointGate method getRspMsg.

/**
 * 获取返回消息
 * @param helper
 * @param ett
 * @param opr
 * @param num
 * @return
 * @throws HongsException
 */
protected String getRspMsg(ActionHelper helper, IEntity ett, String opr, int num) throws HongsException {
    ActionRunner runner = (ActionRunner) helper.getAttribute(ActionRunner.class.getName());
    CoreLocale locale = CoreLocale.getInstance().clone();
    String mod = runner.getModule();
    String ent = runner.getEntity();
    String cnt = Integer.toString(num);
    String key = "fore." + opr + "." + ent + ".success";
    locale.fill(mod);
    if (!locale.containsKey(key)) {
        key = "fore." + opr + ".success";
        String tit = getName(locale, mod, ent);
        return locale.translate(key, tit, cnt);
    } else {
        return locale.translate(key, /**/
        cnt);
    }
}
Also used : ActionRunner(app.hongs.action.ActionRunner) CoreLocale(app.hongs.CoreLocale)

Example 22 with CoreLocale

use of app.hongs.CoreLocale in project HongsCORE by ihongs.

the class FormSet method getEnumTranslated.

public Map getEnumTranslated(String namc) {
    Map items = enums.get(namc);
    Map itemz = new LinkedHashMap();
    if (items == null)
        return itemz;
    CoreLocale lang = getCurrTranslator();
    itemz.putAll(items);
    for (Object o : itemz.entrySet()) {
        Map.Entry e = (Map.Entry) o;
        String k = (String) e.getKey();
        String n = (String) e.getValue();
        if (n == null || "".equals(n)) {
            n = "fore.enum." + name + "." + namc + "." + k;
        }
        e.setValue(lang.translate(n));
    }
    return itemz;
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

CoreLocale (app.hongs.CoreLocale)22 HashMap (java.util.HashMap)15 Map (java.util.Map)15 Action (app.hongs.action.anno.Action)12 CommitSuccess (app.hongs.action.anno.CommitSuccess)7 NaviMap (app.hongs.action.NaviMap)5 IAction (app.hongs.dh.IAction)4 RoleMap (app.hongs.serv.auth.RoleMap)4 File (java.io.File)4 LinkedHashMap (java.util.LinkedHashMap)4 HongsException (app.hongs.HongsException)3 ActionRunner (app.hongs.action.ActionRunner)2 Verify (app.hongs.action.anno.Verify)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 Core (app.hongs.Core)1 HongsError (app.hongs.HongsError)1 HongsExpedient (app.hongs.HongsExpedient)1 FetchCase (app.hongs.db.util.FetchCase)1 Wrong (app.hongs.util.verify.Wrong)1