@Override public void Func_evaluate(Bry_bfr bfr, Xop_ctx ctx, Xot_invk caller, Xot_invk self, byte[] src) { byte[] user_name = Eval_argx(ctx, src, caller, self); byte[] when_m = Bry_.Empty, when_f = Bry_.Empty, when_u = Bry_.Empty; int self_args_len = self.Args_len(); if (self_args_len == 0) return; // per MW: EX: {{gender:name}} -> "" else { if (self_args_len > 0) { when_m = when_u = Pf_func_.Eval_arg_or_empty( ctx, src, caller, self, self_args_len, 0); // default when_u to when_m if (self_args_len > 1) { when_f = Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 1); if (self_args_len > 2) { when_u = Pf_func_.Eval_arg_or_empty(ctx, src, caller, self, self_args_len, 2); } } } } if (self_args_len == 1) { bfr.Add(when_m); return; } // per MW: EX: {{gender:name|a}} -> "a" int gender = Get_gender(ctx.App().User(), user_name); Xol_lang_itm lang = ctx.Page().Lang(); bfr.Add(lang.Gender().Gender_eval(gender, when_m, when_f, when_u)); }
public static void Reg( Xow_domain_itm domain_itm, gplx.xowa.langs.funcs.Xol_func_regy func_regy, Xol_lang_itm lang) { Xol_kwd_mgr kwd_mgr = lang.Kwd_mgr(); int[] kwd_ary = Ary_get(domain_itm, !lang.Kwd_mgr__strx()); int len = kwd_ary.length; for (int i = 0; i < len; i++) { int id = kwd_ary[i]; func_regy.Reg_defn(kwd_mgr, id, Get_prototype(id)); } }
private void Format_durations_init() { Xol_msg_mgr msg_mgr = lang.Msg_mgr(); int len = Xol_duration_itm_.Ary_default.length; interval_msgs = new Xol_msg_itm[len]; for (int i = 0; i < len; i++) { Xol_duration_itm itm = Xol_duration_itm_.Ary_default[i]; byte[] msg_key = Bry_.Add(Bry_duration, itm.Name_bry()); interval_msgs[i] = msg_mgr.Itm_by_key_or_new(msg_key); } }
private void List_to_str_init() { Xol_msg_mgr msg_mgr = lang.Msg_mgr(); Msg_and = msg_mgr.Val_by_str_or_empty("and"); Msg_word_separator = msg_mgr.Val_by_str_or_empty("word-separator"); Msg_comma_separator = msg_mgr.Val_by_str_or_empty("comma-separator"); }