mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.8.1.1'
This commit is contained in:
@@ -16,15 +16,17 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.langs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.xowa.apps.fsys.*;
|
||||
import gplx.xowa.langs.bldrs.*;
|
||||
import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.gfs.*;
|
||||
import gplx.xowa.langs.bldrs.*;
|
||||
public class Xoa_lang_mgr implements Gfo_invk {
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
private final Xobc_utl_make_lang mw_converter;
|
||||
public Xoa_lang_mgr(Xoa_app app) {
|
||||
public Xoa_lang_mgr(Xoa_app app, Xoa_gfs_mgr gfs_mgr) {
|
||||
this.mw_converter = new Xobc_utl_make_lang(this, app.Fsys_mgr(), app.Tid_is_edit() ? ((Xoae_app)app).Msg_log() : null);
|
||||
this.lang_en = Xol_lang_itm_.Lang_en_make(this); this.Add(lang_en);
|
||||
this.gfs_mgr = gfs_mgr;
|
||||
}
|
||||
public Xoa_gfs_mgr Gfs_mgr() {return gfs_mgr;} private final Xoa_gfs_mgr gfs_mgr;
|
||||
public Xol_lang_itm Lang_en() {return lang_en;} private final Xol_lang_itm lang_en;
|
||||
public void Clear() {hash.Clear();}
|
||||
public int Len() {return hash.Count();}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.langs; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.envs.*;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.xowa.langs.cases.*; import gplx.xowa.langs.msgs.*; import gplx.xowa.langs.kwds.*; import gplx.xowa.langs.grammars.*; import gplx.xowa.langs.genders.*; import gplx.xowa.langs.plurals.*; import gplx.xowa.langs.vnts.*; import gplx.xowa.langs.vnts.converts.*; import gplx.xowa.langs.numbers.*; import gplx.xowa.langs.durations.*; import gplx.xowa.langs.lnki_trails.*; import gplx.xowa.langs.funcs.*; import gplx.xowa.langs.specials.*; import gplx.xowa.langs.bldrs.*;
|
||||
import gplx.xowa.langs.cases.*; import gplx.xowa.langs.msgs.*; import gplx.xowa.langs.kwds.*; import gplx.xowa.langs.grammars.*; import gplx.xowa.langs.genders.*; import gplx.xowa.langs.plurals.*; import gplx.xowa.langs.vnts.*; import gplx.xowa.langs.vnts.converts.*; import gplx.xowa.langs.numbers.*; import gplx.xowa.langs.durations.*; import gplx.xowa.langs.lnki_trails.*; import gplx.xowa.langs.funcs.*; import gplx.xowa.langs.specials.*; import gplx.xowa.langs.bldrs.*; import gplx.xowa.langs.commas.*;
|
||||
import gplx.xowa.apps.gfs.*; import gplx.xowa.apps.fsys.*; import gplx.core.intls.*; import gplx.xowa.wikis.nss.*; import gplx.xowa.xtns.lst.*; import gplx.xowa.wikis.caches.*; import gplx.xowa.parsers.lnkis.*;
|
||||
import gplx.xowa.guis.langs.*;
|
||||
public class Xol_lang_itm implements Gfo_invk {
|
||||
@@ -55,6 +55,7 @@ public class Xol_lang_itm implements Gfo_invk {
|
||||
public Xol_case_mgr Case_mgr() {return case_mgr;} private Xol_case_mgr case_mgr;
|
||||
public void Case_mgr_u8_() {case_mgr = Xol_case_mgr_.U8();} // TEST:
|
||||
public Xol_lang_itm Case_mgr_(Xol_case_mgr v) {this.case_mgr = v; return this;} // TEST:
|
||||
public Xol_comma_wkr Comma_wkr() {return comma_wkr;} private final Xol_comma_wkr comma_wkr = new Xol_comma_wkr__add();
|
||||
public Xol_font_info Gui_font() {return gui_font;} private final Xol_font_info gui_font = new Xol_font_info(null, 0, FontStyleAdp_.Plain);
|
||||
public byte[] Fallback_bry() {return fallback_bry;}
|
||||
public Xol_lang_itm Fallback_bry_(byte[] v) {
|
||||
@@ -83,6 +84,7 @@ public class Xol_lang_itm implements Gfo_invk {
|
||||
public void Evt_lang_changed() {
|
||||
lnki_arg_parser.Evt_lang_changed(this);
|
||||
func_regy.Evt_lang_changed(this);
|
||||
comma_wkr.Evt_lang_changed(this);
|
||||
}
|
||||
private byte[] X_axis_end() {return dir_ltr ? X_axis_end_right : X_axis_end_left;}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
@@ -102,7 +104,7 @@ public class Xol_lang_itm implements Gfo_invk {
|
||||
else if (ctx.Match(k, Invk_link_trail)) return lnki_trail_mgr;
|
||||
else if (ctx.Match(k, Invk_x_axis_end)) return String_.new_u8(X_axis_end());
|
||||
else if (ctx.Match(k, Invk_this)) return this;
|
||||
else if (ctx.Match(k, Xoae_app.Invk_app)) return Xoa_app_.Gfs_mgr().Root_invk();
|
||||
else if (ctx.Match(k, Xoae_app.Invk_app)) return lang_mgr.Gfs_mgr().Root_invk();
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
@@ -137,7 +139,7 @@ public class Xol_lang_itm implements Gfo_invk {
|
||||
fallback_dupes_regy.Del(fallback_lang);
|
||||
}
|
||||
private void Load_lang(byte[] v) {
|
||||
Xoa_gfs_mgr gfs_mgr = Xoa_app_.Gfs_mgr(); Xoa_fsys_mgr app_fsys_mgr = gfs_mgr.App_fsys_mgr();
|
||||
Xoa_gfs_mgr gfs_mgr = lang_mgr.Gfs_mgr(); Xoa_fsys_mgr app_fsys_mgr = gfs_mgr.App_fsys_mgr();
|
||||
gfs_mgr.Run_url_for(this, Xol_lang_itm_.xo_lang_fil_(app_fsys_mgr, String_.new_a7(v)));
|
||||
gfs_mgr.Run_url_for(gfs_mgr.Root_invk(), Xol_convert_regy.Bld_url(app_fsys_mgr, key_str));
|
||||
}
|
||||
|
||||
@@ -344,24 +344,24 @@ public class Xol_mw_lang_parser {
|
||||
public static int Id_by_mw_name(byte[] src) {
|
||||
if (mw_names == null) {
|
||||
mw_names = Btrie_slim_mgr.cs();
|
||||
mw_names.Add_obj("NS_MEDIA", Int_obj_val.new_(Xow_ns_.Tid__media));
|
||||
mw_names.Add_obj("NS_SPECIAL", Int_obj_val.new_(Xow_ns_.Tid__special));
|
||||
mw_names.Add_obj("NS_MAIN", Int_obj_val.new_(Xow_ns_.Tid__main));
|
||||
mw_names.Add_obj("NS_TALK", Int_obj_val.new_(Xow_ns_.Tid__talk));
|
||||
mw_names.Add_obj("NS_USER", Int_obj_val.new_(Xow_ns_.Tid__user));
|
||||
mw_names.Add_obj("NS_USER_TALK", Int_obj_val.new_(Xow_ns_.Tid__user_talk));
|
||||
mw_names.Add_obj("NS_PROJECT", Int_obj_val.new_(Xow_ns_.Tid__project));
|
||||
mw_names.Add_obj("NS_PROJECT_TALK", Int_obj_val.new_(Xow_ns_.Tid__project_talk));
|
||||
mw_names.Add_obj("NS_FILE", Int_obj_val.new_(Xow_ns_.Tid__file));
|
||||
mw_names.Add_obj("NS_FILE_TALK", Int_obj_val.new_(Xow_ns_.Tid__file_talk));
|
||||
mw_names.Add_obj("NS_MEDIAWIKI", Int_obj_val.new_(Xow_ns_.Tid__mediawiki));
|
||||
mw_names.Add_obj("NS_MEDIAWIKI_TALK", Int_obj_val.new_(Xow_ns_.Tid__mediawiki_talk));
|
||||
mw_names.Add_obj("NS_TEMPLATE", Int_obj_val.new_(Xow_ns_.Tid__template));
|
||||
mw_names.Add_obj("NS_TEMPLATE_TALK", Int_obj_val.new_(Xow_ns_.Tid__template_talk));
|
||||
mw_names.Add_obj("NS_HELP", Int_obj_val.new_(Xow_ns_.Tid__help));
|
||||
mw_names.Add_obj("NS_HELP_TALK", Int_obj_val.new_(Xow_ns_.Tid__help_talk));
|
||||
mw_names.Add_obj("NS_CATEGORY", Int_obj_val.new_(Xow_ns_.Tid__category));
|
||||
mw_names.Add_obj("NS_CATEGORY_TALK", Int_obj_val.new_(Xow_ns_.Tid__category_talk));
|
||||
mw_names.Add_obj("NS_MEDIA", new Int_obj_val(Xow_ns_.Tid__media));
|
||||
mw_names.Add_obj("NS_SPECIAL", new Int_obj_val(Xow_ns_.Tid__special));
|
||||
mw_names.Add_obj("NS_MAIN", new Int_obj_val(Xow_ns_.Tid__main));
|
||||
mw_names.Add_obj("NS_TALK", new Int_obj_val(Xow_ns_.Tid__talk));
|
||||
mw_names.Add_obj("NS_USER", new Int_obj_val(Xow_ns_.Tid__user));
|
||||
mw_names.Add_obj("NS_USER_TALK", new Int_obj_val(Xow_ns_.Tid__user_talk));
|
||||
mw_names.Add_obj("NS_PROJECT", new Int_obj_val(Xow_ns_.Tid__project));
|
||||
mw_names.Add_obj("NS_PROJECT_TALK", new Int_obj_val(Xow_ns_.Tid__project_talk));
|
||||
mw_names.Add_obj("NS_FILE", new Int_obj_val(Xow_ns_.Tid__file));
|
||||
mw_names.Add_obj("NS_FILE_TALK", new Int_obj_val(Xow_ns_.Tid__file_talk));
|
||||
mw_names.Add_obj("NS_MEDIAWIKI", new Int_obj_val(Xow_ns_.Tid__mediawiki));
|
||||
mw_names.Add_obj("NS_MEDIAWIKI_TALK", new Int_obj_val(Xow_ns_.Tid__mediawiki_talk));
|
||||
mw_names.Add_obj("NS_TEMPLATE", new Int_obj_val(Xow_ns_.Tid__template));
|
||||
mw_names.Add_obj("NS_TEMPLATE_TALK", new Int_obj_val(Xow_ns_.Tid__template_talk));
|
||||
mw_names.Add_obj("NS_HELP", new Int_obj_val(Xow_ns_.Tid__help));
|
||||
mw_names.Add_obj("NS_HELP_TALK", new Int_obj_val(Xow_ns_.Tid__help_talk));
|
||||
mw_names.Add_obj("NS_CATEGORY", new Int_obj_val(Xow_ns_.Tid__category));
|
||||
mw_names.Add_obj("NS_CATEGORY_TALK", new Int_obj_val(Xow_ns_.Tid__category_talk));
|
||||
}
|
||||
Object o = mw_names.Match_exact(src, 0, src.length);
|
||||
return o == null ? Xow_ns_.Tid__null : ((Int_obj_val)o).Val();
|
||||
|
||||
@@ -42,11 +42,11 @@ public class Xol_mw_lang_parser_tst {
|
||||
;
|
||||
}
|
||||
@Test public void Core_keywords_func_currentmonth() {
|
||||
Tfds.Now_enabled_y_();
|
||||
Datetime_now.Manual_y_();
|
||||
fxt.Parse_core("$magicWords = array('currentmonth' => array(0, 'MOISACTUEL'));")
|
||||
.Tst_parse("{{MOISACTUEL}}", "01")
|
||||
;
|
||||
Tfds.Now_enabled_n_();
|
||||
Datetime_now.Manual_n_();
|
||||
}
|
||||
@Test public void Core_keywords_func_ns() {
|
||||
fxt.Parse_core("$magicWords = array('ns' => array(0, 'ESPACEN'));")
|
||||
|
||||
23
400_xowa/src/gplx/xowa/langs/commas/Xol_comma_wkr.java
Normal file
23
400_xowa/src/gplx/xowa/langs/commas/Xol_comma_wkr.java
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.langs.commas; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
|
||||
public interface Xol_comma_wkr {
|
||||
void Evt_lang_changed(Xol_lang_itm lang_itm);
|
||||
void Comma__itm(Bry_bfr bfr, int itm_idx, int itms_len);
|
||||
void Comma__end(Bry_bfr bfr);
|
||||
}
|
||||
30
400_xowa/src/gplx/xowa/langs/commas/Xol_comma_wkr__add.java
Normal file
30
400_xowa/src/gplx/xowa/langs/commas/Xol_comma_wkr__add.java
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.langs.commas; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
|
||||
import gplx.xowa.langs.msgs.*;
|
||||
public class Xol_comma_wkr__add implements Xol_comma_wkr {
|
||||
private byte[] comma_bry = Bry_.new_a7(", "); // needed for TEST
|
||||
public void Evt_lang_changed(Xol_lang_itm lang_itm) {
|
||||
this.comma_bry = lang_itm.Msg_mgr().Val_by_bry_or(Bry_.new_a7("comma-separator"), Byte_ascii.Comma_bry);
|
||||
}
|
||||
public void Comma__itm(Bry_bfr bfr, int itm_idx, int itms_len) {
|
||||
if (itm_idx != itms_len - 1)
|
||||
bfr.Add(comma_bry);
|
||||
}
|
||||
public void Comma__end(Bry_bfr bfr) {}
|
||||
}
|
||||
@@ -76,5 +76,5 @@ class Xol_duration_itm_sorter implements gplx.core.lists.ComparerAble {
|
||||
Xol_duration_itm rhs = (Xol_duration_itm)rhsObj;
|
||||
return -Long_.Compare(lhs.Seconds(), rhs.Seconds()); // - to sort from largest to smallest
|
||||
}
|
||||
public static final Xol_duration_itm_sorter Instance = new Xol_duration_itm_sorter(); Xol_duration_itm_sorter() {}
|
||||
public static final Xol_duration_itm_sorter Instance = new Xol_duration_itm_sorter(); Xol_duration_itm_sorter() {}// TS.static
|
||||
}
|
||||
|
||||
@@ -16,12 +16,14 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.langs.durations; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.langs.msgs.*;
|
||||
public class Xol_duration_mgr {
|
||||
private Xol_msg_itm[] interval_msgs = null;
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
|
||||
private final Bry_fmtr tmp_fmtr = Bry_fmtr.New__tmp();
|
||||
public Xol_duration_mgr(Xol_lang_itm lang) {this.lang = lang;} private Xol_lang_itm lang;
|
||||
private Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
|
||||
public Xol_interval_itm[] Get_duration_intervals(long seconds, Xol_duration_itm[] intervals) {
|
||||
if (intervals == null) intervals = Xol_duration_itm_.Ary_default;
|
||||
Array_.Sort(intervals, Xol_duration_itm_sorter.Instance);
|
||||
@@ -49,7 +51,7 @@ public class Xol_duration_mgr {
|
||||
for (int i = 0; i < intervals_len; i++) {
|
||||
Xol_interval_itm interval = intervals[i];
|
||||
Xol_msg_itm msg_itm = interval_msgs[interval.Duration_itm().Tid()];
|
||||
byte[] msg_bry = msg_itm.Fmt(tmp_bfr, interval.Val());
|
||||
byte[] msg_bry = msg_itm.Fmt(tmp_bfr, tmp_fmtr, interval.Val());
|
||||
msg_bry = ctx.Wiki().Parser_mgr().Main().Parse_text_to_html(ctx, msg_bry);
|
||||
msgs_ary[i] = msg_bry;
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ default: throw Err_.new_unhandled(id);
|
||||
int len = Bry__.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
byte[] bry = Bry__[i];
|
||||
hash.Add(bry, Int_obj_val.new_(i));
|
||||
hash.Add(bry, new Int_obj_val(i));
|
||||
}
|
||||
}
|
||||
Object o = hash.Get_by_bry(find);
|
||||
|
||||
@@ -19,31 +19,30 @@ package gplx.xowa.langs.msgs; import gplx.*; import gplx.xowa.*; import gplx.xow
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
public class Xol_msg_itm {
|
||||
public Xol_msg_itm(int id, byte[] key) {this.id = id; this.key = key;}
|
||||
public int Id() {return id;} private final int id;
|
||||
public byte[] Key() {return key;} private final byte[] key;
|
||||
public byte[] Val() {return val;} private byte[] val;
|
||||
public int Src() {return src;} public Xol_msg_itm Src_(int v) {src = v; return this;} private int src;
|
||||
public boolean Src_is_missing() {return src == Src_missing;}
|
||||
public boolean Has_fmt_arg() {return has_fmt_arg;} private boolean has_fmt_arg;
|
||||
public boolean Has_tmpl_txt() {return has_tmpl_txt;} private boolean has_tmpl_txt;
|
||||
public boolean Dirty() {return dirty;} public Xol_msg_itm Dirty_(boolean v) {dirty = v; return this;} private boolean dirty; // BLDR:
|
||||
public int Id() {return id;} private final int id;
|
||||
public byte[] Key() {return key;} private final byte[] key;
|
||||
public byte[] Val() {return val;} private byte[] val;
|
||||
public int Src() {return src;} private int src;
|
||||
public boolean Src_is_missing() {return src == Src_missing;}
|
||||
public boolean Has_fmt_arg() {return has_fmt_arg;} private boolean has_fmt_arg;
|
||||
public boolean Has_tmpl_txt() {return has_tmpl_txt;} private boolean has_tmpl_txt;
|
||||
public boolean Dirty() {return dirty;} private boolean dirty; // BLDR:
|
||||
|
||||
public Xol_msg_itm Src_(int v) {src = v; return this;}
|
||||
public Xol_msg_itm Dirty_(boolean v) {dirty = v; return this;}
|
||||
|
||||
public void Atrs_set(byte[] val, boolean has_fmt_arg, boolean has_tmpl_txt) {
|
||||
this.val = val; this.has_fmt_arg = has_fmt_arg; this.has_tmpl_txt = has_tmpl_txt;
|
||||
}
|
||||
public byte[] Fmt(Bry_bfr bfr, Object... args) {
|
||||
synchronized (tmp_fmtr) {
|
||||
tmp_fmtr.Fmt_(val);
|
||||
tmp_fmtr.Bld_bfr_many(bfr, args);
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
public byte[] Fmt(Bry_bfr bfr, Bry_fmtr fmtr, Object... args) {
|
||||
fmtr.Fmt_(val);
|
||||
fmtr.Bld_bfr_many(bfr, args);
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
public byte[] Fmt_tmp(Bry_bfr bfr, byte[] tmp_val, Object... args) {
|
||||
synchronized (tmp_fmtr) {
|
||||
tmp_fmtr.Fmt_(tmp_val);
|
||||
tmp_fmtr.Bld_bfr_many(bfr, args);
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
public byte[] Fmt_tmp(Bry_bfr bfr, Bry_fmtr fmtr, byte[] tmp_val, Object... args) {
|
||||
fmtr.Fmt_(tmp_val);
|
||||
fmtr.Bld_bfr_many(bfr, args);
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
public static final int Src_null = 0, Src_lang = 1, Src_wiki = 2, Src_missing = 3;
|
||||
private static Bry_fmtr tmp_fmtr = Bry_fmtr.tmp_();
|
||||
public static final int Src_null = 0, Src_lang = 1, Src_wiki = 2, Src_missing = 3;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ public static final int
|
||||
update_val_(rv, val);
|
||||
return rv;
|
||||
}
|
||||
private static final Bry_fmtr tmp_fmtr = Bry_fmtr.tmp_().Fail_when_invalid_escapes_(false);
|
||||
private static final Bry_fmtr tmp_fmtr = Bry_fmtr.New__tmp().Fail_when_invalid_escapes_(false);
|
||||
private static final Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
|
||||
public static void update_val_(Xol_msg_itm itm, byte[] val) {
|
||||
synchronized (tmp_fmtr) { // LOCK:static-objs; DATE:2016-07-07
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Xol_msg_mgr_ {
|
||||
return msg_itm == null ? null : String_.new_u8(msg_itm.Val());
|
||||
}
|
||||
public static byte[] Get_msg_val(Xowe_wiki wiki, Xol_lang_itm lang, byte[] msg_key, byte[][] fmt_args) {
|
||||
Bry_bfr tmp_bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
Xol_msg_itm msg_itm = Get_msg_itm(tmp_bfr, wiki, lang, msg_key);
|
||||
byte[] rv = Get_msg_val(tmp_bfr, wiki, msg_itm, fmt_args);
|
||||
tmp_bfr.Mkr_rls();
|
||||
@@ -52,7 +52,7 @@ public class Xol_msg_mgr_ {
|
||||
if (!has_fmt && !has_tmpl) // no fmt or tmpl; just add val
|
||||
return msg_val;
|
||||
if (has_fmt) { // fmt exists; fmt first (before tmpl text); EX: Expression error: Unrecognised word "~{0}"
|
||||
Bry_fmtr tmp_fmtr = Bry_fmtr.tmp_().Missing_bgn_(Missing_bry).Missing_end_(Bry_.Empty).Missing_adj_(1);
|
||||
Bry_fmtr tmp_fmtr = Bry_fmtr.New__tmp().Missing_bgn_(Missing_bry).Missing_end_(Bry_.Empty).Missing_adj_(1);
|
||||
tmp_fmtr.Fmt_(msg_val);
|
||||
tmp_fmtr.Bld_bfr(tmp_bfr, fmt_args);
|
||||
msg_val = tmp_bfr.To_bry_and_clear();
|
||||
|
||||
@@ -16,9 +16,11 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.langs.msgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.htmls.sidebar.*;
|
||||
public class Xow_msg_mgr implements Gfo_invk {
|
||||
private final Xowe_wiki wiki; private Xol_lang_itm lang; private final Xol_msg_mgr msg_mgr;
|
||||
private final Bry_fmtr tmp_fmtr = Bry_fmtr.New__tmp();
|
||||
public Xow_msg_mgr(Xowe_wiki wiki, Xol_lang_itm lang) {
|
||||
this.wiki = wiki;
|
||||
this.lang = lang;
|
||||
@@ -35,7 +37,7 @@ public class Xow_msg_mgr implements Gfo_invk {
|
||||
Xol_msg_itm itm = msg_mgr.Itm_by_id_or_null(id);
|
||||
if (itm == null)
|
||||
itm = lang.Msg_mgr().Itm_by_id_or_null(id);
|
||||
Bry_bfr tmp_bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
byte[] rv = Val_by_itm(tmp_bfr, itm, args);
|
||||
tmp_bfr.Mkr_rls();
|
||||
return rv;
|
||||
@@ -45,7 +47,7 @@ public class Xow_msg_mgr implements Gfo_invk {
|
||||
public Xol_msg_itm Find_or_null(byte[] key) {
|
||||
Xol_msg_itm itm = msg_mgr.Itm_by_key_or_null(key);
|
||||
if (itm == null) {
|
||||
Bry_bfr tmp_bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
itm = Xol_msg_mgr_.Get_msg_itm(tmp_bfr, wiki, lang, key);
|
||||
if (itm.Src_is_missing()) itm = null;
|
||||
tmp_bfr.Mkr_rls();
|
||||
@@ -57,7 +59,7 @@ public class Xow_msg_mgr implements Gfo_invk {
|
||||
public byte[] Val_by_key_obj(byte[] key) {return Val_by_key(key, null);}
|
||||
private byte[] Val_by_key(byte[] key, Object[] args) {
|
||||
Xol_msg_itm itm = msg_mgr.Itm_by_key_or_null(key);
|
||||
Bry_bfr tmp_bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
if (itm == null)
|
||||
itm = Xol_msg_mgr_.Get_msg_itm(tmp_bfr, wiki, lang, key);
|
||||
if (itm.Src_is_missing()) {
|
||||
@@ -70,12 +72,12 @@ public class Xow_msg_mgr implements Gfo_invk {
|
||||
}
|
||||
public byte[] Val_by_itm(Bry_bfr tmp_bfr, Xol_msg_itm itm, Object[] args) {
|
||||
byte[] rv = itm.Val();
|
||||
if (args != null) rv = itm.Fmt_tmp(tmp_bfr, rv, args);
|
||||
if (args != null) rv = itm.Fmt_tmp(tmp_bfr, tmp_fmtr, rv, args);
|
||||
if (itm.Has_tmpl_txt()) rv = wiki.Parser_mgr().Main().Expand_tmpl(rv);
|
||||
return rv;
|
||||
}
|
||||
public byte[] Val_html_accesskey_and_title(byte[] id) {
|
||||
Bry_bfr bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b512();
|
||||
byte[] rv = Val_html_accesskey_and_title(id, bfr, null);
|
||||
bfr.Mkr_rls();
|
||||
return rv;
|
||||
|
||||
@@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.langs.vnts.converts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*; import gplx.xowa.langs.vnts.*;
|
||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.data.tbls.*;
|
||||
public class Xol_convert_mgr {
|
||||
private final Ordered_hash tmp_page_list = Ordered_hash_.New_bry();
|
||||
private final Ordered_hash tmp_page_list = Ordered_hash_.New_bry();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
public Xol_convert_regy Converter_regy() {return converter_regy;} private final Xol_convert_regy converter_regy = new Xol_convert_regy();
|
||||
public Xol_convert_wkr[] Converter_ary() {return wkr_ary;} private Xol_convert_wkr[] wkr_ary; private int wkr_ary_len;
|
||||
public void Init(Xol_vnt_regy regy) {
|
||||
@@ -32,18 +33,12 @@ public class Xol_convert_mgr {
|
||||
}
|
||||
}
|
||||
public byte[] Convert_text(int vnt_idx, byte[] src, int bgn, int end) {
|
||||
Bry_bfr tmp_bfr = Xoa_app_.Utl__bfr_mkr().Get_m001();
|
||||
Xol_convert_wkr converter = wkr_ary[vnt_idx];
|
||||
converter.Convert_text(tmp_bfr, src, bgn, end);
|
||||
return tmp_bfr.To_bry_and_rls();
|
||||
}
|
||||
public Xowd_page_itm Convert_ttl(Xow_wiki wiki, Xoa_ttl ttl) {return Convert_ttl(wiki, ttl.Ns(), ttl.Page_db());} // NOTE: not Full_db as ttl.Ns is passed; EX:Шаблон:Šablon:Jez-eng; PAGE:sr.w:ДНК DATE:2014-07-06
|
||||
public Xowd_page_itm Convert_ttl(Xow_wiki wiki, Xow_ns ns, byte[] ttl_bry) {
|
||||
Bry_bfr tmp_bfr = Xoa_app_.Utl__bfr_mkr().Get_b512();
|
||||
Xowd_page_itm rv = Convert_ttl(wiki, tmp_bfr, ns, ttl_bry);
|
||||
tmp_bfr.Mkr_rls();
|
||||
return rv;
|
||||
return tmp_bfr.To_bry_and_clear();
|
||||
}
|
||||
public Xowd_page_itm Convert_ttl(Xow_wiki wiki, Xoa_ttl ttl) {return Convert_ttl(wiki, ttl.Ns(), ttl.Page_db());} // NOTE: not Full_db as ttl.Ns is passed; EX:Шаблон:Šablon:Jez-eng; PAGE:sr.w:ДНК DATE:2014-07-06
|
||||
public Xowd_page_itm Convert_ttl(Xow_wiki wiki, Xow_ns ns, byte[] ttl_bry) {return Convert_ttl(wiki, tmp_bfr, ns, ttl_bry);}
|
||||
private Xowd_page_itm Convert_ttl(Xow_wiki wiki, Bry_bfr tmp_bfr, Xow_ns ns, byte[] ttl_bry) { // REF.MW:LanguageConverter.php|findVariantLink
|
||||
synchronized (tmp_page_list) { // THREAD:
|
||||
int converted = Convert_ttl__convert_each_vnt(wiki, tmp_bfr, ns, ttl_bry); // convert ttl for each vnt
|
||||
|
||||
Reference in New Issue
Block a user