mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.7.2.1
This commit is contained in:
28
400_xowa/src_140_lang/gplx/xowa/Xobcl_kwd_row.java
Normal file
28
400_xowa/src_140_lang/gplx/xowa/Xobcl_kwd_row.java
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
public class Xobcl_kwd_row {
|
||||
public Xobcl_kwd_row(byte[] key, byte[][] itms) {
|
||||
this.key = key; this.itms = itms;
|
||||
for (byte[] itm : itms)
|
||||
itms_hash.Add(itm, itm);
|
||||
}
|
||||
public byte[] Key() {return key;} private byte[] key;
|
||||
public byte[][] Itms() {return itms;} private byte[][] itms;
|
||||
public boolean Itms_has(byte[] key) {return itms_hash.Has(key);} private Ordered_hash itms_hash = Ordered_hash_.new_bry_();
|
||||
}
|
||||
82
400_xowa/src_140_lang/gplx/xowa/Xol_csv_parser.java
Normal file
82
400_xowa/src_140_lang/gplx/xowa/Xol_csv_parser.java
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
public class Xol_csv_parser {
|
||||
public void Save(Bry_bfr bfr, byte[] src) {
|
||||
int len = src.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
byte b = src[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Cr: bfr.Add_byte(Byte_ascii.Backslash); bfr.Add_byte(Byte_ascii.Ltr_r); break;
|
||||
case Byte_ascii.Nl: bfr.Add_byte(Byte_ascii.Backslash); bfr.Add_byte(Byte_ascii.Ltr_n); break;
|
||||
case Byte_ascii.Tab: bfr.Add_byte(Byte_ascii.Backslash); bfr.Add_byte(Byte_ascii.Ltr_t); break;
|
||||
case Byte_ascii.Backslash: bfr.Add_byte(Byte_ascii.Backslash); bfr.Add_byte(Byte_ascii.Backslash); break;
|
||||
case Byte_ascii.Pipe: bfr.Add(Bry_pipe); break;
|
||||
default: bfr.Add_byte(b); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public byte[] Load(byte[] src, int bgn, int end) {Load(tmp_bfr, src, bgn, end); return tmp_bfr.Xto_bry_and_clear();}
|
||||
public void Load(Bry_bfr bfr, byte[] src) {Load(bfr, src, 0, src.length);}
|
||||
public void Load(Bry_bfr bfr, byte[] src, int bgn, int end) {
|
||||
for (int i = bgn; i < end; i++) {
|
||||
byte b = src[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Backslash: {
|
||||
int nxt_pos = i + 1; if (nxt_pos == end) throw Exc_.new_("backslash cannot be last character");
|
||||
byte nxt_byte = src[nxt_pos];
|
||||
switch (nxt_byte) {
|
||||
case Byte_ascii.Backslash: bfr.Add_byte(Byte_ascii.Backslash); break;
|
||||
case Byte_ascii.Ltr_r: bfr.Add_byte(Byte_ascii.Cr); break;
|
||||
case Byte_ascii.Ltr_n: bfr.Add_byte(Byte_ascii.Nl); break;
|
||||
case Byte_ascii.Ltr_t: bfr.Add_byte(Byte_ascii.Tab); break;
|
||||
case Byte_ascii.Ltr_u:
|
||||
int utf_len = 1;
|
||||
for (int j = i + 6; j < end; j += 6) { // iterate over rest of String; EX: \u0123
|
||||
if (j + 1 < end && src[j] == Byte_ascii.Backslash && src[j + 1] == Byte_ascii.Ltr_u)
|
||||
++utf_len;
|
||||
else
|
||||
break;
|
||||
}
|
||||
byte[] utf_bytes = new byte[utf_len]; int utf_idx = 0;
|
||||
int utf_pos = i + 2;
|
||||
for (int j = 0; j < utf_len; j++) {
|
||||
int utf_int = Int_.Xto_int_hex(src, utf_pos, utf_pos + 4);
|
||||
if (utf_int == -1) throw Exc_.new_("invalid value for \\u", "val", String_.new_u8(src, bgn, end));
|
||||
utf_bytes[utf_idx++] = (byte)utf_int;
|
||||
utf_pos += 6;
|
||||
}
|
||||
int utf_int_decoded = gplx.intl.Utf16_.Decode_to_int(utf_bytes, 0);
|
||||
bfr.Add(gplx.intl.Utf16_.Encode_int_to_bry(utf_int_decoded));
|
||||
nxt_pos = i + (utf_len * 6) - 1; // -1 b/c "for" will ++
|
||||
break;
|
||||
default:
|
||||
bfr.Add_byte(b).Add_byte(nxt_byte);
|
||||
break;
|
||||
}
|
||||
i = nxt_pos;
|
||||
break;
|
||||
}
|
||||
default: bfr.Add_byte(b); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private static final byte[] Bry_pipe = Bry_.new_a7("\\u007C");
|
||||
private static final Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
public static final Xol_csv_parser _ = new Xol_csv_parser(); Xol_csv_parser() {}
|
||||
}
|
||||
41
400_xowa/src_140_lang/gplx/xowa/Xol_csv_parser_tst.java
Normal file
41
400_xowa/src_140_lang/gplx/xowa/Xol_csv_parser_tst.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class Xol_csv_parser_tst {
|
||||
Xol_csv_parser_fxt fxt = new Xol_csv_parser_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
@Test public void Save() {fxt.Tst_save("a\r\n\t|d", "a\\r\\n\\t\\u007Cd");}
|
||||
@Test public void Load() {fxt.Tst_load("a\r\n\t|d", "a\\r\\n\\t\\u007Cd");}
|
||||
@Test public void Save_backslash() {fxt.Tst_save("a\\\\n", "a\\\\\\\\n");}
|
||||
@Test public void Load_backslash() {fxt.Tst_load("a\\\\n", "a\\\\\\\\n");}
|
||||
@Test public void Utf() {fxt.Tst_load(" ", "\\u00c2\\u00a0");} // NOTE: 1st String is nbsp;
|
||||
}
|
||||
class Xol_csv_parser_fxt {
|
||||
Xol_csv_parser parser = Xol_csv_parser._; Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
public void Clear() {}
|
||||
public void Tst_save(String raw, String expd) {
|
||||
parser.Save(tmp_bfr, Bry_.new_u8(raw));
|
||||
Tfds.Eq(expd, tmp_bfr.Xto_str_and_clear());
|
||||
}
|
||||
public void Tst_load(String expd, String raw_str) {
|
||||
byte[] raw = Bry_.new_u8(raw_str);
|
||||
parser.Load(tmp_bfr, raw, 0, raw.length);
|
||||
Tfds.Eq(expd, tmp_bfr.Xto_str_and_clear());
|
||||
}
|
||||
}
|
||||
41
400_xowa/src_140_lang/gplx/xowa/Xol_font_info.java
Normal file
41
400_xowa/src_140_lang/gplx/xowa/Xol_font_info.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import gplx.gfui.*;
|
||||
public class Xol_font_info implements GfoInvkAble, GfoEvMgrOwner {
|
||||
public Xol_font_info(String name, float size, FontStyleAdp style) {this.name = name; this.size = size; this.style = style;}
|
||||
public GfoEvMgr EvMgr() {if (evMgr == null) evMgr = GfoEvMgr.new_(this); return evMgr;} GfoEvMgr evMgr;
|
||||
public String Name() {return name;} public Xol_font_info Name_(String v) {name = v; Font_changed_pub(); return this;} private String name;
|
||||
public float Size() {return size;} public Xol_font_info Size_(float v) {size = v; Font_changed_pub(); return this;} private float size;
|
||||
public FontStyleAdp Style() {return style;} public Xol_font_info Style_(FontStyleAdp v) {style = v; Font_changed_pub(); return this;} private FontStyleAdp style;
|
||||
public Xol_font_info CloneNew() {return new Xol_font_info(name, size, style);}
|
||||
public FontAdp XtoFontAdp() {return FontAdp.new_(name, size, style);}
|
||||
public boolean Eq(FontAdp font) {return String_.Eq(name, font.Name()) && size == font.Size() && style.Val() == font.Style().Val();}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_name)) return name;
|
||||
else if (ctx.Match(k, Invk_name_)) Name_(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_size)) return size;
|
||||
else if (ctx.Match(k, Invk_size_)) Size_(m.ReadFloat("v"));
|
||||
else if (ctx.Match(k, Invk_style_)) Style_(FontStyleAdp_.parse_(m.ReadStr("v")));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_name = "name", Invk_name_ = "name_", Invk_size = "size", Invk_size_ = "size_", Invk_style_ = "style_";
|
||||
public static final String Font_changed = "font_changed";
|
||||
private void Font_changed_pub() {GfoEvMgr_.PubObj(this, Font_changed, "font", this);}
|
||||
}
|
||||
34
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_grp.java
Normal file
34
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_grp.java
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
public class Xol_kwd_grp {// REF.MW: Messages_en.php; EX: 'redirect' => array( 0, '#REDIRECT' )
|
||||
public Xol_kwd_grp(byte[] key) {this.key = key;}
|
||||
public byte[] Key() {return key;} private final byte[] key;
|
||||
public boolean Case_match() {return case_match;} private boolean case_match;
|
||||
public Xol_kwd_itm[] Itms() {return itms;} private Xol_kwd_itm[] itms = Xol_kwd_itm.Ary_empty;
|
||||
public void Srl_load(boolean case_match, byte[][] words) {
|
||||
this.case_match = case_match;
|
||||
int words_len = words.length;
|
||||
itms = new Xol_kwd_itm[words_len];
|
||||
for (int i = 0; i < words_len; i++) {
|
||||
byte[] word = words[i];
|
||||
Xol_kwd_itm itm = new Xol_kwd_itm(word);
|
||||
itms[i] = itm;
|
||||
}
|
||||
}
|
||||
}
|
||||
465
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_grp_.java
Normal file
465
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_grp_.java
Normal file
@@ -0,0 +1,465 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Xol_kwd_grp_ {
|
||||
public static final int
|
||||
Id_redirect = 0
|
||||
, Id_notoc = 1
|
||||
, Id_nogallery = 2
|
||||
, Id_forcetoc = 3
|
||||
, Id_toc = 4
|
||||
, Id_noeditsection = 5
|
||||
, Id_noheader = 6
|
||||
, Id_utc_month_int_len2 = 7
|
||||
, Id_utc_month_int = 8
|
||||
, Id_utc_month_name = 9
|
||||
, Id_utc_month_gen = 10
|
||||
, Id_utc_month_abrv = 11
|
||||
, Id_utc_day_int = 12
|
||||
, Id_utc_day_int_len2 = 13
|
||||
, Id_utc_day_name = 14
|
||||
, Id_utc_year = 15
|
||||
, Id_utc_time = 16
|
||||
, Id_utc_hour = 17
|
||||
, Id_lcl_month_int_len2 = 18
|
||||
, Id_lcl_month_int = 19
|
||||
, Id_lcl_month_name = 20
|
||||
, Id_lcl_month_gen = 21
|
||||
, Id_lcl_month_abrv = 22
|
||||
, Id_lcl_day_int = 23
|
||||
, Id_lcl_day_int_len2 = 24
|
||||
, Id_lcl_day_name = 25
|
||||
, Id_lcl_year = 26
|
||||
, Id_lcl_time = 27
|
||||
, Id_lcl_hour = 28
|
||||
, Id_num_pages = 29
|
||||
, Id_num_articles = 30
|
||||
, Id_num_files = 31
|
||||
, Id_num_users = 32
|
||||
, Id_num_users_active = 33
|
||||
, Id_num_edits = 34
|
||||
, Id_num_views = 35
|
||||
, Id_ttl_page_txt = 36
|
||||
, Id_ttl_page_url = 37
|
||||
, Id_ns_txt = 38
|
||||
, Id_ns_url = 39
|
||||
, Id_ns_talk_txt = 40
|
||||
, Id_ns_talk_url = 41
|
||||
, Id_ns_subj_txt = 42
|
||||
, Id_ns_subj_url = 43
|
||||
, Id_ttl_full_txt = 44
|
||||
, Id_ttl_full_url = 45
|
||||
, Id_ttl_leaf_txt = 46
|
||||
, Id_ttl_leaf_url = 47
|
||||
, Id_ttl_base_txt = 48
|
||||
, Id_ttl_base_url = 49
|
||||
, Id_ttl_talk_txt = 50
|
||||
, Id_ttl_talk_url = 51
|
||||
, Id_ttl_subj_txt = 52
|
||||
, Id_ttl_subj_url = 53
|
||||
, Id_msg = 54
|
||||
, Id_subst = 55
|
||||
, Id_safesubst = 56
|
||||
, Id_msgnw = 57
|
||||
, Id_img_thumbnail = 58
|
||||
, Id_img_manualthumb = 59
|
||||
, Id_img_framed = 60
|
||||
, Id_img_frameless = 61
|
||||
, Id_img_upright = 62
|
||||
, Id_img_upright_factor = 63
|
||||
, Id_img_border = 64
|
||||
, Id_img_align = 65
|
||||
, Id_img_valign = 66
|
||||
, Id_img_alt = 67
|
||||
, Id_img_class = 68
|
||||
, Id_img_caption = 69
|
||||
, Id_img_link_url = 70
|
||||
, Id_img_link_title = 71
|
||||
, Id_img_link_target = 72
|
||||
, Id_img_link_none = 73
|
||||
, Id_img_width = 74
|
||||
, Id_img_page = 75
|
||||
, Id_img_none = 76
|
||||
, Id_img_right = 77
|
||||
, Id_img_center = 78
|
||||
, Id_img_left = 79
|
||||
, Id_img_baseline = 80
|
||||
, Id_img_sub = 81
|
||||
, Id_img_super = 82
|
||||
, Id_img_top = 83
|
||||
, Id_img_text_top = 84
|
||||
, Id_img_middle = 85
|
||||
, Id_img_bottom = 86
|
||||
, Id_img_text_bottom = 87
|
||||
, Id_img_link = 88
|
||||
, Id_i18n_int = 89
|
||||
, Id_site_sitename = 90
|
||||
, Id_url_ns = 91
|
||||
, Id_url_nse = 92
|
||||
, Id_url_localurl = 93
|
||||
, Id_url_localurle = 94
|
||||
, Id_site_articlepath = 95
|
||||
, Id_site_server = 96
|
||||
, Id_site_servername = 97
|
||||
, Id_site_scriptpath = 98
|
||||
, Id_site_stylepath = 99
|
||||
, Id_i18n_grammar = 100
|
||||
, Id_i18n_gender = 101
|
||||
, Id_notitleconvert = 102
|
||||
, Id_nocontentconvert = 103
|
||||
, Id_utc_week = 104
|
||||
, Id_utc_dow = 105
|
||||
, Id_lcl_week = 106
|
||||
, Id_lcl_dow = 107
|
||||
, Id_rev_id = 108
|
||||
, Id_rev_day_int = 109
|
||||
, Id_rev_day_int_len2 = 110
|
||||
, Id_rev_month_int_len2 = 111
|
||||
, Id_rev_month_int = 112
|
||||
, Id_rev_year = 113
|
||||
, Id_rev_timestamp = 114
|
||||
, Id_rev_user = 115
|
||||
, Id_i18n_plural = 116
|
||||
, Id_url_fullurl = 117
|
||||
, Id_url_fullurle = 118
|
||||
, Id_str_lcfirst = 119
|
||||
, Id_str_ucfirst = 120
|
||||
, Id_str_lc = 121
|
||||
, Id_str_uc = 122
|
||||
, Id_raw = 123
|
||||
, Id_page_displaytitle = 124
|
||||
, Id_str_rawsuffix = 125
|
||||
, Id_newsectionlink = 126
|
||||
, Id_nonewsectionlink = 127
|
||||
, Id_site_currentversion = 128
|
||||
, Id_url_urlencode = 129
|
||||
, Id_url_anchorencode = 130
|
||||
, Id_utc_timestamp = 131
|
||||
, Id_lcl_timestamp = 132
|
||||
, Id_site_directionmark = 133
|
||||
, Id_i18n_language = 134
|
||||
, Id_site_contentlanguage = 135
|
||||
, Id_site_pagesinnamespace = 136
|
||||
, Id_num_admins = 137
|
||||
, Id_str_formatnum = 138
|
||||
, Id_str_padleft = 139
|
||||
, Id_str_padright = 140
|
||||
, Id_misc_special = 141
|
||||
, Id_page_defaultsort = 142
|
||||
, Id_url_filepath = 143
|
||||
, Id_misc_tag = 144
|
||||
, Id_hiddencat = 145
|
||||
, Id_site_pagesincategory = 146
|
||||
, Id_rev_pagesize = 147
|
||||
, Id_index = 148
|
||||
, Id_noindex = 149
|
||||
, Id_site_numberingroup = 150
|
||||
, Id_staticredirect = 151
|
||||
, Id_rev_protectionlevel = 152
|
||||
, Id_str_formatdate = 153
|
||||
, Id_url_path = 154
|
||||
, Id_url_wiki = 155
|
||||
, Id_url_query = 156
|
||||
, Id_xtn_expr = 157
|
||||
, Id_xtn_if = 158
|
||||
, Id_xtn_ifeq = 159
|
||||
, Id_xtn_ifexpr = 160
|
||||
, Id_xtn_iferror = 161
|
||||
, Id_xtn_switch = 162
|
||||
, Id_xtn_default = 163
|
||||
, Id_xtn_ifexist = 164
|
||||
, Id_xtn_time = 165
|
||||
, Id_xtn_timel = 166
|
||||
, Id_xtn_rel2abs = 167
|
||||
, Id_xtn_titleparts = 168
|
||||
, Id_xowa_dbg = 169
|
||||
, Id_ogg_noplayer = 170
|
||||
, Id_ogg_noicon = 171
|
||||
, Id_ogg_thumbtime = 172
|
||||
, Id_xtn_geodata_coordinates = 173
|
||||
, Id_url_canonicalurl = 174
|
||||
, Id_url_canonicalurle = 175
|
||||
, Id_lst = 176
|
||||
, Id_lstx = 177
|
||||
, Id_invoke = 178
|
||||
, Id_property = 179
|
||||
, Id_noexternallanglinks = 180
|
||||
, Id_ns_num = 181
|
||||
, Id_page_id = 182
|
||||
, Id_disambig = 183
|
||||
, Id_nocommafysuffix = 184
|
||||
, Id_xowa = 185
|
||||
, Id_mapSources_deg2dd = 186
|
||||
, Id_mapSources_dd2dms = 187
|
||||
, Id_mapSources_geoLink = 188
|
||||
, Id_geoCrumbs_isin = 189
|
||||
, Id_relatedArticles = 190
|
||||
, Id_insider = 191
|
||||
, Id_massMessage_target = 192
|
||||
, Id_cascadingSources = 193
|
||||
, Id_pendingChangeLevel = 194
|
||||
, Id_pagesUsingPendingChanges = 195
|
||||
, Id_bang = 196
|
||||
, Id_wbreponame = 197
|
||||
, Id_strx_len = 198
|
||||
, Id_strx_pos = 199
|
||||
, Id_strx_rpos = 200
|
||||
, Id_strx_sub = 201
|
||||
, Id_strx_count = 202
|
||||
, Id_strx_replace = 203
|
||||
, Id_strx_explode = 204
|
||||
, Id_strx_urldecode = 205
|
||||
;
|
||||
public static final int Id__max = 206;
|
||||
|
||||
private static byte[] ary_itm_(int id) {
|
||||
switch (id) {
|
||||
case Xol_kwd_grp_.Id_redirect: return Bry_.new_u8("redirect");
|
||||
case Xol_kwd_grp_.Id_notoc: return Bry_.new_u8("notoc");
|
||||
case Xol_kwd_grp_.Id_nogallery: return Bry_.new_u8("nogallery");
|
||||
case Xol_kwd_grp_.Id_forcetoc: return Bry_.new_u8("forcetoc");
|
||||
case Xol_kwd_grp_.Id_toc: return Bry_.new_u8("toc");
|
||||
case Xol_kwd_grp_.Id_noeditsection: return Bry_.new_u8("noeditsection");
|
||||
case Xol_kwd_grp_.Id_noheader: return Bry_.new_u8("noheader");
|
||||
case Xol_kwd_grp_.Id_utc_month_int_len2: return Bry_.new_u8("currentmonth");
|
||||
case Xol_kwd_grp_.Id_utc_month_int: return Bry_.new_u8("currentmonth1");
|
||||
case Xol_kwd_grp_.Id_utc_month_name: return Bry_.new_u8("currentmonthname");
|
||||
case Xol_kwd_grp_.Id_utc_month_gen: return Bry_.new_u8("currentmonthnamegen");
|
||||
case Xol_kwd_grp_.Id_utc_month_abrv: return Bry_.new_u8("currentmonthabbrev");
|
||||
case Xol_kwd_grp_.Id_utc_day_int: return Bry_.new_u8("currentday");
|
||||
case Xol_kwd_grp_.Id_utc_day_int_len2: return Bry_.new_u8("currentday2");
|
||||
case Xol_kwd_grp_.Id_utc_day_name: return Bry_.new_u8("currentdayname");
|
||||
case Xol_kwd_grp_.Id_utc_year: return Bry_.new_u8("currentyear");
|
||||
case Xol_kwd_grp_.Id_utc_time: return Bry_.new_u8("currenttime");
|
||||
case Xol_kwd_grp_.Id_utc_hour: return Bry_.new_u8("currenthour");
|
||||
case Xol_kwd_grp_.Id_lcl_month_int_len2: return Bry_.new_u8("localmonth");
|
||||
case Xol_kwd_grp_.Id_lcl_month_int: return Bry_.new_u8("localmonth1");
|
||||
case Xol_kwd_grp_.Id_lcl_month_name: return Bry_.new_u8("localmonthname");
|
||||
case Xol_kwd_grp_.Id_lcl_month_gen: return Bry_.new_u8("localmonthnamegen");
|
||||
case Xol_kwd_grp_.Id_lcl_month_abrv: return Bry_.new_u8("localmonthabbrev");
|
||||
case Xol_kwd_grp_.Id_lcl_day_int: return Bry_.new_u8("localday");
|
||||
case Xol_kwd_grp_.Id_lcl_day_int_len2: return Bry_.new_u8("localday2");
|
||||
case Xol_kwd_grp_.Id_lcl_day_name: return Bry_.new_u8("localdayname");
|
||||
case Xol_kwd_grp_.Id_lcl_year: return Bry_.new_u8("localyear");
|
||||
case Xol_kwd_grp_.Id_lcl_time: return Bry_.new_u8("localtime");
|
||||
case Xol_kwd_grp_.Id_lcl_hour: return Bry_.new_u8("localhour");
|
||||
case Xol_kwd_grp_.Id_num_pages: return Bry_.new_u8("numberofpages");
|
||||
case Xol_kwd_grp_.Id_num_articles: return Bry_.new_u8("numberofarticles");
|
||||
case Xol_kwd_grp_.Id_num_files: return Bry_.new_u8("numberoffiles");
|
||||
case Xol_kwd_grp_.Id_num_users: return Bry_.new_u8("numberofusers");
|
||||
case Xol_kwd_grp_.Id_num_users_active: return Bry_.new_u8("numberofactiveusers");
|
||||
case Xol_kwd_grp_.Id_num_edits: return Bry_.new_u8("numberofedits");
|
||||
case Xol_kwd_grp_.Id_num_views: return Bry_.new_u8("numberofviews");
|
||||
case Xol_kwd_grp_.Id_ttl_page_txt: return Bry_.new_u8("pagename");
|
||||
case Xol_kwd_grp_.Id_ttl_page_url: return Bry_.new_u8("pagenamee");
|
||||
case Xol_kwd_grp_.Id_ns_txt: return Bry_.new_u8("namespace");
|
||||
case Xol_kwd_grp_.Id_ns_url: return Bry_.new_u8("namespacee");
|
||||
case Xol_kwd_grp_.Id_ns_talk_txt: return Bry_.new_u8("talkspace");
|
||||
case Xol_kwd_grp_.Id_ns_talk_url: return Bry_.new_u8("talkspacee");
|
||||
case Xol_kwd_grp_.Id_ns_subj_txt: return Bry_.new_u8("subjectspace");
|
||||
case Xol_kwd_grp_.Id_ns_subj_url: return Bry_.new_u8("subjectspacee");
|
||||
case Xol_kwd_grp_.Id_ttl_full_txt: return Bry_.new_u8("fullpagename");
|
||||
case Xol_kwd_grp_.Id_ttl_full_url: return Bry_.new_u8("fullpagenamee");
|
||||
case Xol_kwd_grp_.Id_ttl_leaf_txt: return Bry_.new_u8("subpagename");
|
||||
case Xol_kwd_grp_.Id_ttl_leaf_url: return Bry_.new_u8("subpagenamee");
|
||||
case Xol_kwd_grp_.Id_ttl_base_txt: return Bry_.new_u8("basepagename");
|
||||
case Xol_kwd_grp_.Id_ttl_base_url: return Bry_.new_u8("basepagenamee");
|
||||
case Xol_kwd_grp_.Id_ttl_talk_txt: return Bry_.new_u8("talkpagename");
|
||||
case Xol_kwd_grp_.Id_ttl_talk_url: return Bry_.new_u8("talkpagenamee");
|
||||
case Xol_kwd_grp_.Id_ttl_subj_txt: return Bry_.new_u8("subjectpagename");
|
||||
case Xol_kwd_grp_.Id_ttl_subj_url: return Bry_.new_u8("subjectpagenamee");
|
||||
case Xol_kwd_grp_.Id_msg: return Bry_.new_u8("msg");
|
||||
case Xol_kwd_grp_.Id_subst: return Bry_.new_u8("subst");
|
||||
case Xol_kwd_grp_.Id_safesubst: return Bry_.new_u8("safesubst");
|
||||
case Xol_kwd_grp_.Id_msgnw: return Bry_.new_u8("msgnw");
|
||||
case Xol_kwd_grp_.Id_img_thumbnail: return Bry_.new_u8("img_thumbnail");
|
||||
case Xol_kwd_grp_.Id_img_manualthumb: return Bry_.new_u8("img_manualthumb");
|
||||
case Xol_kwd_grp_.Id_img_framed: return Bry_.new_u8("img_framed");
|
||||
case Xol_kwd_grp_.Id_img_frameless: return Bry_.new_u8("img_frameless");
|
||||
case Xol_kwd_grp_.Id_img_upright: return Bry_.new_u8("img_upright");
|
||||
case Xol_kwd_grp_.Id_img_upright_factor: return Bry_.new_u8("img_upright_factor");
|
||||
case Xol_kwd_grp_.Id_img_border: return Bry_.new_u8("img_border");
|
||||
case Xol_kwd_grp_.Id_img_align: return Bry_.new_u8("img_align");
|
||||
case Xol_kwd_grp_.Id_img_valign: return Bry_.new_u8("img_valign");
|
||||
case Xol_kwd_grp_.Id_img_alt: return Bry_.new_u8("img_alt");
|
||||
case Xol_kwd_grp_.Id_img_class: return Bry_.new_u8("img_class");
|
||||
case Xol_kwd_grp_.Id_img_caption: return Bry_.new_u8("img_caption");
|
||||
case Xol_kwd_grp_.Id_img_link_url: return Bry_.new_u8("img_link_url");
|
||||
case Xol_kwd_grp_.Id_img_link_title: return Bry_.new_u8("img_link_title");
|
||||
case Xol_kwd_grp_.Id_img_link_target: return Bry_.new_u8("img_link_target");
|
||||
case Xol_kwd_grp_.Id_img_link_none: return Bry_.new_u8("img_link_none");
|
||||
case Xol_kwd_grp_.Id_img_width: return Bry_.new_u8("img_width");
|
||||
case Xol_kwd_grp_.Id_img_page: return Bry_.new_u8("img_page");
|
||||
case Xol_kwd_grp_.Id_img_none: return Bry_.new_u8("img_none");
|
||||
case Xol_kwd_grp_.Id_img_right: return Bry_.new_u8("img_right");
|
||||
case Xol_kwd_grp_.Id_img_center: return Bry_.new_u8("img_center");
|
||||
case Xol_kwd_grp_.Id_img_left: return Bry_.new_u8("img_left");
|
||||
case Xol_kwd_grp_.Id_img_baseline: return Bry_.new_u8("img_baseline");
|
||||
case Xol_kwd_grp_.Id_img_sub: return Bry_.new_u8("img_sub");
|
||||
case Xol_kwd_grp_.Id_img_super: return Bry_.new_u8("img_super");
|
||||
case Xol_kwd_grp_.Id_img_top: return Bry_.new_u8("img_top");
|
||||
case Xol_kwd_grp_.Id_img_text_top: return Bry_.new_u8("img_text_top");
|
||||
case Xol_kwd_grp_.Id_img_middle: return Bry_.new_u8("img_middle");
|
||||
case Xol_kwd_grp_.Id_img_bottom: return Bry_.new_u8("img_bottom");
|
||||
case Xol_kwd_grp_.Id_img_text_bottom: return Bry_.new_u8("img_text_bottom");
|
||||
case Xol_kwd_grp_.Id_img_link: return Bry_.new_u8("img_link");
|
||||
case Xol_kwd_grp_.Id_i18n_int: return Bry_.new_u8("int");
|
||||
case Xol_kwd_grp_.Id_site_sitename: return Bry_.new_u8("sitename");
|
||||
case Xol_kwd_grp_.Id_url_ns: return Bry_.new_u8("ns");
|
||||
case Xol_kwd_grp_.Id_url_nse: return Bry_.new_u8("nse");
|
||||
case Xol_kwd_grp_.Id_url_localurl: return Bry_.new_u8("localurl");
|
||||
case Xol_kwd_grp_.Id_url_localurle: return Bry_.new_u8("localurle");
|
||||
case Xol_kwd_grp_.Id_site_articlepath: return Bry_.new_u8("articlepath");
|
||||
case Xol_kwd_grp_.Id_site_server: return Bry_.new_u8("server");
|
||||
case Xol_kwd_grp_.Id_site_servername: return Bry_.new_u8("servername");
|
||||
case Xol_kwd_grp_.Id_site_scriptpath: return Bry_.new_u8("scriptpath");
|
||||
case Xol_kwd_grp_.Id_site_stylepath: return Bry_.new_u8("stylepath");
|
||||
case Xol_kwd_grp_.Id_i18n_grammar: return Bry_.new_u8("grammar");
|
||||
case Xol_kwd_grp_.Id_i18n_gender: return Bry_.new_u8("gender");
|
||||
case Xol_kwd_grp_.Id_notitleconvert: return Bry_.new_u8("notitleconvert");
|
||||
case Xol_kwd_grp_.Id_nocontentconvert: return Bry_.new_u8("nocontentconvert");
|
||||
case Xol_kwd_grp_.Id_utc_week: return Bry_.new_u8("currentweek");
|
||||
case Xol_kwd_grp_.Id_utc_dow: return Bry_.new_u8("currentdow");
|
||||
case Xol_kwd_grp_.Id_lcl_week: return Bry_.new_u8("localweek");
|
||||
case Xol_kwd_grp_.Id_lcl_dow: return Bry_.new_u8("localdow");
|
||||
case Xol_kwd_grp_.Id_rev_id: return Bry_.new_u8("revisionid");
|
||||
case Xol_kwd_grp_.Id_rev_day_int: return Bry_.new_u8("revisionday");
|
||||
case Xol_kwd_grp_.Id_rev_day_int_len2: return Bry_.new_u8("revisionday2");
|
||||
case Xol_kwd_grp_.Id_rev_month_int_len2: return Bry_.new_u8("revisionmonth");
|
||||
case Xol_kwd_grp_.Id_rev_month_int: return Bry_.new_u8("revisionmonth1");
|
||||
case Xol_kwd_grp_.Id_rev_year: return Bry_.new_u8("revisionyear");
|
||||
case Xol_kwd_grp_.Id_rev_timestamp: return Bry_.new_u8("revisiontimestamp");
|
||||
case Xol_kwd_grp_.Id_rev_user: return Bry_.new_u8("revisionuser");
|
||||
case Xol_kwd_grp_.Id_i18n_plural: return Bry_.new_u8("plural");
|
||||
case Xol_kwd_grp_.Id_url_fullurl: return Bry_.new_u8("fullurl");
|
||||
case Xol_kwd_grp_.Id_url_fullurle: return Bry_.new_u8("fullurle");
|
||||
case Xol_kwd_grp_.Id_str_lcfirst: return Bry_.new_u8("lcfirst");
|
||||
case Xol_kwd_grp_.Id_str_ucfirst: return Bry_.new_u8("ucfirst");
|
||||
case Xol_kwd_grp_.Id_str_lc: return Bry_.new_u8("lc");
|
||||
case Xol_kwd_grp_.Id_str_uc: return Bry_.new_u8("uc");
|
||||
case Xol_kwd_grp_.Id_raw: return Bry_.new_u8("raw");
|
||||
case Xol_kwd_grp_.Id_page_displaytitle: return Bry_.new_u8("displaytitle");
|
||||
case Xol_kwd_grp_.Id_str_rawsuffix: return Bry_.new_u8("rawsuffix");
|
||||
case Xol_kwd_grp_.Id_newsectionlink: return Bry_.new_u8("newsectionlink");
|
||||
case Xol_kwd_grp_.Id_nonewsectionlink: return Bry_.new_u8("nonewsectionlink");
|
||||
case Xol_kwd_grp_.Id_site_currentversion: return Bry_.new_u8("currentversion");
|
||||
case Xol_kwd_grp_.Id_url_urlencode: return Bry_.new_u8("urlencode");
|
||||
case Xol_kwd_grp_.Id_url_anchorencode: return Bry_.new_u8("anchorencode");
|
||||
case Xol_kwd_grp_.Id_utc_timestamp: return Bry_.new_u8("currenttimestamp");
|
||||
case Xol_kwd_grp_.Id_lcl_timestamp: return Bry_.new_u8("localtimestamp");
|
||||
case Xol_kwd_grp_.Id_site_directionmark: return Bry_.new_u8("directionmark");
|
||||
case Xol_kwd_grp_.Id_i18n_language: return Bry_.new_u8("language");
|
||||
case Xol_kwd_grp_.Id_site_contentlanguage: return Bry_.new_u8("contentlanguage");
|
||||
case Xol_kwd_grp_.Id_site_pagesinnamespace: return Bry_.new_u8("pagesinnamespace");
|
||||
case Xol_kwd_grp_.Id_num_admins: return Bry_.new_u8("numberofadmins");
|
||||
case Xol_kwd_grp_.Id_str_formatnum: return Bry_.new_u8("formatnum");
|
||||
case Xol_kwd_grp_.Id_str_padleft: return Bry_.new_u8("padleft");
|
||||
case Xol_kwd_grp_.Id_str_padright: return Bry_.new_u8("padright");
|
||||
case Xol_kwd_grp_.Id_misc_special: return Bry_.new_u8("special");
|
||||
case Xol_kwd_grp_.Id_page_defaultsort: return Bry_.new_u8("defaultsort");
|
||||
case Xol_kwd_grp_.Id_url_filepath: return Bry_.new_u8("filepath");
|
||||
case Xol_kwd_grp_.Id_misc_tag: return Bry_.new_u8("tag");
|
||||
case Xol_kwd_grp_.Id_hiddencat: return Bry_.new_u8("hiddencat");
|
||||
case Xol_kwd_grp_.Id_site_pagesincategory: return Bry_.new_u8("pagesincategory");
|
||||
case Xol_kwd_grp_.Id_rev_pagesize: return Bry_.new_u8("pagesize");
|
||||
case Xol_kwd_grp_.Id_index: return Bry_.new_u8("index");
|
||||
case Xol_kwd_grp_.Id_noindex: return Bry_.new_u8("noindex");
|
||||
case Xol_kwd_grp_.Id_site_numberingroup: return Bry_.new_u8("numberingroup");
|
||||
case Xol_kwd_grp_.Id_staticredirect: return Bry_.new_u8("staticredirect");
|
||||
case Xol_kwd_grp_.Id_rev_protectionlevel: return Bry_.new_u8("protectionlevel");
|
||||
case Xol_kwd_grp_.Id_str_formatdate: return Bry_.new_u8("formatdate");
|
||||
case Xol_kwd_grp_.Id_url_path: return Bry_.new_u8("url_path");
|
||||
case Xol_kwd_grp_.Id_url_wiki: return Bry_.new_u8("url_wiki");
|
||||
case Xol_kwd_grp_.Id_url_query: return Bry_.new_u8("url_query");
|
||||
case Xol_kwd_grp_.Id_xtn_expr: return Bry_.new_u8("expr");
|
||||
case Xol_kwd_grp_.Id_xtn_if: return Bry_.new_u8("if");
|
||||
case Xol_kwd_grp_.Id_xtn_ifeq: return Bry_.new_u8("ifeq");
|
||||
case Xol_kwd_grp_.Id_xtn_ifexpr: return Bry_.new_u8("ifexpr");
|
||||
case Xol_kwd_grp_.Id_xtn_iferror: return Bry_.new_u8("iferror");
|
||||
case Xol_kwd_grp_.Id_xtn_switch: return Bry_.new_u8("switch");
|
||||
case Xol_kwd_grp_.Id_xtn_default: return Bry_.new_u8("default");
|
||||
case Xol_kwd_grp_.Id_xtn_ifexist: return Bry_.new_u8("ifexist");
|
||||
case Xol_kwd_grp_.Id_xtn_time: return Bry_.new_u8("time");
|
||||
case Xol_kwd_grp_.Id_xtn_timel: return Bry_.new_u8("timel");
|
||||
case Xol_kwd_grp_.Id_xtn_rel2abs: return Bry_.new_u8("rel2abs");
|
||||
case Xol_kwd_grp_.Id_xtn_titleparts: return Bry_.new_u8("titleparts");
|
||||
case Xol_kwd_grp_.Id_xowa_dbg: return Bry_.new_u8("xowa_dbg");
|
||||
case Xol_kwd_grp_.Id_ogg_noplayer: return Bry_.new_u8("noplayer");
|
||||
case Xol_kwd_grp_.Id_ogg_noicon: return Bry_.new_u8("noicon");
|
||||
case Xol_kwd_grp_.Id_ogg_thumbtime: return Bry_.new_u8("thumbtime");
|
||||
case Xol_kwd_grp_.Id_xtn_geodata_coordinates: return Bry_.new_u8("coordinates");
|
||||
case Xol_kwd_grp_.Id_url_canonicalurl: return Bry_.new_u8("canonicalurl");
|
||||
case Xol_kwd_grp_.Id_url_canonicalurle: return Bry_.new_u8("canonicalurle");
|
||||
case Xol_kwd_grp_.Id_lst: return Bry_.new_u8("lst");
|
||||
case Xol_kwd_grp_.Id_lstx: return Bry_.new_u8("lstx");
|
||||
case Xol_kwd_grp_.Id_invoke: return Bry_.new_u8("invoke");
|
||||
case Xol_kwd_grp_.Id_property: return Bry_.new_u8("property");
|
||||
case Xol_kwd_grp_.Id_noexternallanglinks: return Bry_.new_u8("noexternallanglinks");
|
||||
case Xol_kwd_grp_.Id_ns_num: return Bry_.new_u8("namespacenumber");
|
||||
case Xol_kwd_grp_.Id_page_id: return Bry_.new_u8("pageid");
|
||||
case Xol_kwd_grp_.Id_disambig: return Bry_.new_u8("disambiguation");
|
||||
case Xol_kwd_grp_.Id_nocommafysuffix: return Bry_.new_u8("nosep");
|
||||
case Xol_kwd_grp_.Id_xowa: return Bry_.new_u8("xowa");
|
||||
case Xol_kwd_grp_.Id_mapSources_deg2dd: return Bry_.new_u8("deg2dd");
|
||||
case Xol_kwd_grp_.Id_mapSources_dd2dms: return Bry_.new_u8("dd2dms");
|
||||
case Xol_kwd_grp_.Id_mapSources_geoLink: return Bry_.new_u8("geolink");
|
||||
case Xol_kwd_grp_.Id_geoCrumbs_isin: return Bry_.new_u8("isin");
|
||||
case Xol_kwd_grp_.Id_relatedArticles: return Bry_.new_u8("relatedArticles");
|
||||
case Xol_kwd_grp_.Id_insider: return Bry_.new_u8("insider");
|
||||
case Xol_kwd_grp_.Id_massMessage_target: return Bry_.new_u8("target");
|
||||
case Xol_kwd_grp_.Id_cascadingSources: return Bry_.new_u8("cascadingSources");
|
||||
case Xol_kwd_grp_.Id_pendingChangeLevel: return Bry_.new_u8("pendingChangeLevel");
|
||||
case Xol_kwd_grp_.Id_pagesUsingPendingChanges: return Bry_.new_u8("pagesUsingPendingChanges");
|
||||
case Xol_kwd_grp_.Id_bang: return Bry_.new_u8("!");
|
||||
case Xol_kwd_grp_.Id_wbreponame: return Bry_.new_u8("wbreponame");
|
||||
case Xol_kwd_grp_.Id_strx_len: return Bry_.new_u8("len");
|
||||
case Xol_kwd_grp_.Id_strx_pos: return Bry_.new_u8("pos");
|
||||
case Xol_kwd_grp_.Id_strx_rpos: return Bry_.new_u8("rpos");
|
||||
case Xol_kwd_grp_.Id_strx_sub: return Bry_.new_u8("sub");
|
||||
case Xol_kwd_grp_.Id_strx_count: return Bry_.new_u8("count");
|
||||
case Xol_kwd_grp_.Id_strx_replace: return Bry_.new_u8("replace");
|
||||
case Xol_kwd_grp_.Id_strx_explode: return Bry_.new_u8("explode");
|
||||
case Xol_kwd_grp_.Id_strx_urldecode: return Bry_.new_u8("urldecode");
|
||||
default: throw Exc_.new_unhandled(id);
|
||||
}
|
||||
}
|
||||
public static byte[] Bry_by_id(int id) {
|
||||
if (Bry__ == null) Bry_init();
|
||||
return Bry__[id];
|
||||
} static byte[][] Bry__;
|
||||
public static int Id_by_bry(byte[] find) {
|
||||
if (hash == null) {
|
||||
hash = Hash_adp_bry.ci_ascii_(); // ASCII: all MW kwds appear to be ASCII; EX: "redirect", "toc", "currentmont", etc.
|
||||
if (Bry__ == null) Bry_init();
|
||||
int len = Bry__.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
byte[] bry = Bry__[i];
|
||||
hash.Add(bry, Int_obj_val.new_(i));
|
||||
}
|
||||
}
|
||||
Object o = hash.Get_by_bry(find);
|
||||
return o == null? Int_.Neg1 : ((Int_obj_val)o).Val();
|
||||
} static Hash_adp_bry hash;
|
||||
private static void Bry_init() {
|
||||
Bry__ = new byte[Id__max][];
|
||||
for (int i = 0; i < Id__max; i++)
|
||||
Bry__[i] = ary_itm_(i);
|
||||
}
|
||||
}
|
||||
|
||||
24
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_itm.java
Normal file
24
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_itm.java
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
public class Xol_kwd_itm {// NOTE: keeping as separate class b/c may include fmt props later; EX: thumbnail=$1
|
||||
public Xol_kwd_itm(byte[] val) {this.val = val;}
|
||||
public byte[] Val() {return val;} private byte[] val;
|
||||
public void Val_(byte[] v) {val = v;} // should only be called by lang
|
||||
public static final Xol_kwd_itm[] Ary_empty = new Xol_kwd_itm[0];
|
||||
}
|
||||
95
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_mgr.java
Normal file
95
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_mgr.java
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import gplx.core.btries.*;
|
||||
public class Xol_kwd_mgr implements GfoInvkAble {
|
||||
public Xol_kwd_mgr(Xol_lang lang) {this.lang = lang;} private Xol_lang lang; Xol_kwd_grp[] grps = new Xol_kwd_grp[Xol_kwd_grp_.Id__max];
|
||||
public int Len() {return grps.length;}
|
||||
public void Clear() {
|
||||
int len = grps.length;
|
||||
for (int i = 0; i < len; ++i)
|
||||
grps[i] = null;
|
||||
}
|
||||
public Btrie_slim_mgr Trie_raw() {if (trie_raw == null) trie_raw = Xol_kwd_mgr.trie_(this, Xol_kwd_grp_.Id_str_rawsuffix); return trie_raw;} private Btrie_slim_mgr trie_raw;
|
||||
public Btrie_slim_mgr Trie_nosep() {if (trie_nosep == null) trie_nosep = Xol_kwd_mgr.trie_(this, Xol_kwd_grp_.Id_nocommafysuffix); return trie_nosep;} private Btrie_slim_mgr trie_nosep;
|
||||
public void Kwd_default_match_reset() {kwd_default_init_needed = true;} // TEST:
|
||||
public boolean Kwd_default_match(byte[] match) { // handle multiple #default keywords; DATE:2014-07-28
|
||||
if (match == null) return false; // null never matches #default
|
||||
int match_len = match.length;
|
||||
if (match_len == 0) return false; // "" never matches default
|
||||
if (kwd_default_init_needed) {
|
||||
kwd_default_init_needed = false;
|
||||
Xol_kwd_grp grp = this.Get_at(Xol_kwd_grp_.Id_xtn_default);
|
||||
int len = grp.Itms().length;
|
||||
if (len == 1)
|
||||
kwd_default_key = grp.Itms()[0].Val();
|
||||
else {
|
||||
kwd_default_trie = Btrie_slim_mgr.new_(grp.Case_match());
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_kwd_itm itm = grp.Itms()[i];
|
||||
kwd_default_trie.Add_obj(itm.Val(), itm);
|
||||
}
|
||||
}
|
||||
}
|
||||
return kwd_default_trie == null
|
||||
? Bry_.Has_at_bgn(match, kwd_default_key, 0, match_len)
|
||||
: kwd_default_trie.Match_bgn(match, 0, match_len) != null
|
||||
;
|
||||
}
|
||||
private Btrie_slim_mgr kwd_default_trie; private byte[] kwd_default_key; private boolean kwd_default_init_needed = true;
|
||||
public Xol_kwd_grp Get_at(int id) {return grps[id];}
|
||||
public Xol_kwd_grp Get_or_new(int id) {
|
||||
Xol_kwd_grp rv = grps[id];
|
||||
if (rv == null) {
|
||||
rv = new Xol_kwd_grp(Xol_kwd_grp_.Bry_by_id(id));
|
||||
grps[id] = rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
public Xol_kwd_grp New(boolean case_match, int id, String... words_str) {
|
||||
Xol_kwd_grp rv = Get_or_new(id);
|
||||
rv.Srl_load(case_match, Bry_.Ary(words_str));
|
||||
return rv;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_lang)) return lang;
|
||||
else if (ctx.Match(k, Invk_load_text)) Xol_lang_srl.Load_keywords(this, m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_lang = Xol_lang_srl.Invk_lang, Invk_load_text = Xol_lang_srl.Invk_load_text;
|
||||
public static Btrie_slim_mgr trie_(Xol_kwd_mgr mgr, int id) {
|
||||
Xol_kwd_grp grp = mgr.Get_at(id);
|
||||
Btrie_slim_mgr rv = Btrie_slim_mgr.new_(grp.Case_match());
|
||||
int len = grp.Itms().length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_kwd_itm itm = grp.Itms()[i];
|
||||
rv.Add_obj(itm.Val(), itm);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
public static Hash_adp_bry hash_(Xol_kwd_mgr mgr, int id) {
|
||||
Xol_kwd_grp grp = mgr.Get_at(id);
|
||||
Hash_adp_bry rv = Hash_adp_bry.c__utf8_(grp.Case_match(), mgr.lang.Case_mgr());
|
||||
int len = grp.Itms().length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_kwd_itm itm = grp.Itms()[i];
|
||||
rv.Add(itm.Val(), itm);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
80
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_parse_data.java
Normal file
80
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_parse_data.java
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Xol_kwd_parse_data {
|
||||
public static byte[] Strip(Bry_bfr tmp, byte[] raw, Byte_obj_ref rslt) {
|
||||
int raw_len = raw.length;
|
||||
boolean dirty = false;
|
||||
for (int i = 0; i < raw_len; i++) {
|
||||
byte b = raw[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Dollar:
|
||||
byte prv = i == 0 ? Byte_ascii.Nil : raw[i - 1];
|
||||
switch (prv) {
|
||||
case Byte_ascii.Backslash: { // ignore \$
|
||||
if (dirty) tmp.Add_byte(b);
|
||||
else {tmp.Add_mid(raw, 0, i - 1); dirty = true;} // i - 1 to ignore backslash
|
||||
break;
|
||||
}
|
||||
case Byte_ascii.Eq: { // assume end; EX: link=$1
|
||||
dirty = true;
|
||||
tmp.Add_mid(raw, 0, i - 1); // - 1 to ignore =
|
||||
rslt.Val_(Strip_end);
|
||||
i = raw_len;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (i == 0) {
|
||||
rslt.Val_(Strip_bgn);
|
||||
dirty = true;
|
||||
int txt_bgn = 1;
|
||||
for (int j = 1; j < raw_len; j++) {
|
||||
b = raw[j];
|
||||
switch (b) {
|
||||
case Byte_ascii.Num_0: case Byte_ascii.Num_1: case Byte_ascii.Num_2: case Byte_ascii.Num_3: case Byte_ascii.Num_4:
|
||||
case Byte_ascii.Num_5: case Byte_ascii.Num_6: case Byte_ascii.Num_7: case Byte_ascii.Num_8: case Byte_ascii.Num_9:
|
||||
break;
|
||||
default:
|
||||
txt_bgn = j;
|
||||
j = raw_len;
|
||||
break;
|
||||
}
|
||||
}
|
||||
tmp.Add_mid(raw, txt_bgn, raw_len);
|
||||
}
|
||||
else {
|
||||
dirty = true;
|
||||
tmp.Add_mid(raw, 0, i);
|
||||
rslt.Val_(Strip_end);
|
||||
i = raw_len;
|
||||
}
|
||||
i = raw_len;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (dirty) tmp.Add_byte(b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return dirty ? tmp.Xto_bry_and_clear() : raw;
|
||||
}
|
||||
public static final byte Strip_none = 0, Strip_bgn = 1, Strip_end = 2;
|
||||
}
|
||||
38
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_parse_data_tst.java
Normal file
38
400_xowa/src_140_lang/gplx/xowa/Xol_kwd_parse_data_tst.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import org.junit.*; import gplx.core.primitives.*;
|
||||
public class Xol_kwd_parse_data_tst {
|
||||
@Before public void init() {Clear();}
|
||||
@Test public void Basic() {Key_("upright" ).Tst_strip("upright");}
|
||||
@Test public void Eq_arg() {Key_("upright" ).Tst_strip("upright=$1");}
|
||||
@Test public void Space() {Key_("upright ").Tst_strip("upright $1");}
|
||||
@Test public void Px() {Key_("px").Tst_strip("$1px");}
|
||||
|
||||
private void Clear() {
|
||||
key = null;
|
||||
}
|
||||
Xol_kwd_parse_data_tst Key_(String v) {this.key = v; return this;} private String key;
|
||||
Xol_kwd_parse_data_tst Tst_strip(String v) {
|
||||
Bry_bfr tmp = Bry_bfr.new_();
|
||||
Byte_obj_ref rslt = Byte_obj_ref.zero_();
|
||||
byte[] actl = Xol_kwd_parse_data.Strip(tmp, Bry_.new_a7(v), rslt);
|
||||
Tfds.Eq(key, String_.new_a7(actl));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
168
400_xowa/src_140_lang/gplx/xowa/Xol_lang.java
Normal file
168
400_xowa/src_140_lang/gplx/xowa/Xol_lang.java
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import gplx.xowa.apps.*; import gplx.xowa.apps.fsys.*; import gplx.xowa.langs.*; import gplx.intl.*; import gplx.xowa.xtns.lst.*; import gplx.xowa.wikis.caches.*;
|
||||
import gplx.xowa.langs.cases.*; import gplx.xowa.langs.cnvs.*; import gplx.xowa.langs.grammars.*; import gplx.xowa.langs.genders.*; import gplx.xowa.langs.plurals.*; import gplx.xowa.langs.vnts.*; import gplx.xowa.langs.numbers.*; import gplx.xowa.langs.durations.*;
|
||||
import gplx.xowa.parsers.lnkis.*;
|
||||
public class Xol_lang implements GfoInvkAble {
|
||||
private boolean loaded = false;
|
||||
public Xol_lang(Xoa_lang_mgr lang_mgr, byte[] key_bry) {
|
||||
this.lang_mgr = lang_mgr; this.key_bry = key_bry; this.key_str = String_.new_u8(key_bry);
|
||||
Xol_lang_itm lang_itm = Xol_lang_itm_.Get_by_key(key_bry); if (lang_itm == null) throw Exc_.new_("unknown lang_key", "key", String_.new_u8(key_bry));
|
||||
this.lang_id = lang_itm.Id();
|
||||
this.func_regy = new Xol_func_name_regy(lang_mgr, this);
|
||||
this.ns_names = new Xol_ns_grp(this); this.ns_aliases = new Xol_ns_grp(this);
|
||||
this.kwd_mgr = new Xol_kwd_mgr(this);
|
||||
this.msg_mgr = new Xol_msg_mgr(this, true);
|
||||
this.specials_mgr = new Xol_specials_mgr(this);
|
||||
this.case_mgr = Env_.Mode_testing() ? Xol_case_mgr_.Ascii() : Xol_case_mgr_.Utf8(); // NOTE: if test load ascii b/c utf8 is large; NOTE: placed here b/c tests do not call load; DATE:2014-07-04
|
||||
this.num_mgr = Xol_num_mgr_.new_by_lang_id(lang_id);
|
||||
this.lnki_trail_mgr = new Xol_lnki_trail_mgr(this);
|
||||
this.vnt_mgr = new Xol_vnt_mgr(this);
|
||||
this.cnv_mgr = new Xol_cnv_mgr(this);
|
||||
this.grammar = Xol_grammar_.new_by_lang_id(lang_id);
|
||||
this.gender = Xol_gender_.new_by_lang_id(lang_id);
|
||||
this.plural = Xol_plural_.new_by_lang_id(lang_id);
|
||||
this.duration_mgr = new Xol_duration_mgr(this);
|
||||
if (lang_id != Xol_lang_itm_.Id_en) fallback_bry_ary = Fallback_bry_ary__en; // NOTE: do not set fallback_ary for en to en, else recursive loop
|
||||
}
|
||||
public byte[] Key_bry() {return key_bry;} private final byte[] key_bry;
|
||||
public String Key_str() {return key_str;} private final String key_str;
|
||||
public int Lang_id() {return lang_id;} private final int lang_id;
|
||||
public Xol_ns_grp Ns_names() {return ns_names;} private final Xol_ns_grp ns_names;
|
||||
public Xol_ns_grp Ns_aliases() {return ns_aliases;} private final Xol_ns_grp ns_aliases;
|
||||
public Xoa_lang_mgr Lang_mgr() {return lang_mgr;} private final Xoa_lang_mgr lang_mgr;
|
||||
public Xol_kwd_mgr Kwd_mgr() {return kwd_mgr;} private final Xol_kwd_mgr kwd_mgr;
|
||||
public boolean Kwd_mgr__strx() {return kwd_mgr__strx;} public Xol_lang Kwd_mgr__strx_(boolean v) {kwd_mgr__strx = v; return this;} private boolean kwd_mgr__strx;
|
||||
public Xol_msg_mgr Msg_mgr() {return msg_mgr;} private final Xol_msg_mgr msg_mgr;
|
||||
public Xol_specials_mgr Specials_mgr() {return specials_mgr;} private final Xol_specials_mgr specials_mgr;
|
||||
public Xol_case_mgr Case_mgr() {return case_mgr;} private Xol_case_mgr case_mgr;
|
||||
public void Case_mgr_utf8_() {case_mgr = Xol_case_mgr_.Utf8();} // TEST:
|
||||
public Xol_font_info Gui_font() {return gui_font;} private Xol_font_info gui_font = new Xol_font_info(null, 0, gplx.gfui.FontStyleAdp_.Plain);
|
||||
public byte[] Fallback_bry() {return fallback_bry;}
|
||||
private byte[] X_axis_end() {return dir_ltr ? X_axis_end_right : X_axis_end_left;}
|
||||
public boolean Dir_ltr() {return dir_ltr;}
|
||||
public void Dir_ltr_(boolean v) {
|
||||
dir_ltr = v;
|
||||
img_thumb_halign_default = dir_ltr ? Xop_lnki_align_h.Right : Xop_lnki_align_h.Left;
|
||||
} private boolean dir_ltr = true;
|
||||
public byte[] Dir_ltr_bry() {return dir_ltr ? Dir_bry_ltr : Dir_bry_rtl;}
|
||||
public Xol_lang Fallback_bry_(byte[] v) {
|
||||
fallback_bry = v;
|
||||
fallback_bry_ary = Fallbacy_bry_ary__bld(v);
|
||||
return this;
|
||||
} private byte[] fallback_bry;
|
||||
public byte[][] Fallback_bry_ary() {return fallback_bry_ary;} private byte[][] fallback_bry_ary = Bry_.Ary_empty;
|
||||
public Xol_num_mgr Num_mgr() {return num_mgr;} private final Xol_num_mgr num_mgr;
|
||||
public Xol_vnt_mgr Vnt_mgr() {return vnt_mgr;} private final Xol_vnt_mgr vnt_mgr;
|
||||
public Xol_cnv_mgr Cnv_mgr() {return cnv_mgr;} private final Xol_cnv_mgr cnv_mgr;
|
||||
public Xol_grammar Grammar() {return grammar;} private final Xol_grammar grammar;
|
||||
public Xol_gender Gender() {return gender;} private final Xol_gender gender;
|
||||
public Xol_plural Plural() {return plural;} private final Xol_plural plural;
|
||||
public Xol_duration_mgr Duration_mgr() {return duration_mgr;} private final Xol_duration_mgr duration_mgr;
|
||||
public Xol_lnki_trail_mgr Lnki_trail_mgr() {return lnki_trail_mgr;} private final Xol_lnki_trail_mgr lnki_trail_mgr;
|
||||
public Xop_lnki_arg_parser Lnki_arg_parser() {return lnki_arg_parser;} private Xop_lnki_arg_parser lnki_arg_parser = new Xop_lnki_arg_parser();
|
||||
public Xol_func_name_regy Func_regy() {return func_regy;} private final Xol_func_name_regy func_regy;
|
||||
public byte Img_thumb_halign_default() {return img_thumb_halign_default;} private byte img_thumb_halign_default = Xop_lnki_align_h.Right;
|
||||
public Hash_adp_bry Xatrs_section() {if (xatrs_section == null) xatrs_section = Lst_section_nde.new_xatrs_(this); return xatrs_section;} private Hash_adp_bry xatrs_section;
|
||||
public void Evt_lang_changed() {
|
||||
lnki_arg_parser.Evt_lang_changed(this);
|
||||
func_regy.Evt_lang_changed(this);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_ns_names)) return ns_names;
|
||||
else if (ctx.Match(k, Invk_ns_aliases)) return ns_aliases;
|
||||
else if (ctx.Match(k, Invk_keywords)) return kwd_mgr;
|
||||
else if (ctx.Match(k, Invk_messages)) return msg_mgr;
|
||||
else if (ctx.Match(k, Invk_specials)) return specials_mgr;
|
||||
else if (ctx.Match(k, Invk_casings)) return case_mgr;
|
||||
else if (ctx.Match(k, Invk_converts)) return cnv_mgr;
|
||||
else if (ctx.Match(k, Invk_variants)) return vnt_mgr;
|
||||
else if (ctx.Match(k, Invk_dir_rtl_)) Dir_ltr_(!m.ReadYn("v"));
|
||||
else if (ctx.Match(k, Invk_dir_str)) return Dir_ltr_bry();
|
||||
else if (ctx.Match(k, Invk_gui_font_)) gui_font.Name_(m.ReadStr("name")).Size_(m.ReadFloatOr("size", 8));
|
||||
else if (ctx.Match(k, Invk_fallback_load)) Exec_fallback_load(m.ReadBry("v"));
|
||||
else if (ctx.Match(k, Invk_numbers)) return num_mgr;
|
||||
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 return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk_ns_names = "ns_names", Invk_ns_aliases = "ns_aliases"
|
||||
, Invk_keywords = "keywords", Invk_messages = "messages", Invk_specials = "specials", Invk_casings = "casings", Invk_converts = "converts", Invk_variants = "variants"
|
||||
, Invk_numbers = "numbers"
|
||||
, Invk_dir_rtl_ = "dir_rtl_", Invk_gui_font_ = "gui_font_"
|
||||
, Invk_fallback_load = "fallback_load", Invk_this = "this", Invk_dir_str = "dir_str", Invk_link_trail = "link_trail"
|
||||
, Invk_x_axis_end = "x_axis_end"
|
||||
;
|
||||
public Xol_lang Init_by_load_assert() {if (!loaded) Init_by_load(); return this;}
|
||||
public boolean Init_by_load() {
|
||||
if (this.loaded) return false;
|
||||
lang_mgr.Fallback_regy().Clear();
|
||||
this.loaded = true;
|
||||
boolean lang_is_en = lang_id == Xol_lang_itm_.Id_en;
|
||||
if (!lang_is_en) Xol_lang_.Lang_init(this);
|
||||
msg_mgr.Itm_by_key_or_new(Bry_.new_u8("Lang")).Atrs_set(key_bry, false, false); // set "Lang" keyword; EX: for "fr", "{{int:Lang}}" -> "fr"
|
||||
Load_lang(key_bry);
|
||||
ns_aliases.Ary_add_(Xow_ns_.Canonical); // NOTE: always add English canonical as aliases to all languages
|
||||
this.Evt_lang_changed();
|
||||
return true;
|
||||
}
|
||||
private void Exec_fallback_load(byte[] fallback_lang) {
|
||||
Fallback_bry_(fallback_lang);
|
||||
if (lang_mgr.Fallback_regy().Has(fallback_lang)) return; // fallback_lang loaded; avoid recursive loop; EX: zh with fallback of zh-hans which has fallback of zh
|
||||
if (Bry_.Eq(fallback_lang, Xoa_lang_mgr.Fallback_false)) return; // fallback_lang is "none" exit
|
||||
lang_mgr.Fallback_regy().Add(fallback_lang, fallback_lang);
|
||||
Load_lang(fallback_lang);
|
||||
lang_mgr.Fallback_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();
|
||||
gfs_mgr.Run_url_for(this, Xol_lang_.xo_lang_fil_(app_fsys_mgr, String_.new_a7(v)));
|
||||
gfs_mgr.Run_url_for(gfs_mgr.Root_invk(), Xol_cnv_mgr.Bld_url(app_fsys_mgr, key_str));
|
||||
}
|
||||
private static final byte[]
|
||||
Dir_bry_ltr = Bry_.new_a7("ltr"), Dir_bry_rtl = Bry_.new_a7("rtl")
|
||||
, X_axis_end_right = Bry_.new_a7("right"), X_axis_end_left = Bry_.new_a7("left")
|
||||
;
|
||||
public static final int Tid_lower = 1, Tid_upper = 2;
|
||||
private static byte[][] Fallbacy_bry_ary__bld(byte[] v) {
|
||||
byte[][] rv = Bry_.Split(v, Byte_ascii.Comma, true); // gan -> 'gan-hant, zh-hant, zh-hans'
|
||||
boolean en_needed = true;
|
||||
int rv_len = rv.length;
|
||||
for (int i = 0; i < rv_len; i++) {
|
||||
byte[] itm = rv[i];
|
||||
if (Bry_.Eq(itm, Xol_lang_.Key_en)) {
|
||||
en_needed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (en_needed) {
|
||||
int new_len = rv_len + 1;
|
||||
byte[][] new_ary = new byte[new_len][];
|
||||
for (int i = 0; i < rv_len; i++)
|
||||
new_ary[i] = rv[i];
|
||||
new_ary[rv_len] = Xol_lang_.Key_en;
|
||||
rv = new_ary;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
private static final byte[][] Fallback_bry_ary__en = new byte[][] {Xol_lang_.Key_en};
|
||||
}
|
||||
260
400_xowa/src_140_lang/gplx/xowa/Xol_lang_.java
Normal file
260
400_xowa/src_140_lang/gplx/xowa/Xol_lang_.java
Normal file
@@ -0,0 +1,260 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import gplx.intl.*; import gplx.xowa.xtns.cite.*; import gplx.xowa.xtns.gallery.*; import gplx.xowa.bldrs.langs.*; import gplx.xowa.langs.numbers.*;
|
||||
import gplx.xowa.apps.fsys.*;
|
||||
public class Xol_lang_ {
|
||||
public static Io_url xo_lang_fil_(Xoa_fsys_mgr app_fsys_mgr, String lang_key) {return app_fsys_mgr.Cfg_lang_core_dir().GenSubFil(lang_key + ".gfs");}
|
||||
public static final byte Char_tid_ltr_l = 0, Char_tid_ltr_u = 1, Char_tid_num = 2, Char_tid_ws = 3, Char_tid_sym = 4, Char_tid_misc = 5;
|
||||
public static byte Char_tid(byte b) {
|
||||
switch (b) {
|
||||
case Byte_ascii.Ltr_A: case Byte_ascii.Ltr_B: case Byte_ascii.Ltr_C: case Byte_ascii.Ltr_D: case Byte_ascii.Ltr_E:
|
||||
case Byte_ascii.Ltr_F: case Byte_ascii.Ltr_G: case Byte_ascii.Ltr_H: case Byte_ascii.Ltr_I: case Byte_ascii.Ltr_J:
|
||||
case Byte_ascii.Ltr_K: case Byte_ascii.Ltr_L: case Byte_ascii.Ltr_M: case Byte_ascii.Ltr_N: case Byte_ascii.Ltr_O:
|
||||
case Byte_ascii.Ltr_P: case Byte_ascii.Ltr_Q: case Byte_ascii.Ltr_R: case Byte_ascii.Ltr_S: case Byte_ascii.Ltr_T:
|
||||
case Byte_ascii.Ltr_U: case Byte_ascii.Ltr_V: case Byte_ascii.Ltr_W: case Byte_ascii.Ltr_X: case Byte_ascii.Ltr_Y: case Byte_ascii.Ltr_Z:
|
||||
return Char_tid_ltr_u;
|
||||
case Byte_ascii.Ltr_a: case Byte_ascii.Ltr_b: case Byte_ascii.Ltr_c: case Byte_ascii.Ltr_d: case Byte_ascii.Ltr_e:
|
||||
case Byte_ascii.Ltr_f: case Byte_ascii.Ltr_g: case Byte_ascii.Ltr_h: case Byte_ascii.Ltr_i: case Byte_ascii.Ltr_j:
|
||||
case Byte_ascii.Ltr_k: case Byte_ascii.Ltr_l: case Byte_ascii.Ltr_m: case Byte_ascii.Ltr_n: case Byte_ascii.Ltr_o:
|
||||
case Byte_ascii.Ltr_p: case Byte_ascii.Ltr_q: case Byte_ascii.Ltr_r: case Byte_ascii.Ltr_s: case Byte_ascii.Ltr_t:
|
||||
case Byte_ascii.Ltr_u: case Byte_ascii.Ltr_v: case Byte_ascii.Ltr_w: case Byte_ascii.Ltr_x: case Byte_ascii.Ltr_y: case Byte_ascii.Ltr_z:
|
||||
return Char_tid_ltr_l;
|
||||
case Byte_ascii.Num_0: case Byte_ascii.Num_1: case Byte_ascii.Num_2: case Byte_ascii.Num_3: case Byte_ascii.Num_4:
|
||||
case Byte_ascii.Num_5: case Byte_ascii.Num_6: case Byte_ascii.Num_7: case Byte_ascii.Num_8: case Byte_ascii.Num_9:
|
||||
return Char_tid_num;
|
||||
case Byte_ascii.Space: case Byte_ascii.Nl: case Byte_ascii.Tab: case Byte_ascii.Cr:
|
||||
return Char_tid_ws;
|
||||
default:
|
||||
return Char_tid_misc;
|
||||
}
|
||||
}
|
||||
public static final byte[] Key_en = Bry_.new_a7("en");
|
||||
public static void Lang_init(Xol_lang lang) {
|
||||
lang.Num_mgr().Separators_mgr().Set(Xol_num_mgr.Separators_key__grp, Xol_num_mgr.Separators_key__grp);
|
||||
lang.Num_mgr().Separators_mgr().Set(Xol_num_mgr.Separators_key__dec, Xol_num_mgr.Separators_key__dec);
|
||||
lang.Lnki_trail_mgr().Add_range(Byte_ascii.Ltr_a, Byte_ascii.Ltr_z);// REF.MW:MessagesEn.php|$linkTrail = '/^([a-z]+)(.*)$/sD';
|
||||
Xol_kwd_mgr kwd_mgr = lang.Kwd_mgr();
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_redirect, "#REDIRECT");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_notoc, "__NOTOC__");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_nogallery, "__NOGALLERY__");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_forcetoc, "__FORCETOC__");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_toc, "__TOC__");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_noeditsection, "__NOEDITSECTION__");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_noheader, "__NOHEADER__");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_month_int_len2, "CURRENTMONTH", "CURRENTMONTH2");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_month_int, "CURRENTMONTH1");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_month_name, "CURRENTMONTHNAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_month_gen, "CURRENTMONTHNAMEGEN");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_month_abrv, "CURRENTMONTHABBREV");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_day_int, "CURRENTDAY");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_day_int_len2, "CURRENTDAY2");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_day_name, "CURRENTDAYNAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_year, "CURRENTYEAR");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_time, "CURRENTTIME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_hour, "CURRENTHOUR");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_month_int_len2, "LOCALMONTH", "LOCALMONTH2");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_month_int, "LOCALMONTH1");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_month_name, "LOCALMONTHNAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_month_gen, "LOCALMONTHNAMEGEN");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_month_abrv, "LOCALMONTHABBREV");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_day_int, "LOCALDAY");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_day_int_len2, "LOCALDAY2");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_day_name, "LOCALDAYNAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_year, "LOCALYEAR");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_time, "LOCALTIME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_hour, "LOCALHOUR");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_num_pages, "NUMBEROFPAGES");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_num_articles, "NUMBEROFARTICLES");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_num_files, "NUMBEROFFILES");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_num_users, "NUMBEROFUSERS");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_num_users_active, "NUMBEROFACTIVEUSERS");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_num_edits, "NUMBEROFEDITS");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_num_views, "NUMBEROFVIEWS");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_page_txt, "PAGENAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_page_url, "PAGENAMEE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ns_txt, "NAME"+"SPACE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ns_url, "NAME"+"SPACEE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ns_talk_txt, "TALKSPACE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ns_talk_url, "TALKSPACEE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ns_subj_txt, "SUBJECTSPACE", "ARTICLESPACE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ns_subj_url, "SUBJECTSPACEE", "ARTICLESPACEE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_full_txt, "FULLPAGENAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_full_url, "FULLPAGENAMEE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_leaf_txt, "SUBPAGENAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_leaf_url, "SUBPAGENAMEE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_base_txt, "BASEPAGENAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_base_url, "BASEPAGENAMEE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_talk_txt, "TALKPAGENAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_talk_url, "TALKPAGENAMEE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_subj_txt, "SUBJECTPAGENAME", "ARTICLEPAGENAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ttl_subj_url, "SUBJECTPAGENAMEE", "ARTICLEPAGENAMEE");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_msg, "msg");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_subst, "subst:");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_safesubst, "safesubst:");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_msgnw, "msgnw");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_thumbnail, "thumbnail", "thumb");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_manualthumb, "thumbnail", "thumb");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_framed, "framed", "enframed", "frame");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_frameless, "frameless");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_upright, "upright");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_upright_factor, "upright_factor");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_border, "border");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_align, "align");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_valign, "valign");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_alt, "alt");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_class, "class");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_caption, "caption");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_link_url, "link-url");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_link_title, "link-title");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_link_target, "link-target");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_link_none, "no-link");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_width, "px");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_page, "page");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_none, "none");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_right, "right");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_center, "center", "centre");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_left, "left");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_baseline, "baseline");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_sub, "sub");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_super, "super", "sup");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_top, "top");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_text_top, "text-top");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_middle, "middle");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_bottom, "bottom");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_text_bottom, "text-bottom");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_img_link, "link");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_i18n_int, "int");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_sitename, "SITENAME");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_ns, "ns");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_nse, "nse");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_localurl, "localurl");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_localurle, "localurle");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_articlepath, "ARTICLEPATH");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_server, "SERVER");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_servername, "SERVERNAME");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_scriptpath, "SCRIPTPATH");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_stylepath, "STYLEPATH");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_i18n_grammar, "grammar");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_i18n_gender, "gender");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_notitleconvert, "__NOTITLECONVERT__", "__NOTC__");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_nocontentconvert, "__NOCONTENTCONVERT__", "__NOCC__");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_week, "CURRENTWEEK");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_dow, "CURRENTDOW");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_week, "LOCALWEEK");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_dow, "LOCALDOW");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_id, "REVISIONID");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_day_int, "REVISIONDAY");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_day_int_len2, "REVISIONDAY2");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_month_int_len2, "REVISIONMONTH");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_month_int, "REVISIONMONTH1");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_year, "REVISIONYEAR");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_timestamp, "REVISIONTIMESTAMP");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_user, "REVISIONUSER");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_i18n_plural, "plural");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_fullurl, "fullurl");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_fullurle, "fullurle");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_str_lcfirst, "lcfirst");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_str_ucfirst, "ucfirst");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_str_lc, "lc");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_str_uc, "uc");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_raw, "raw");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_page_displaytitle, "DISPLAYTITLE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_str_rawsuffix, "R");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_newsectionlink, "__NEWSECTIONLINK__");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_nonewsectionlink, "__NONEWSECTIONLINK__");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_currentversion, "CURRENTVERSION");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_urlencode, "urlencode");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_anchorencode, "anchorencode");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_utc_timestamp, "CURRENTTIMESTAMP");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_lcl_timestamp, "LOCALTIMESTAMP");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_directionmark, "DIRECTIONMARK", "DIRMARK");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_i18n_language, "#language");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_contentlanguage, "CONTENTLANGUAGE", "CONTENTLANG");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_pagesinnamespace, "PAGESINNAMESPACE", "PAGESINNS");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_num_admins, "NUMBEROFADMINS");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_str_formatnum, "formatnum");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_str_padleft, "padleft");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_str_padright, "padright");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_misc_special, "#special");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_page_defaultsort, "DEFAULTSORT", "DEFAULTSORTKEY", "DEFAULTCATEGORYSORT");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_filepath, "filepath");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_misc_tag, "#tag");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_hiddencat, "__HIDDENCAT__");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_pagesincategory, "PAGESINCATEGORY", "PAGESINCAT");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_pagesize, "PAGESIZE");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_index, "__INDEX__");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_noindex, "__NOINDEX__");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_site_numberingroup, "NUMBERINGROUP", "NUMINGROUP");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_staticredirect, "__STATICREDIRECT__");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_rev_protectionlevel, "PROTECTIONLEVEL");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_str_formatdate, "#formatdate", "#dateformat");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_path, "path");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_wiki, "wiki");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_query, "query");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_expr, "#expr");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_if, "#if");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_ifeq, "#ifeq");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_ifexpr, "#ifexpr");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_iferror, "#iferror");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_switch, "#switch");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_default, "#default");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_ifexist, "#ifexist");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_time, "#time");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_timel, "#timel");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_rel2abs, "#rel2abs");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_titleparts, "#titleparts");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xowa_dbg, "#xowa_dbg");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ogg_noplayer, "noplayer");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ogg_noicon, "noicon");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_ogg_thumbtime, "thumbtime");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xtn_geodata_coordinates, "#coordinates");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_canonicalurl, "canonicalurl");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_url_canonicalurle, "canonicalurle");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_lst, "#lst", "#section");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_lstx, "#lstx", "#section-x");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_invoke, "#invoke");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_property, "#property");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_noexternallanglinks, "noexternallanglinks");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_ns_num, "namespacenumber");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_page_id, "pageid");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_disambig, "__DISAMBIG__");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_nocommafysuffix, "NOSEP");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_xowa, "#xowa");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_mapSources_deg2dd, "#deg2dd");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_mapSources_dd2dms, "#dd2dms");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_mapSources_geoLink, "#geolink");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_geoCrumbs_isin, "#isin");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_relatedArticles, "#related");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_insider, "#insider");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_massMessage_target, "#target");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_cascadingSources, "CASCADINGSOURCES");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_pendingChangeLevel, "PENDINGCHANGELEVEL");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_pagesUsingPendingChanges, "PAGESUSINGPENDINGCHANGES");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_bang, "!");
|
||||
kwd_mgr.New(Bool_.N, Xol_kwd_grp_.Id_wbreponame, "wbreponame");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_strx_len, "#len");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_strx_pos, "#pos");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_strx_rpos, "#rpos");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_strx_sub, "#sub");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_strx_count, "#count");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_strx_replace, "#replace");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_strx_explode, "#explode");
|
||||
kwd_mgr.New(Bool_.Y, Xol_kwd_grp_.Id_strx_urldecode, "#urldecode");
|
||||
}
|
||||
}
|
||||
271
400_xowa/src_140_lang/gplx/xowa/Xol_lang_srl.java
Normal file
271
400_xowa/src_140_lang/gplx/xowa/Xol_lang_srl.java
Normal file
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import gplx.intl.*; import gplx.xowa.langs.numbers.*;
|
||||
public class Xol_lang_srl {
|
||||
public static Xow_ns[] Load_ns_grps(byte[] src) {
|
||||
int src_len = src.length, pos = 0, fld_bgn = 0;
|
||||
int cur_id = -1;
|
||||
List_adp rv = List_adp_.new_(); Xol_csv_parser csv_parser = Xol_csv_parser._;
|
||||
while (true) {
|
||||
boolean last = pos == src_len; // NOTE: logic occurs b/c of \n}~-> dlm which gobbles up last \n
|
||||
byte b = last ? Byte_ascii.Nl : src[pos];
|
||||
switch (b) {
|
||||
case Byte_ascii.Pipe:
|
||||
cur_id = Bry_.Xto_int_or(src, fld_bgn, pos, Int_.MinValue);
|
||||
if (cur_id == Int_.MinValue) throw Exc_.new_("invalid_id", "id", String_.new_u8(src, fld_bgn, pos));
|
||||
fld_bgn = pos + 1;
|
||||
break;
|
||||
case Byte_ascii.Nl:
|
||||
byte[] cur_name = csv_parser.Load(src, fld_bgn, pos);
|
||||
Xow_ns ns = new Xow_ns(cur_id, Xow_ns_case_.Id_1st, cur_name, false);
|
||||
rv.Add(ns);
|
||||
fld_bgn = pos + 1;
|
||||
cur_id = -1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (last) break;
|
||||
++pos;
|
||||
}
|
||||
return (Xow_ns[])rv.To_ary(Xow_ns.class);
|
||||
}
|
||||
public static void Load_keywords(Xol_kwd_mgr keyword_mgr, byte[] src) {
|
||||
int src_len = src.length, pos = 0, fld_bgn = 0, fld_idx = 0;
|
||||
boolean cur_cs = false; byte[] cur_key = Bry_.Empty;
|
||||
List_adp cur_words = List_adp_.new_();
|
||||
Xol_csv_parser csv_parser = Xol_csv_parser._;
|
||||
while (true) {
|
||||
boolean last = pos == src_len; // NOTE: logic occurs b/c of \n}~-> dlm which gobbles up last \n
|
||||
byte b = last ? Byte_ascii.Nl : src[pos];
|
||||
switch (b) {
|
||||
case Byte_ascii.Pipe:
|
||||
switch (fld_idx) {
|
||||
case 0:
|
||||
cur_key = csv_parser.Load(src, fld_bgn, pos);
|
||||
break;
|
||||
case 1:
|
||||
byte cs_byte = src[pos - 1];
|
||||
switch (cs_byte) {
|
||||
case Byte_ascii.Num_0: cur_cs = false; break;
|
||||
case Byte_ascii.Num_1: cur_cs = true; break;
|
||||
default: throw Exc_.new_("case sensitive should be 0 or 1", "cs", Byte_.Xto_str(cs_byte));
|
||||
}
|
||||
break;
|
||||
}
|
||||
fld_bgn = pos + 1;
|
||||
++fld_idx;
|
||||
break;
|
||||
case Byte_ascii.Tilde:
|
||||
byte[] word = csv_parser.Load(src, fld_bgn, pos);
|
||||
cur_words.Add(word);
|
||||
fld_bgn = pos + 1;
|
||||
break;
|
||||
case Byte_ascii.Nl:
|
||||
if (cur_words.Count() > 0) { // guard against blank line wiping out entries; EX: "toc|0|toc1\n\n"; 2nd \n will get last grp and make 0 entries
|
||||
int cur_id = Xol_kwd_grp_.Id_by_bry(cur_key); if (cur_id == -1) throw Exc_.new_("key does not have id", "id", cur_id);
|
||||
Xol_kwd_grp grp = keyword_mgr.Get_or_new(cur_id);
|
||||
grp.Srl_load(cur_cs, (byte[][])cur_words.To_ary(byte[].class));
|
||||
}
|
||||
fld_bgn = pos + 1;
|
||||
fld_idx = 0;
|
||||
cur_words.Clear();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (last) break;
|
||||
++pos;
|
||||
}
|
||||
// return (Xol_kwd_grp[])rv.To_ary(typeof(Xol_kwd_grp));
|
||||
}
|
||||
public static void Load_messages(Xol_msg_mgr msg_mgr, byte[] src) {
|
||||
int src_len = src.length, pos = 0, fld_bgn = 0;
|
||||
byte[] cur_key = Bry_.Empty;
|
||||
Xol_csv_parser csv_parser = Xol_csv_parser._;
|
||||
while (true) {
|
||||
boolean last = pos == src_len; // NOTE: logic occurs b/c of \n}~-> dlm which gobbles up last \n
|
||||
byte b = last ? Byte_ascii.Nl : src[pos];
|
||||
switch (b) {
|
||||
case Byte_ascii.Pipe:
|
||||
cur_key = csv_parser.Load(src, fld_bgn, pos);
|
||||
fld_bgn = pos + 1;
|
||||
break;
|
||||
case Byte_ascii.Nl:
|
||||
byte[] cur_val = csv_parser.Load(src, fld_bgn, pos);
|
||||
Xol_msg_itm itm = msg_mgr.Itm_by_key_or_new(cur_key).Src_(Xol_msg_itm.Src_lang); // NOTE: this proc should only be called when loading lang.gfs
|
||||
Xol_msg_itm_.update_val_(itm, cur_val);
|
||||
itm.Dirty_(true);
|
||||
fld_bgn = pos + 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (last) break;
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
public static void Load_specials(Xol_specials_mgr special_mgr, byte[] src) {
|
||||
int src_len = src.length, pos = 0, fld_bgn = 0;
|
||||
byte[] cur_key = Bry_.Empty;
|
||||
Xol_csv_parser csv_parser = Xol_csv_parser._;
|
||||
while (true) {
|
||||
boolean last = pos == src_len; // NOTE: logic occurs b/c of \n}~-> dlm which gobbles up last \n
|
||||
byte b = last ? Byte_ascii.Nl : src[pos];
|
||||
switch (b) {
|
||||
case Byte_ascii.Pipe:
|
||||
cur_key = csv_parser.Load(src, fld_bgn, pos);
|
||||
fld_bgn = pos + 1;
|
||||
break;
|
||||
case Byte_ascii.Nl:
|
||||
byte[] cur_val_raw = csv_parser.Load(src, fld_bgn, pos);
|
||||
byte[][] cur_vals = Bry_.Split(cur_val_raw, Byte_ascii.Tilde);
|
||||
special_mgr.Add(cur_key, cur_vals);
|
||||
fld_bgn = pos + 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (last) break;
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
public static void Save_num_mgr(Gfs_bldr bldr, Xol_num_mgr num_mgr) {
|
||||
Xol_transform_mgr separators_mgr = num_mgr.Separators_mgr(); int separators_len = separators_mgr.Len();
|
||||
Xol_transform_mgr digits_mgr = num_mgr.Digits_mgr(); int digits_len = digits_mgr.Len();
|
||||
byte[] digit_grouping_pattern = num_mgr.Num_grp_fmtr().Digit_grouping_pattern();
|
||||
if (separators_len > 0 || digits_len > 0 || digit_grouping_pattern != null) {
|
||||
bldr.Add_proc_init_one(Xol_lang.Invk_numbers).Add_curly_bgn_nl(); // numbers {
|
||||
if (digit_grouping_pattern != null) {
|
||||
bldr.Add_indent(1).Add_eq_str(Xol_num_mgr.Invk_digit_grouping_pattern, digit_grouping_pattern);
|
||||
}
|
||||
if (separators_len > 0) {
|
||||
bldr.Add_indent(1).Add_proc_init_one(Xol_num_mgr.Invk_separators).Add_curly_bgn_nl(); // separators {
|
||||
bldr.Add_indent(2).Add_proc_init_one(Xol_num_mgr.Invk_clear).Add_term_nl(); // clear;
|
||||
for (int i = 0; i < separators_len; i++) {
|
||||
KeyVal kv = separators_mgr.Get_at(i);
|
||||
String k = kv.Key(), v = kv.Val_to_str_or_empty();
|
||||
bldr.Add_indent(2).Add_proc_init_many(Xol_transform_mgr.Invk_set).Add_parens_str_many(k, v).Add_term_nl(); // set('k', 'v');
|
||||
}
|
||||
bldr.Add_indent(1).Add_curly_end_nl(); // }
|
||||
}
|
||||
if (digits_len > 0) {
|
||||
bldr.Add_indent(1).Add_proc_init_one(Xol_num_mgr.Invk_digits).Add_curly_bgn_nl(); // digits {
|
||||
bldr.Add_indent(2).Add_proc_init_one(Xol_num_mgr.Invk_clear).Add_term_nl(); // clear;
|
||||
for (int i = 0; i < digits_len; i++) {
|
||||
KeyVal kv = digits_mgr.Get_at(i);
|
||||
String k = kv.Key(), v = kv.Val_to_str_or_empty();
|
||||
bldr.Add_indent(2).Add_proc_init_many(Xol_transform_mgr.Invk_set).Add_parens_str_many(k, v).Add_term_nl(); // set('k', 'v');
|
||||
}
|
||||
bldr.Add_indent(1).Add_curly_end_nl(); // }
|
||||
}
|
||||
bldr.Add_curly_end_nl(); // }
|
||||
}
|
||||
}
|
||||
public static void Save_ns_grps(Gfs_bldr bldr, Xol_ns_grp ns_grp, String proc_invk) {
|
||||
int ns_grp_len = ns_grp.Len(); Xol_csv_parser csv_parser = Xol_csv_parser._;
|
||||
if (ns_grp_len == 0) return;
|
||||
Bry_bfr bfr = bldr.Bfr();
|
||||
bldr.Add_proc_cont_one(proc_invk).Add_nl();
|
||||
bldr.Add_indent().Add_proc_cont_one(Invk_load_text).Add_paren_bgn().Add_nl(); // .load_text(\n
|
||||
bldr.Add_quote_xtn_bgn(); // <~{\n'
|
||||
for (int i = 0; i < ns_grp_len; i++) {
|
||||
Xow_ns ns = ns_grp.Get_at(i);
|
||||
bfr.Add_int_variable(ns.Id()).Add_byte_pipe(); // id|
|
||||
csv_parser.Save(bfr, ns.Name_bry()); // name
|
||||
bfr.Add_byte_nl(); // \n
|
||||
}
|
||||
bldr.Add_quote_xtn_end(); // ']:>\n
|
||||
bldr.Add_paren_end().Add_proc_cont_one(Invk_lang).Add_nl(); // ).lang\n
|
||||
}
|
||||
public static void Save_specials(Gfs_bldr bldr, Xol_specials_mgr specials_mgr) {
|
||||
int specials_len = specials_mgr.Count(); Xol_csv_parser csv_parser = Xol_csv_parser._;
|
||||
if (specials_len == 0) return;
|
||||
Bry_bfr bfr = bldr.Bfr();
|
||||
bldr.Add_proc_cont_one(Xol_lang.Invk_specials).Add_nl();
|
||||
bldr.Add_indent().Add_proc_cont_one(Xol_specials_mgr.Invk_clear).Add_nl();
|
||||
bldr.Add_indent().Add_proc_cont_one(Invk_load_text).Add_paren_bgn().Add_nl(); // .load_text(\n
|
||||
bldr.Add_quote_xtn_bgn(); // <~{\n'
|
||||
for (int i = 0; i < specials_len; i++) {
|
||||
Xol_specials_itm itm = specials_mgr.Get_at(i);
|
||||
bfr.Add(itm.Special()).Add_byte_pipe(); // id|
|
||||
int aliases_len = itm.Aliases().length;
|
||||
for (int j = 0; j < aliases_len; j++) {
|
||||
if (j != 0) bfr.Add_byte(Byte_ascii.Tilde);
|
||||
csv_parser.Save(bfr, itm.Aliases()[j]); // name
|
||||
}
|
||||
bfr.Add_byte_nl(); // \n
|
||||
}
|
||||
bldr.Add_quote_xtn_end(); // ']:>\n
|
||||
bldr.Add_paren_end().Add_proc_cont_one(Invk_lang).Add_nl(); // ).lang\n
|
||||
}
|
||||
public static void Save_keywords(Gfs_bldr bldr, Xol_kwd_mgr kwd_mgr) {
|
||||
int len = kwd_mgr.Len(); Xol_csv_parser csv_parser = Xol_csv_parser._;
|
||||
int count = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_kwd_grp grp = kwd_mgr.Get_at(i); if (grp == null) continue; // some items may not be loaded/set by lang
|
||||
++count;
|
||||
}
|
||||
if (count == 0) return;
|
||||
Bry_bfr bfr = bldr.Bfr();
|
||||
bldr.Add_proc_cont_one(Xol_lang.Invk_keywords).Add_nl(); // .keywords\n
|
||||
bldr.Add_indent().Add_proc_cont_one(Invk_load_text).Add_paren_bgn().Add_nl(); // .load_text(\n
|
||||
bldr.Add_quote_xtn_bgn(); // <~{\n'
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_kwd_grp grp = kwd_mgr.Get_at(i); if (grp == null) continue; // some items may not be loaded/set by lang
|
||||
csv_parser.Save(bfr, grp.Key()); // key
|
||||
bfr.Add_byte_pipe(); // |
|
||||
bfr.Add_int_bool(grp.Case_match()).Add_byte_pipe(); // 1|
|
||||
int word_len = grp.Itms().length;
|
||||
for (int j = 0; j < word_len; j++) {
|
||||
Xol_kwd_itm word = grp.Itms()[j];
|
||||
csv_parser.Save(bfr, word.Val()); // word
|
||||
bfr.Add_byte(Byte_ascii.Tilde); // ~
|
||||
}
|
||||
bldr.Add_nl(); // \n
|
||||
}
|
||||
bldr.Add_quote_xtn_end(); // ']:>\n
|
||||
bldr.Add_paren_end().Add_proc_cont_one(Invk_lang).Add_nl(); // ).lang\n
|
||||
}
|
||||
public static void Save_messages(Gfs_bldr bldr, Xol_msg_mgr msg_mgr, boolean dirty) {
|
||||
int len = msg_mgr.Itms_max(); Xol_csv_parser csv_parser = Xol_csv_parser._;
|
||||
int count = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_msg_itm itm = msg_mgr.Itm_by_id_or_null(i); if (itm == null) continue; // some items may not be loaded/set by lang
|
||||
if (dirty && !itm.Dirty()) continue; // TEST:
|
||||
++count;
|
||||
}
|
||||
if (count == 0) return;
|
||||
Bry_bfr bfr = bldr.Bfr();
|
||||
bldr.Add_proc_cont_one(Xol_lang.Invk_messages).Add_nl(); // .keywords\n
|
||||
bldr.Add_indent().Add_proc_cont_one(Invk_load_text).Add_paren_bgn().Add_nl(); // .load_text(\n
|
||||
bldr.Add_quote_xtn_bgn(); // <~{\n'
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_msg_itm itm = msg_mgr.Itm_by_id_or_null(i); if (itm == null) continue; // some items may not be loaded/set by lang
|
||||
if (dirty && !itm.Dirty()) continue; // TEST:
|
||||
csv_parser.Save(bfr, itm.Key()); // key
|
||||
bfr.Add_byte_pipe(); // |
|
||||
csv_parser.Save(bfr, itm.Val()); // val
|
||||
bfr.Add_byte_nl(); // \n
|
||||
}
|
||||
bldr.Add_quote_xtn_end(); // ']:>\n
|
||||
bldr.Add_paren_end().Add_proc_cont_one(Invk_lang).Add_nl(); // ).lang\n
|
||||
}
|
||||
public static final String Invk_load_text = "load_text", Invk_lang = "lang";
|
||||
}
|
||||
345
400_xowa/src_140_lang/gplx/xowa/Xol_lang_srl_tst.java
Normal file
345
400_xowa/src_140_lang/gplx/xowa/Xol_lang_srl_tst.java
Normal file
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import org.junit.*; import gplx.core.strings.*;
|
||||
import gplx.intl.*; import gplx.xowa.apps.*; import gplx.xowa.langs.numbers.*;
|
||||
public class Xol_lang_srl_tst {
|
||||
private Xol_lang_srl_fxt fxt = new Xol_lang_srl_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
@Test public void Ns_names() {
|
||||
String raw = String_.Concat_lines_nl
|
||||
( "ns_names"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "6|Filex"
|
||||
, "10|Templatex"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
);
|
||||
fxt.Invk(raw);
|
||||
Xol_ns_grp grp = fxt.Lang().Ns_names();
|
||||
fxt.Tst_ns_grp(grp, fxt.ns_(6, "Filex"), fxt.ns_(10, "Templatex"));
|
||||
fxt.Run_save_ns_grp(grp, Xol_lang.Invk_ns_names, raw);
|
||||
}
|
||||
@Test public void Ns_aliases() {
|
||||
String raw = String_.Concat_lines_nl
|
||||
( "ns_aliases"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "6|Filex"
|
||||
, "10|Templatex"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
);
|
||||
fxt.Invk(raw);
|
||||
Xol_ns_grp grp = fxt.Lang().Ns_aliases();
|
||||
fxt.Tst_ns_grp(grp, fxt.ns_(6, "Filex"), fxt.ns_(10, "Templatex"));
|
||||
fxt.Run_save_ns_grp(grp, Xol_lang.Invk_ns_aliases, raw);
|
||||
}
|
||||
@Test public void Kwds() {
|
||||
String raw = String_.Concat_lines_nl // NOTE: notoc must go before toc because ID order
|
||||
( "keywords"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "notoc|1|no_table_of_contents~toc_n~"
|
||||
, "toc|0|table_of_contents~toc_y~"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
);
|
||||
fxt.Invk(raw);
|
||||
Xol_kwd_mgr kwd_mgr = fxt.Lang().Kwd_mgr();
|
||||
fxt.Tst_keywords(kwd_mgr, fxt.kwd_("notoc", true, "no_table_of_contents", "toc_n"), fxt.kwd_("toc", false, "table_of_contents", "toc_y"));
|
||||
fxt.Run_save_kwd_mgr(kwd_mgr, Xol_lang.Invk_keywords, raw);
|
||||
}
|
||||
@Test public void Specials() {
|
||||
String raw = String_.Concat_lines_nl // NOTE: notoc must go before toc because ID order
|
||||
( "specials"
|
||||
, " .clear"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "Randompage|PageAuHasard~Page_au_hasard"
|
||||
, "Search|Recherche~Rechercher"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
);
|
||||
fxt.Invk(raw);
|
||||
Xol_specials_mgr specials_mgr = fxt.Lang().Specials_mgr();
|
||||
fxt.Tst_specials(specials_mgr, fxt.special_("Randompage", "PageAuHasard", "Page_au_hasard"), fxt.special_("Search", "Recherche", "Rechercher"));
|
||||
fxt.Run_save_specials_mgr(specials_mgr, Xol_lang.Invk_specials, raw);
|
||||
}
|
||||
@Test public void Kwds_blank_line() { // PURPOSE.fix: extra blank line negates entire entry
|
||||
String raw = String_.Concat_lines_nl
|
||||
( "keywords"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "toc|0|table_of_contents~toc_y~"
|
||||
, ""
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
);
|
||||
fxt.Invk(raw);
|
||||
Xol_kwd_mgr kwd_mgr = fxt.Lang().Kwd_mgr();
|
||||
fxt.Tst_keywords(kwd_mgr, fxt.kwd_("toc", false, "table_of_contents", "toc_y")); // make sure 2 items (and not 0)
|
||||
}
|
||||
@Test public void Msgs() {
|
||||
String raw = String_.Concat_lines_nl
|
||||
( "messages"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "sunday|dimanche"
|
||||
, "monday|lundi"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
);
|
||||
fxt.Invk(raw);
|
||||
Xol_msg_mgr msg_mgr = fxt.Lang().Msg_mgr();
|
||||
fxt.Tst_messages(msg_mgr, fxt.msg_("sunday", "dimanche"), fxt.msg_("monday", "lundi"));
|
||||
fxt.Run_save_msg_mgr(msg_mgr, Xol_lang.Invk_messages, raw);
|
||||
}
|
||||
@Test public void Fallback() {
|
||||
Io_mgr.I.SaveFilStr(Xol_lang_.xo_lang_fil_(fxt.App().Fsys_mgr(), "zh-hans"), String_.Concat_lines_nl
|
||||
( "this"
|
||||
, ".keywords"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "toc|0|table_of_contents~toc_y~"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
, ".ns_names"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "6|FileA"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
, ".messages"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "sunday|sunday1"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
, ";"
|
||||
));
|
||||
String raw = String_.Concat_lines_nl // NOTE: notoc must go before toc because ID order
|
||||
( "fallback_load('zh-hans')"
|
||||
, ".keywords"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "notoc|1|no_table_of_contents~toc_n~"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
, ".ns_names"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "6|FileB"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
, ".messages"
|
||||
, " .load_text("
|
||||
, "<:['"
|
||||
, "monday|monday1"
|
||||
, "']:>"
|
||||
, ").lang"
|
||||
);
|
||||
fxt.Invk(raw);
|
||||
Xol_kwd_mgr kwd_mgr = fxt.Lang().Kwd_mgr();
|
||||
fxt.Tst_keywords(kwd_mgr, fxt.kwd_("notoc", true, "no_table_of_contents", "toc_n"), fxt.kwd_("toc", false, "table_of_contents", "toc_y"));
|
||||
fxt.Tst_ns_grp(fxt.Lang().Ns_names(), fxt.ns_(6, "FileA"), fxt.ns_(6, "FileB"));
|
||||
fxt.Tst_messages(fxt.Lang().Msg_mgr(), fxt.msg_("sunday", "sunday1"), fxt.msg_("monday", "monday1"));
|
||||
}
|
||||
@Test public void Fallback_circular() { // PURPOSE: pt and pt-br cite each other as fallback in Messages*.php; DATE:2013-02-18
|
||||
Io_mgr.I.SaveFilStr(Xol_lang_.xo_lang_fil_(fxt.App().Fsys_mgr(), "pt") , "fallback_load('pt-br');");
|
||||
Io_mgr.I.SaveFilStr(Xol_lang_.xo_lang_fil_(fxt.App().Fsys_mgr(), "pt-br") , "fallback_load('pt');");
|
||||
Xol_lang lang = new Xol_lang(fxt.App().Lang_mgr(), Bry_.new_a7("pt"));
|
||||
lang.Init_by_load();
|
||||
}
|
||||
@Test public void Num_fmt() {
|
||||
String raw = String_.Concat_lines_nl
|
||||
( "numbers {"
|
||||
, " separators {"
|
||||
, " clear;"
|
||||
, " set(',', '.');"
|
||||
, " set('.', ',');"
|
||||
, " }"
|
||||
, "}"
|
||||
);
|
||||
fxt.Invk_no_semic(raw);
|
||||
fxt.Tst_num_fmt("1234,56", "1.234.56"); // NOTE: dot is repeated; confirmed with dewiki and {{formatnum:1234,56}}
|
||||
fxt.Run_save_num_mgr(fxt.Lang().Num_mgr(), raw);
|
||||
}
|
||||
@Test public void Num_fmt_apos() { // PURPOSE:de.ch has apos which breaks gfs
|
||||
fxt .Init_clear()
|
||||
.Init_separators(",", "'")
|
||||
.Init_separators(".", ",")
|
||||
;
|
||||
fxt.Run_save_num_mgr(fxt.Lang().Num_mgr(), String_.Concat_lines_nl
|
||||
( "numbers {"
|
||||
, " separators {"
|
||||
, " clear;"
|
||||
, " set(',', '''');"
|
||||
, " set('.', ',');"
|
||||
, " }"
|
||||
, "}"
|
||||
));
|
||||
}
|
||||
}
|
||||
class Xol_lang_srl_fxt {
|
||||
public void Clear() {
|
||||
app = Xoa_app_fxt.app_();
|
||||
lang = new Xol_lang(app.Lang_mgr(), Bry_.new_u8("fr"));
|
||||
Xoa_gfs_mgr.Msg_parser_init(); // required by fallback_load
|
||||
} GfsCtx ctx = GfsCtx.new_(); Gfs_bldr bldr = new Gfs_bldr(); //Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
public Xoae_app App() {return app;} private Xoae_app app;
|
||||
public Xol_lang Lang() {return lang;} private Xol_lang lang;
|
||||
public Xow_ns ns_(int id, String s) {return new Xow_ns(id, Xow_ns_case_.Id_1st, Bry_.new_u8(s), false);}
|
||||
public Xol_specials_itm special_(String key, String... words) {return new Xol_specials_itm(Bry_.new_u8(key), Bry_.Ary(words));}
|
||||
public Xol_kwd_grp kwd_(String key, boolean case_match, String... words) {
|
||||
Xol_kwd_grp rv = new Xol_kwd_grp(Bry_.new_u8(key));
|
||||
rv.Srl_load(case_match, Bry_.Ary(words));
|
||||
return rv;
|
||||
}
|
||||
public Xol_msg_itm msg_(String key, String val) {
|
||||
Xol_msg_itm rv = lang.Msg_mgr().Itm_by_key_or_new(Bry_.new_u8(key));
|
||||
rv.Atrs_set(Bry_.new_u8(val), false, false);
|
||||
return rv;
|
||||
}
|
||||
public Xol_lang_srl_fxt Init_clear() {
|
||||
lang.Num_mgr().Clear();
|
||||
return this;
|
||||
}
|
||||
public Xol_lang_srl_fxt Init_separators(String k, String v) {
|
||||
lang.Num_mgr().Separators_mgr().Set(Bry_.new_u8(k), Bry_.new_u8(v));
|
||||
return this;
|
||||
}
|
||||
public void Invk(String raw) {
|
||||
app.Gfs_mgr().Run_str_for(lang, raw + ";");
|
||||
}
|
||||
public void Invk_no_semic(String raw) {
|
||||
app.Gfs_mgr().Run_str_for(lang, raw);
|
||||
}
|
||||
public void Tst_ns_grp(Xol_ns_grp grp, Xow_ns... expd_ns) {
|
||||
Tfds.Eq_str_lines(Xto_str(expd_ns), Xto_str(To_ary(grp)));
|
||||
}
|
||||
public void Run_save_ns_grp(Xol_ns_grp grp, String invk, String raw) {
|
||||
Xol_lang_srl.Save_ns_grps(bldr, grp, invk);
|
||||
Tfds.Eq_str_lines("." + raw, bldr.Bfr().Xto_str_and_clear());
|
||||
}
|
||||
public void Run_save_kwd_mgr(Xol_kwd_mgr kwd_mgr, String invk, String raw) {
|
||||
Xol_lang_srl.Save_keywords(bldr, kwd_mgr);
|
||||
Tfds.Eq_str_lines("." + raw, bldr.Bfr().Xto_str_and_clear());
|
||||
}
|
||||
public void Run_save_msg_mgr(Xol_msg_mgr msg_mgr, String invk, String raw) {
|
||||
Xol_lang_srl.Save_messages(bldr, msg_mgr, true);
|
||||
Tfds.Eq_str_lines("." + raw, bldr.Bfr().Xto_str_and_clear());
|
||||
}
|
||||
public void Run_save_num_mgr(Xol_num_mgr num_mgr, String raw) {
|
||||
Xol_lang_srl.Save_num_mgr(bldr, num_mgr);
|
||||
Tfds.Eq_str_lines(raw, bldr.Bfr().Xto_str_and_clear());
|
||||
}
|
||||
public void Run_save_specials_mgr(Xol_specials_mgr specials_mgr, String invk, String raw) {
|
||||
Xol_lang_srl.Save_specials(bldr, specials_mgr);
|
||||
Tfds.Eq_str_lines("." + raw, bldr.Bfr().Xto_str_and_clear());
|
||||
}
|
||||
public void Tst_num_fmt(String raw, String expd) {Tfds.Eq(expd, String_.new_u8(lang.Num_mgr().Format_num(Bry_.new_u8(raw))));}
|
||||
public void Tst_keywords(Xol_kwd_mgr kwd_mgr, Xol_kwd_grp... ary) {
|
||||
Tfds.Eq_str_lines(Xto_str(ary), Xto_str(To_ary(kwd_mgr)));
|
||||
}
|
||||
public void Tst_messages(Xol_msg_mgr msg_mgr, Xol_msg_itm... ary) {
|
||||
Tfds.Eq_str_lines(Xto_str(ary), Xto_str(To_ary(msg_mgr)));
|
||||
}
|
||||
public void Tst_specials(Xol_specials_mgr specials_mgr, Xol_specials_itm... expd) {
|
||||
Tfds.Eq_str_lines(Xto_str(expd), Xto_str(To_ary(specials_mgr)));
|
||||
}
|
||||
private String Xto_str(Xol_specials_itm[] ary) {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_specials_itm itm = ary[i];
|
||||
sb.Add(itm.Special()).Add("|");
|
||||
int aliases_len = itm.Aliases().length;
|
||||
for (int j = 0; j < aliases_len; j++) {
|
||||
if (j != 0) sb.Add("~");
|
||||
sb.Add(itm.Aliases()[j]).Add_char_nl();
|
||||
}
|
||||
}
|
||||
return sb.Xto_str_and_clear();
|
||||
}
|
||||
private Xol_specials_itm[] To_ary(Xol_specials_mgr specials_mgr) {
|
||||
int len = specials_mgr.Count();
|
||||
Xol_specials_itm[] rv = new Xol_specials_itm[len];
|
||||
for (int i = 0; i < len; i++)
|
||||
rv[i] = specials_mgr.Get_at(i);
|
||||
return rv;
|
||||
}
|
||||
String Xto_str(Xow_ns[] ary) {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xow_ns ns = ary[i];
|
||||
sb.Add(ns.Id()).Add("|").Add(ns.Name_str()).Add_char_nl();
|
||||
}
|
||||
return sb.Xto_str_and_clear();
|
||||
}
|
||||
Xow_ns[] To_ary(Xol_ns_grp ary) {
|
||||
int len = ary.Len();
|
||||
Xow_ns[] rv = new Xow_ns[len];
|
||||
for (int i = 0; i < len; i++)
|
||||
rv[i] = ary.Get_at(i);
|
||||
return rv;
|
||||
}
|
||||
Xol_kwd_grp[] To_ary(Xol_kwd_mgr kwd_mgr) {
|
||||
int len = kwd_mgr.Len();
|
||||
List_adp rv = List_adp_.new_();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_kwd_grp kwd_grp = kwd_mgr.Get_at(i);
|
||||
if (kwd_grp == null) continue;
|
||||
rv.Add(kwd_grp);
|
||||
}
|
||||
return (Xol_kwd_grp[])rv.To_ary(Xol_kwd_grp.class);
|
||||
}
|
||||
String Xto_str(Xol_kwd_grp[] ary) {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_kwd_grp grp = ary[i];
|
||||
sb.Add(grp.Key()).Add("|").Add(grp.Case_match() ? "1" : "0").Add("|");
|
||||
Xol_kwd_itm[] itms = grp.Itms();
|
||||
int itms_len = itms.length;
|
||||
for (int j = 0; j < itms_len; j++) {
|
||||
sb.Add(itms[i].Val()).Add(";");
|
||||
}
|
||||
sb.Add_char_nl();
|
||||
}
|
||||
return sb.Xto_str_and_clear();
|
||||
}
|
||||
Xol_msg_itm[] To_ary(Xol_msg_mgr msg_mgr) {
|
||||
int len = msg_mgr.Itms_max();
|
||||
List_adp rv = List_adp_.new_();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_msg_itm itm = msg_mgr.Itm_by_id_or_null(i);
|
||||
if (itm == null || !itm.Dirty()) continue;
|
||||
rv.Add(itm);
|
||||
}
|
||||
return (Xol_msg_itm[])rv.To_ary(Xol_msg_itm.class);
|
||||
}
|
||||
String Xto_str(Xol_msg_itm[] ary) {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xol_msg_itm itm = ary[i];
|
||||
sb.Add(itm.Key()).Add("|").Add(itm.Val()).Add_char_nl();
|
||||
}
|
||||
return sb.Xto_str_and_clear();
|
||||
}
|
||||
private static String_bldr sb = String_bldr_.new_();
|
||||
}
|
||||
73
400_xowa/src_140_lang/gplx/xowa/Xol_lnki_trail_mgr.java
Normal file
73
400_xowa/src_140_lang/gplx/xowa/Xol_lnki_trail_mgr.java
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import gplx.core.btries.*;
|
||||
public class Xol_lnki_trail_mgr implements GfoInvkAble {
|
||||
public Xol_lnki_trail_mgr(Xol_lang lang) {}
|
||||
public void Clear() {trie.Clear();}
|
||||
public int Count() {return trie.Count();}
|
||||
public Btrie_slim_mgr Trie() {return trie;} Btrie_slim_mgr trie = Btrie_slim_mgr.cs_();
|
||||
public void Add(byte[] v) {trie.Add_obj(v, v);}
|
||||
public void Del(byte[] v) {trie.Del(v);}
|
||||
private void Add(String... ary) {
|
||||
for (String itm_str : ary) {
|
||||
byte[] itm = Bry_.new_u8(itm_str);
|
||||
trie.Add_obj(itm, itm);
|
||||
}
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_add_range)) Add_range(m);
|
||||
else if (ctx.Match(k, Invk_add_many)) Add_many(m);
|
||||
else if (ctx.Match(k, Invk_add_bulk)) Add_bulk(m);
|
||||
else if (ctx.Match(k, Invk_clear)) Clear();
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_add_many = "add_many", Invk_add_range = "add_range", Invk_add_bulk = "add_bulk", Invk_clear = "clear";
|
||||
private void Add_bulk(GfoMsg m) {byte[] src = m.ReadBry("bulk"); Add_bulk(src);}
|
||||
public void Add_bulk(byte[] src) {
|
||||
int pos = 0, src_len = src.length;
|
||||
while (true) {
|
||||
byte[] itm = gplx.intl.Utf8_.Get_char_at_pos_as_bry(src, pos);
|
||||
Add(itm);
|
||||
pos += itm.length;
|
||||
if (pos >= src_len) break;
|
||||
}
|
||||
}
|
||||
private void Add_many(GfoMsg m) {
|
||||
int len = m.Args_count();
|
||||
for (int i = 0; i < len; i++) {
|
||||
KeyVal kv = m.Args_getAt(i);
|
||||
Add(kv.Val_to_str_or_empty());
|
||||
}
|
||||
}
|
||||
private void Add_range(GfoMsg m) {
|
||||
byte bgn = Add_rng_extract(m, "bgn");
|
||||
byte end = Add_rng_extract(m, "end");
|
||||
for (byte i = bgn; i <= end; i++)
|
||||
Add(new byte[] {i});
|
||||
}
|
||||
public void Add_range(byte bgn, byte end) {
|
||||
for (byte i = bgn; i <= end; i++)
|
||||
Add(new byte[] {i});
|
||||
}
|
||||
byte Add_rng_extract(GfoMsg m, String key) {
|
||||
byte[] bry = m.ReadBry(key);
|
||||
if (bry.length != 1) throw Exc_.new_("argument must be ascii character", "key", key, "bry", String_.new_u8(bry));
|
||||
return bry[0];
|
||||
}
|
||||
}
|
||||
43
400_xowa/src_140_lang/gplx/xowa/Xol_lnki_trail_mgr_tst.java
Normal file
43
400_xowa/src_140_lang/gplx/xowa/Xol_lnki_trail_mgr_tst.java
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class Xol_lnki_trail_mgr_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xol_lnki_trail_mgr_fxt fxt = new Xol_lnki_trail_mgr_fxt();
|
||||
@Test public void Add_bulk() {
|
||||
fxt.Test_add_bulk("äöüß", "ä", "ö", "ü", "ß");
|
||||
}
|
||||
}
|
||||
class Xol_lnki_trail_mgr_fxt {
|
||||
Xol_lang lang; Xol_lnki_trail_mgr lnki_trail_mgr;
|
||||
public void Clear() {
|
||||
Xoae_app app = Xoa_app_fxt.app_();
|
||||
lang = new Xol_lang(app.Lang_mgr(), Bry_.new_u8("fr"));
|
||||
lnki_trail_mgr = lang.Lnki_trail_mgr();
|
||||
}
|
||||
public void Test_add_bulk(String raw, String... expd_ary) {
|
||||
lnki_trail_mgr.Add_bulk(Bry_.new_u8(raw));
|
||||
int expd_len = expd_ary.length;
|
||||
Tfds.Eq(expd_len, lang.Lnki_trail_mgr().Count());
|
||||
for (int i = 0; i < expd_len; i++) {
|
||||
byte[] expd_bry = Bry_.new_u8(expd_ary[i]);
|
||||
byte[] actl_bry = (byte[])lnki_trail_mgr.Trie().Match_bgn(expd_bry, 0, expd_bry.length);
|
||||
Tfds.Eq_bry(expd_bry, actl_bry);
|
||||
}
|
||||
}
|
||||
}
|
||||
48
400_xowa/src_140_lang/gplx/xowa/Xol_msg_itm.java
Normal file
48
400_xowa/src_140_lang/gplx/xowa/Xol_msg_itm.java
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
public class Xol_msg_itm {
|
||||
public Xol_msg_itm(int id, byte[] key) {this.id = id; this.key = key;}
|
||||
public int Id() {return id;} public void Id_(int v) {this.id = v;} private int id;
|
||||
public boolean Src_is_missing() {return src == Src_missing;}
|
||||
public byte Src() {return src;} public Xol_msg_itm Src_(byte v) {src = v; return this;} private byte src;
|
||||
public byte[] Key() {return key;} private byte[] key;
|
||||
public byte[] Val() {return val;} private byte[] val;
|
||||
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 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 boolean Dirty() {return dirty;} public Xol_msg_itm Dirty_(boolean v) {dirty = v; return this;} private boolean dirty;
|
||||
public byte[] Fmt(Bry_bfr bfr, Object... args) {
|
||||
synchronized (tmp_fmtr) {
|
||||
tmp_fmtr.Fmt_(val);
|
||||
tmp_fmtr.Bld_bfr_many(bfr, args);
|
||||
return bfr.Xto_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.Xto_bry_and_clear();
|
||||
}
|
||||
}
|
||||
public static final byte Src_null = 0, Src_lang = 1, Src_wiki = 2, Src_missing = 3;
|
||||
private static Bry_fmtr tmp_fmtr = Bry_fmtr.tmp_();
|
||||
}
|
||||
516
400_xowa/src_140_lang/gplx/xowa/Xol_msg_itm_.java
Normal file
516
400_xowa/src_140_lang/gplx/xowa/Xol_msg_itm_.java
Normal file
@@ -0,0 +1,516 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import gplx.core.btries.*;
|
||||
public class Xol_msg_itm_ {
|
||||
public static final int
|
||||
Id_dte_dow_name_sunday = 0
|
||||
, Id_dte_dow_name_monday = 1
|
||||
, Id_dte_dow_name_tuesday = 2
|
||||
, Id_dte_dow_name_wednesday = 3
|
||||
, Id_dte_dow_name_thursday = 4
|
||||
, Id_dte_dow_name_friday = 5
|
||||
, Id_dte_dow_name_saturday = 6
|
||||
, Id_dte_dow_abrv_sun = 7
|
||||
, Id_dte_dow_abrv_mon = 8
|
||||
, Id_dte_dow_abrv_tue = 9
|
||||
, Id_dte_dow_abrv_wed = 10
|
||||
, Id_dte_dow_abrv_thu = 11
|
||||
, Id_dte_dow_abrv_fri = 12
|
||||
, Id_dte_dow_abrv_sat = 13
|
||||
, Id_dte_month_name_january = 14
|
||||
, Id_dte_month_name_february = 15
|
||||
, Id_dte_month_name_march = 16
|
||||
, Id_dte_month_name_april = 17
|
||||
, Id_dte_month_name_may = 18
|
||||
, Id_dte_month_name_june = 19
|
||||
, Id_dte_month_name_july = 20
|
||||
, Id_dte_month_name_august = 21
|
||||
, Id_dte_month_name_september = 22
|
||||
, Id_dte_month_name_october = 23
|
||||
, Id_dte_month_name_november = 24
|
||||
, Id_dte_month_name_december = 25
|
||||
, Id_dte_month_gen_january = 26
|
||||
, Id_dte_month_gen_february = 27
|
||||
, Id_dte_month_gen_march = 28
|
||||
, Id_dte_month_gen_april = 29
|
||||
, Id_dte_month_gen_may = 30
|
||||
, Id_dte_month_gen_june = 31
|
||||
, Id_dte_month_gen_july = 32
|
||||
, Id_dte_month_gen_august = 33
|
||||
, Id_dte_month_gen_september = 34
|
||||
, Id_dte_month_gen_october = 35
|
||||
, Id_dte_month_gen_november = 36
|
||||
, Id_dte_month_gen_december = 37
|
||||
, Id_dte_month_abrv_jan = 38
|
||||
, Id_dte_month_abrv_feb = 39
|
||||
, Id_dte_month_abrv_mar = 40
|
||||
, Id_dte_month_abrv_apr = 41
|
||||
, Id_dte_month_abrv_may = 42
|
||||
, Id_dte_month_abrv_jun = 43
|
||||
, Id_dte_month_abrv_jul = 44
|
||||
, Id_dte_month_abrv_aug = 45
|
||||
, Id_dte_month_abrv_sep = 46
|
||||
, Id_dte_month_abrv_oct = 47
|
||||
, Id_dte_month_abrv_nov = 48
|
||||
, Id_dte_month_abrv_dec = 49
|
||||
, Id_pfunc_desc = 50
|
||||
, Id_pfunc_time_error = 51
|
||||
, Id_pfunc_time_too_long = 52
|
||||
, Id_pfunc_rel2abs_invalid_depth = 53
|
||||
, Id_pfunc_expr_stack_exhausted = 54
|
||||
, Id_pfunc_expr_unexpected_number = 55
|
||||
, Id_pfunc_expr_preg_match_failure = 56
|
||||
, Id_pfunc_expr_unrecognised_word = 57
|
||||
, Id_pfunc_expr_unexpected_operator = 58
|
||||
, Id_pfunc_expr_missing_operand = 59
|
||||
, Id_pfunc_expr_unexpected_closing_bracket = 60
|
||||
, Id_pfunc_expr_unrecognised_punctuation = 61
|
||||
, Id_pfunc_expr_unclosed_bracket = 62
|
||||
, Id_pfunc_expr_division_by_zero = 63
|
||||
, Id_pfunc_expr_invalid_argument = 64
|
||||
, Id_pfunc_expr_invalid_argument_ln = 65
|
||||
, Id_pfunc_expr_unknown_error = 66
|
||||
, Id_pfunc_expr_not_a_number = 67
|
||||
, Id_pfunc_string_too_long = 68
|
||||
, Id_pfunc_convert_dimensionmismatch = 69
|
||||
, Id_pfunc_convert_unknownunit = 70
|
||||
, Id_pfunc_convert_unknowndimension = 71
|
||||
, Id_pfunc_convert_invalidcompoundunit = 72
|
||||
, Id_pfunc_convert_nounit = 73
|
||||
, Id_pfunc_convert_doublecompoundunit = 74
|
||||
, Id_toc = 75
|
||||
, Id_redirectedfrom = 76
|
||||
, Id_sp_allpages_hdr = 77
|
||||
, Id_sp_allpages_bwd = 78
|
||||
, Id_sp_allpages_fwd = 79
|
||||
, Id_js_tables_collapsible_collapse = 80
|
||||
, Id_js_tables_collapsible_expand = 81
|
||||
, Id_js_tables_sort_descending = 82
|
||||
, Id_js_tables_sort_ascending = 83
|
||||
, Id_ctg_tbl_hdr = 84
|
||||
, Id_portal_lastmodified = 85
|
||||
, Id_file_enlarge = 86
|
||||
, Id_xowa_portal_exit_text = 87
|
||||
, Id_xowa_portal_exit_tooltip = 88
|
||||
, Id_xowa_portal_exit_accesskey = 89
|
||||
, Id_xowa_portal_view_html_text = 90
|
||||
, Id_xowa_portal_view_html_tooltip = 91
|
||||
, Id_xowa_portal_view_html_accesskey = 92
|
||||
, Id_xowa_portal_bookmarks_text = 93
|
||||
, Id_xowa_portal_bookmarks_add_text = 94
|
||||
, Id_xowa_portal_bookmarks_add_tooltip = 95
|
||||
, Id_xowa_portal_bookmarks_add_accesskey = 96
|
||||
, Id_xowa_portal_bookmarks_show_text = 97
|
||||
, Id_xowa_portal_bookmarks_show_tooltip = 98
|
||||
, Id_xowa_portal_bookmarks_show_accesskey = 99
|
||||
, Id_xowa_portal_page_history_text = 100
|
||||
, Id_xowa_portal_page_history_tooltip = 101
|
||||
, Id_xowa_portal_page_history_accesskey = 102
|
||||
, Id_xowa_portal_options_text = 103
|
||||
, Id_xowa_portal_options_tooltip = 104
|
||||
, Id_xowa_portal_options_accesskey = 105
|
||||
, Id_xowa_portal_version_text = 106
|
||||
, Id_xowa_portal_build_time_text = 107
|
||||
, Id_page_lang_header = 108
|
||||
, Id_xowa_window_go_bwd_btn_tooltip = 109
|
||||
, Id_xowa_window_go_fwd_btn_tooltip = 110
|
||||
, Id_xowa_window_url_box_tooltip = 111
|
||||
, Id_xowa_window_url_btn_tooltip = 112
|
||||
, Id_xowa_window_search_box_tooltip = 113
|
||||
, Id_xowa_window_search_btn_tooltip = 114
|
||||
, Id_xowa_window_find_close_btn_tooltip = 115
|
||||
, Id_xowa_window_find_box_tooltip = 116
|
||||
, Id_xowa_window_find_fwd_btn_tooltip = 117
|
||||
, Id_xowa_window_find_bwd_btn_tooltip = 118
|
||||
, Id_xowa_window_prog_box_tooltip = 119
|
||||
, Id_xowa_window_info_box_tooltip = 120
|
||||
, Id_scribunto_parser_error = 121
|
||||
, Id_ns_blankns = 122
|
||||
, Id_ctg_page_label = 123
|
||||
, Id_ctg_page_header = 124
|
||||
, Id_ctg_subc_label = 125
|
||||
, Id_ctg_file_header = 126
|
||||
, Id_ctg_empty = 127
|
||||
, Id_ctg_subc_count = 128
|
||||
, Id_ctg_subc_count_limit = 129
|
||||
, Id_ctg_page_count = 130
|
||||
, Id_ctg_page_count_limit = 131
|
||||
, Id_ctg_file_count = 132
|
||||
, Id_ctg_file_count_limit = 133
|
||||
, Id_ctgtree_subc_counts = 134
|
||||
, Id_ctgtree_subc_counts_ctg = 135
|
||||
, Id_ctgtree_subc_counts_page = 136
|
||||
, Id_ctgtree_subc_counts_file = 137
|
||||
, Id_next_results = 138
|
||||
, Id_prev_results = 139
|
||||
, Id_list_continues = 140
|
||||
, Id_xowa_wikidata_languages = 141
|
||||
, Id_xowa_wikidata_labels = 142
|
||||
, Id_xowa_wikidata_aliasesHead = 143
|
||||
, Id_xowa_wikidata_descriptions = 144
|
||||
, Id_xowa_wikidata_links = 145
|
||||
, Id_xowa_wikidata_claims = 146
|
||||
, Id_xowa_wikidata_json = 147
|
||||
, Id_xowa_wikidata_language = 148
|
||||
, Id_xowa_wikidata_wiki = 149
|
||||
, Id_xowa_wikidata_label = 150
|
||||
, Id_xowa_wikidata_aliases = 151
|
||||
, Id_xowa_wikidata_description = 152
|
||||
, Id_xowa_wikidata_link = 153
|
||||
, Id_xowa_wikidata_property = 154
|
||||
, Id_xowa_wikidata_value = 155
|
||||
, Id_xowa_wikidata_references = 156
|
||||
, Id_xowa_wikidata_qualifiers = 157
|
||||
, Id_search_results_header = 158
|
||||
, Id_edit_toolbar_bold_sample = 159
|
||||
, Id_edit_toolbar_bold_tip = 160
|
||||
, Id_edit_toolbar_italic_sample = 161
|
||||
, Id_edit_toolbar_italic_tip = 162
|
||||
, Id_edit_toolbar_link_sample = 163
|
||||
, Id_edit_toolbar_link_tip = 164
|
||||
, Id_edit_toolbar_headline_sample = 165
|
||||
, Id_edit_toolbar_headline_tip = 166
|
||||
, Id_edit_toolbar_ulist_tip = 167
|
||||
, Id_edit_toolbar_ulist_sample = 168
|
||||
, Id_edit_toolbar_olist_tip = 169
|
||||
, Id_edit_toolbar_olist_sample = 170
|
||||
, Id_xowa_portal_about_text = 171
|
||||
, Id_xowa_portal_about_tooltip = 172
|
||||
, Id_xowa_portal_about_accesskey = 173
|
||||
, Id_symbol_catseparator = 174
|
||||
, Id_symbol_semicolon_separator = 175
|
||||
, Id_symbol_comma_separator = 176
|
||||
, Id_symbol_colon_separator = 177
|
||||
, Id_symbol_autocomment_prefix = 178
|
||||
, Id_symbol_pipe_separator = 179
|
||||
, Id_symbol_word_separator = 180
|
||||
, Id_symbol_ellipsis = 181
|
||||
, Id_symbol_percent = 182
|
||||
, Id_symbol_parentheses = 183
|
||||
, Id_duration_ago = 184
|
||||
, Id_xowa_wikidata_novalue = 185
|
||||
, Id_xowa_wikidata_somevalue = 186
|
||||
, Id_xowa_wikidata_links_wiki = 187
|
||||
, Id_xowa_wikidata_links_wiktionary = 188
|
||||
, Id_xowa_wikidata_links_wikisource = 189
|
||||
, Id_xowa_wikidata_links_wikivoyage = 190
|
||||
, Id_xowa_wikidata_links_wikiquote = 191
|
||||
, Id_xowa_wikidata_links_wikibooks = 192
|
||||
, Id_xowa_wikidata_links_wikiversity = 193
|
||||
, Id_xowa_wikidata_links_wikinews = 194
|
||||
, Id_xowa_wikidata_plus = 195
|
||||
, Id_xowa_wikidata_minus = 196
|
||||
, Id_xowa_wikidata_plusminus = 197
|
||||
, Id_xowa_wikidata_degree = 198
|
||||
, Id_xowa_wikidata_minute = 199
|
||||
, Id_xowa_wikidata_second = 200
|
||||
, Id_xowa_wikidata_north = 201
|
||||
, Id_xowa_wikidata_south = 202
|
||||
, Id_xowa_wikidata_west = 203
|
||||
, Id_xowa_wikidata_east = 204
|
||||
, Id_xowa_wikidata_meters = 205
|
||||
, Id_xowa_wikidata_julian = 206
|
||||
, Id_xowa_wikidata_decade = 207
|
||||
, Id_xowa_wikidata_century = 208
|
||||
, Id_xowa_wikidata_millenium = 209
|
||||
, Id_xowa_wikidata_years1e4 = 210
|
||||
, Id_xowa_wikidata_years1e5 = 211
|
||||
, Id_xowa_wikidata_years1e6 = 212
|
||||
, Id_xowa_wikidata_years1e7 = 213
|
||||
, Id_xowa_wikidata_years1e8 = 214
|
||||
, Id_xowa_wikidata_years1e9 = 215
|
||||
, Id_xowa_wikidata_bc = 216
|
||||
, Id_xowa_wikidata_inTime = 217
|
||||
, Id_ctg_tbl_hidden = 218
|
||||
, Id_ctg_help_page = 219
|
||||
, Id_statistics_title = 220
|
||||
, Id_statistics_header_pages = 221
|
||||
, Id_statistics_articles = 222
|
||||
, Id_statistics_pages = 223
|
||||
, Id_statistics_pages_desc = 224
|
||||
, Id_statistics_header_ns = 225
|
||||
, Id_wikibase_diffview_rank = 226
|
||||
, Id_xowa_wikidata_deprecated = 227
|
||||
, Id_xowa_wikidata_normal = 228
|
||||
, Id_xowa_wikidata_preferred = 229
|
||||
, Id_xowa_wikidata_links_special = 230
|
||||
;
|
||||
public static final int Id__max = 231;
|
||||
public static Xol_msg_itm new_(int id, String key, String val) {return new_(id, Bry_.new_u8(key), Bry_.new_u8(val));}
|
||||
public static Xol_msg_itm new_(int id, byte[] key, byte[] val) {
|
||||
Xol_msg_itm rv = new Xol_msg_itm(id, key);
|
||||
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_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
public static void update_val_(Xol_msg_itm itm, byte[] val) {
|
||||
boolean has_fmt_arg = tmp_fmtr.Fmt_(val).Compile().Fmt_args_exist();
|
||||
boolean has_tmpl_txt = Bry_finder.Find_fwd(val, Xop_curly_bgn_lxr.Hook, 0) != -1;
|
||||
val = trie_space.Replace(tmp_bfr, val, 0, val.length);
|
||||
itm.Atrs_set(val, has_fmt_arg, has_tmpl_txt);
|
||||
}
|
||||
public static final byte[] Bry_nbsp = Byte_.Ary_by_ints(194, 160);
|
||||
private static final Btrie_slim_mgr trie_space = Btrie_slim_mgr.cs_() // MW:cache/MessageCache.php|get|Fix for trailing whitespace, removed by textarea|DATE:2014-04-29
|
||||
.Add_bry(" " , " ")
|
||||
.Add_bry(" " , Bry_nbsp)
|
||||
.Add_bry(" " , Bry_nbsp)
|
||||
;
|
||||
public static Xol_msg_itm new_(int id) {
|
||||
switch (id) {
|
||||
case Xol_msg_itm_.Id_dte_dow_name_sunday: return new_(Xol_msg_itm_.Id_dte_dow_name_sunday, "sunday", "Sunday");
|
||||
case Xol_msg_itm_.Id_dte_dow_name_monday: return new_(Xol_msg_itm_.Id_dte_dow_name_monday, "monday", "Monday");
|
||||
case Xol_msg_itm_.Id_dte_dow_name_tuesday: return new_(Xol_msg_itm_.Id_dte_dow_name_tuesday, "tuesday", "Tuesday");
|
||||
case Xol_msg_itm_.Id_dte_dow_name_wednesday: return new_(Xol_msg_itm_.Id_dte_dow_name_wednesday, "wednesday", "Wednesday");
|
||||
case Xol_msg_itm_.Id_dte_dow_name_thursday: return new_(Xol_msg_itm_.Id_dte_dow_name_thursday, "thursday", "Thursday");
|
||||
case Xol_msg_itm_.Id_dte_dow_name_friday: return new_(Xol_msg_itm_.Id_dte_dow_name_friday, "friday", "Friday");
|
||||
case Xol_msg_itm_.Id_dte_dow_name_saturday: return new_(Xol_msg_itm_.Id_dte_dow_name_saturday, "saturday", "Saturday");
|
||||
case Xol_msg_itm_.Id_dte_dow_abrv_sun: return new_(Xol_msg_itm_.Id_dte_dow_abrv_sun, "sun", "Sun");
|
||||
case Xol_msg_itm_.Id_dte_dow_abrv_mon: return new_(Xol_msg_itm_.Id_dte_dow_abrv_mon, "mon", "Mon");
|
||||
case Xol_msg_itm_.Id_dte_dow_abrv_tue: return new_(Xol_msg_itm_.Id_dte_dow_abrv_tue, "tue", "Tue");
|
||||
case Xol_msg_itm_.Id_dte_dow_abrv_wed: return new_(Xol_msg_itm_.Id_dte_dow_abrv_wed, "wed", "Wed");
|
||||
case Xol_msg_itm_.Id_dte_dow_abrv_thu: return new_(Xol_msg_itm_.Id_dte_dow_abrv_thu, "thu", "Thu");
|
||||
case Xol_msg_itm_.Id_dte_dow_abrv_fri: return new_(Xol_msg_itm_.Id_dte_dow_abrv_fri, "fri", "Fri");
|
||||
case Xol_msg_itm_.Id_dte_dow_abrv_sat: return new_(Xol_msg_itm_.Id_dte_dow_abrv_sat, "sat", "Sat");
|
||||
case Xol_msg_itm_.Id_dte_month_name_january: return new_(Xol_msg_itm_.Id_dte_month_name_january, "january", "January");
|
||||
case Xol_msg_itm_.Id_dte_month_name_february: return new_(Xol_msg_itm_.Id_dte_month_name_february, "february", "February");
|
||||
case Xol_msg_itm_.Id_dte_month_name_march: return new_(Xol_msg_itm_.Id_dte_month_name_march, "march", "March");
|
||||
case Xol_msg_itm_.Id_dte_month_name_april: return new_(Xol_msg_itm_.Id_dte_month_name_april, "april", "April");
|
||||
case Xol_msg_itm_.Id_dte_month_name_may: return new_(Xol_msg_itm_.Id_dte_month_name_may, "may_long", "May");
|
||||
case Xol_msg_itm_.Id_dte_month_name_june: return new_(Xol_msg_itm_.Id_dte_month_name_june, "june", "June");
|
||||
case Xol_msg_itm_.Id_dte_month_name_july: return new_(Xol_msg_itm_.Id_dte_month_name_july, "july", "July");
|
||||
case Xol_msg_itm_.Id_dte_month_name_august: return new_(Xol_msg_itm_.Id_dte_month_name_august, "august", "August");
|
||||
case Xol_msg_itm_.Id_dte_month_name_september: return new_(Xol_msg_itm_.Id_dte_month_name_september, "september", "September");
|
||||
case Xol_msg_itm_.Id_dte_month_name_october: return new_(Xol_msg_itm_.Id_dte_month_name_october, "october", "October");
|
||||
case Xol_msg_itm_.Id_dte_month_name_november: return new_(Xol_msg_itm_.Id_dte_month_name_november, "november", "November");
|
||||
case Xol_msg_itm_.Id_dte_month_name_december: return new_(Xol_msg_itm_.Id_dte_month_name_december, "december", "December");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_january: return new_(Xol_msg_itm_.Id_dte_month_gen_january, "january-gen", "January");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_february: return new_(Xol_msg_itm_.Id_dte_month_gen_february, "february-gen", "February");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_march: return new_(Xol_msg_itm_.Id_dte_month_gen_march, "march-gen", "March");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_april: return new_(Xol_msg_itm_.Id_dte_month_gen_april, "april-gen", "April");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_may: return new_(Xol_msg_itm_.Id_dte_month_gen_may, "may-gen", "May");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_june: return new_(Xol_msg_itm_.Id_dte_month_gen_june, "june-gen", "June");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_july: return new_(Xol_msg_itm_.Id_dte_month_gen_july, "july-gen", "July");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_august: return new_(Xol_msg_itm_.Id_dte_month_gen_august, "august-gen", "August");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_september: return new_(Xol_msg_itm_.Id_dte_month_gen_september, "september-gen", "September");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_october: return new_(Xol_msg_itm_.Id_dte_month_gen_october, "october-gen", "October");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_november: return new_(Xol_msg_itm_.Id_dte_month_gen_november, "november-gen", "November");
|
||||
case Xol_msg_itm_.Id_dte_month_gen_december: return new_(Xol_msg_itm_.Id_dte_month_gen_december, "december-gen", "December");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_jan: return new_(Xol_msg_itm_.Id_dte_month_abrv_jan, "jan", "Jan");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_feb: return new_(Xol_msg_itm_.Id_dte_month_abrv_feb, "feb", "Feb");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_mar: return new_(Xol_msg_itm_.Id_dte_month_abrv_mar, "mar", "Mar");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_apr: return new_(Xol_msg_itm_.Id_dte_month_abrv_apr, "apr", "Apr");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_may: return new_(Xol_msg_itm_.Id_dte_month_abrv_may, "may", "May");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_jun: return new_(Xol_msg_itm_.Id_dte_month_abrv_jun, "jun", "Jun");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_jul: return new_(Xol_msg_itm_.Id_dte_month_abrv_jul, "jul", "Jul");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_aug: return new_(Xol_msg_itm_.Id_dte_month_abrv_aug, "aug", "Aug");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_sep: return new_(Xol_msg_itm_.Id_dte_month_abrv_sep, "sep", "Sep");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_oct: return new_(Xol_msg_itm_.Id_dte_month_abrv_oct, "oct", "Oct");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_nov: return new_(Xol_msg_itm_.Id_dte_month_abrv_nov, "nov", "Nov");
|
||||
case Xol_msg_itm_.Id_dte_month_abrv_dec: return new_(Xol_msg_itm_.Id_dte_month_abrv_dec, "dec", "Dec");
|
||||
case Xol_msg_itm_.Id_pfunc_desc: return new_(Xol_msg_itm_.Id_pfunc_desc, "pfunc_desc", "Enhance parser with logical functions");
|
||||
case Xol_msg_itm_.Id_pfunc_time_error: return new_(Xol_msg_itm_.Id_pfunc_time_error, "pfunc_time_error", "Error: invalid time");
|
||||
case Xol_msg_itm_.Id_pfunc_time_too_long: return new_(Xol_msg_itm_.Id_pfunc_time_too_long, "pfunc_time_too_long", "Error: too many #time calls");
|
||||
case Xol_msg_itm_.Id_pfunc_rel2abs_invalid_depth: return new_(Xol_msg_itm_.Id_pfunc_rel2abs_invalid_depth, "pfunc_rel2abs_invalid_depth", "Error: Invalid depth in path: \"~{0}\" (tried to access a node above the root node)");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_stack_exhausted: return new_(Xol_msg_itm_.Id_pfunc_expr_stack_exhausted, "pfunc_expr_stack_exhausted", "Expression error: Stack exhausted");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_unexpected_number: return new_(Xol_msg_itm_.Id_pfunc_expr_unexpected_number, "pfunc_expr_unexpected_number", "Expression error: Unexpected number");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_preg_match_failure: return new_(Xol_msg_itm_.Id_pfunc_expr_preg_match_failure, "pfunc_expr_preg_match_failure", "Expression error: Unexpected preg_match failure");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_unrecognised_word: return new_(Xol_msg_itm_.Id_pfunc_expr_unrecognised_word, "pfunc_expr_unrecognised_word", "Expression error: Unrecognised word \"~{0}\"");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_unexpected_operator: return new_(Xol_msg_itm_.Id_pfunc_expr_unexpected_operator, "pfunc_expr_unexpected_operator", "Expression error: Unexpected ~{0} operator");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_missing_operand: return new_(Xol_msg_itm_.Id_pfunc_expr_missing_operand, "pfunc_expr_missing_operand", "Expression error: Missing operand for ~{0}");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_unexpected_closing_bracket: return new_(Xol_msg_itm_.Id_pfunc_expr_unexpected_closing_bracket, "pfunc_expr_unexpected_closing_bracket", "Expression error: Unexpected closing bracket");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_unrecognised_punctuation: return new_(Xol_msg_itm_.Id_pfunc_expr_unrecognised_punctuation, "pfunc_expr_unrecognised_punctuation", "Expression error: Unrecognised punctuation character \"~{0}\"");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_unclosed_bracket: return new_(Xol_msg_itm_.Id_pfunc_expr_unclosed_bracket, "pfunc_expr_unclosed_bracket", "Expression error: Unclosed bracket");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_division_by_zero: return new_(Xol_msg_itm_.Id_pfunc_expr_division_by_zero, "pfunc_expr_division_by_zero", "Division by zero");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_invalid_argument: return new_(Xol_msg_itm_.Id_pfunc_expr_invalid_argument, "pfunc_expr_invalid_argument", "Invalid argument for ~{0}: < -1 or > 1");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_invalid_argument_ln: return new_(Xol_msg_itm_.Id_pfunc_expr_invalid_argument_ln, "pfunc_expr_invalid_argument_ln", "Invalid argument for ln: <= 0");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_unknown_error: return new_(Xol_msg_itm_.Id_pfunc_expr_unknown_error, "pfunc_expr_unknown_error", "Expression error: Unknown error (~{0})");
|
||||
case Xol_msg_itm_.Id_pfunc_expr_not_a_number: return new_(Xol_msg_itm_.Id_pfunc_expr_not_a_number, "pfunc_expr_not_a_number", "In ~{0}: result is not a number");
|
||||
case Xol_msg_itm_.Id_pfunc_string_too_long: return new_(Xol_msg_itm_.Id_pfunc_string_too_long, "pfunc_string_too_long", "Error: String exceeds ~{0} character limit");
|
||||
case Xol_msg_itm_.Id_pfunc_convert_dimensionmismatch: return new_(Xol_msg_itm_.Id_pfunc_convert_dimensionmismatch, "pfunc-convert-dimensionmismatch", "Error: cannot convert between units of \"~{0}\" and \"~{1}\"");
|
||||
case Xol_msg_itm_.Id_pfunc_convert_unknownunit: return new_(Xol_msg_itm_.Id_pfunc_convert_unknownunit, "pfunc-convert-unknownunit", "Error: unknown unit \"~{0}\"");
|
||||
case Xol_msg_itm_.Id_pfunc_convert_unknowndimension: return new_(Xol_msg_itm_.Id_pfunc_convert_unknowndimension, "pfunc-convert-unknowndimension", "Error: unknown dimension \"~{0}\"");
|
||||
case Xol_msg_itm_.Id_pfunc_convert_invalidcompoundunit: return new_(Xol_msg_itm_.Id_pfunc_convert_invalidcompoundunit, "pfunc-convert-invalidcompoundunit", "Error: invalid compound unit \"~{0}\"");
|
||||
case Xol_msg_itm_.Id_pfunc_convert_nounit: return new_(Xol_msg_itm_.Id_pfunc_convert_nounit, "pfunc-convert-nounit", "Error: no source unit given");
|
||||
case Xol_msg_itm_.Id_pfunc_convert_doublecompoundunit: return new_(Xol_msg_itm_.Id_pfunc_convert_doublecompoundunit, "pfunc-convert-doublecompoundunit", "Error: cannot parse double compound units like \"~{0}\"");
|
||||
case Xol_msg_itm_.Id_toc: return new_(Xol_msg_itm_.Id_toc, "toc", "Contents");
|
||||
case Xol_msg_itm_.Id_redirectedfrom: return new_(Xol_msg_itm_.Id_redirectedfrom, "redirectedfrom", "(Redirected from ~{0})");
|
||||
case Xol_msg_itm_.Id_sp_allpages_hdr: return new_(Xol_msg_itm_.Id_sp_allpages_hdr, "allpages", "All pages");
|
||||
case Xol_msg_itm_.Id_sp_allpages_bwd: return new_(Xol_msg_itm_.Id_sp_allpages_bwd, "prevpage", "Previous page (~{0})");
|
||||
case Xol_msg_itm_.Id_sp_allpages_fwd: return new_(Xol_msg_itm_.Id_sp_allpages_fwd, "nextpage", "Next page (~{0})");
|
||||
case Xol_msg_itm_.Id_js_tables_collapsible_collapse: return new_(Xol_msg_itm_.Id_js_tables_collapsible_collapse, "collapsible-collapse", "Collapse");
|
||||
case Xol_msg_itm_.Id_js_tables_collapsible_expand: return new_(Xol_msg_itm_.Id_js_tables_collapsible_expand, "collapsible-expand", "Expand");
|
||||
case Xol_msg_itm_.Id_js_tables_sort_descending: return new_(Xol_msg_itm_.Id_js_tables_sort_descending, "sort-descending", "Sort descending");
|
||||
case Xol_msg_itm_.Id_js_tables_sort_ascending: return new_(Xol_msg_itm_.Id_js_tables_sort_ascending, "sort-ascending", "Sort ascending");
|
||||
case Xol_msg_itm_.Id_ctg_tbl_hdr: return new_(Xol_msg_itm_.Id_ctg_tbl_hdr, "categories", "Categories");
|
||||
case Xol_msg_itm_.Id_portal_lastmodified: return new_(Xol_msg_itm_.Id_portal_lastmodified, "lastmodifiedat", "This page was last modified on ~{0}, at ~{1}.");
|
||||
case Xol_msg_itm_.Id_file_enlarge: return new_(Xol_msg_itm_.Id_file_enlarge, "thumbnail-more", "Enlarge");
|
||||
case Xol_msg_itm_.Id_xowa_portal_exit_text: return new_(Xol_msg_itm_.Id_xowa_portal_exit_text, "xowa-portal-exit", "Exit");
|
||||
case Xol_msg_itm_.Id_xowa_portal_exit_tooltip: return new_(Xol_msg_itm_.Id_xowa_portal_exit_tooltip, "tooltip-xowa-portal-exit", "Exit XOWA");
|
||||
case Xol_msg_itm_.Id_xowa_portal_exit_accesskey: return new_(Xol_msg_itm_.Id_xowa_portal_exit_accesskey, "accesskey-xowa-portal-exit", "");
|
||||
case Xol_msg_itm_.Id_xowa_portal_view_html_text: return new_(Xol_msg_itm_.Id_xowa_portal_view_html_text, "xowa-portal-view_html", "View HTML");
|
||||
case Xol_msg_itm_.Id_xowa_portal_view_html_tooltip: return new_(Xol_msg_itm_.Id_xowa_portal_view_html_tooltip, "tooltip-xowa-portal-view_html", "View HTML source for this page");
|
||||
case Xol_msg_itm_.Id_xowa_portal_view_html_accesskey: return new_(Xol_msg_itm_.Id_xowa_portal_view_html_accesskey, "accesskey-xowa-portal-view_html", "h");
|
||||
case Xol_msg_itm_.Id_xowa_portal_bookmarks_text: return new_(Xol_msg_itm_.Id_xowa_portal_bookmarks_text, "xowa-portal-bookmarks", "Bookmarks");
|
||||
case Xol_msg_itm_.Id_xowa_portal_bookmarks_add_text: return new_(Xol_msg_itm_.Id_xowa_portal_bookmarks_add_text, "xowa-portal-bookmarks-add", "Bookmark this page");
|
||||
case Xol_msg_itm_.Id_xowa_portal_bookmarks_add_tooltip: return new_(Xol_msg_itm_.Id_xowa_portal_bookmarks_add_tooltip, "tooltip-xowa-portal-bookmarks-add", "Bookmark this page");
|
||||
case Xol_msg_itm_.Id_xowa_portal_bookmarks_add_accesskey: return new_(Xol_msg_itm_.Id_xowa_portal_bookmarks_add_accesskey, "accesskey-xowa-portal-bookmarks-add", "");
|
||||
case Xol_msg_itm_.Id_xowa_portal_bookmarks_show_text: return new_(Xol_msg_itm_.Id_xowa_portal_bookmarks_show_text, "xowa-portal-bookmarks-show", "Show all bookmarks");
|
||||
case Xol_msg_itm_.Id_xowa_portal_bookmarks_show_tooltip: return new_(Xol_msg_itm_.Id_xowa_portal_bookmarks_show_tooltip, "tooltip-xowa-portal-bookmarks-show", "Show all bookmarks");
|
||||
case Xol_msg_itm_.Id_xowa_portal_bookmarks_show_accesskey: return new_(Xol_msg_itm_.Id_xowa_portal_bookmarks_show_accesskey, "accesskey-xowa-portal-bookmarks-show", "");
|
||||
case Xol_msg_itm_.Id_xowa_portal_page_history_text: return new_(Xol_msg_itm_.Id_xowa_portal_page_history_text, "xowa-portal-page_history", "Page history");
|
||||
case Xol_msg_itm_.Id_xowa_portal_page_history_tooltip: return new_(Xol_msg_itm_.Id_xowa_portal_page_history_tooltip, "tooltip-xowa-portal-page_history", "View history of opened pages");
|
||||
case Xol_msg_itm_.Id_xowa_portal_page_history_accesskey: return new_(Xol_msg_itm_.Id_xowa_portal_page_history_accesskey, "accesskey-xowa-portal-page_history", "");
|
||||
case Xol_msg_itm_.Id_xowa_portal_options_text: return new_(Xol_msg_itm_.Id_xowa_portal_options_text, "xowa-portal-options", "Options");
|
||||
case Xol_msg_itm_.Id_xowa_portal_options_tooltip: return new_(Xol_msg_itm_.Id_xowa_portal_options_tooltip, "tooltip-xowa-portal-options", "Change XOWA options");
|
||||
case Xol_msg_itm_.Id_xowa_portal_options_accesskey: return new_(Xol_msg_itm_.Id_xowa_portal_options_accesskey, "accesskey-xowa-portal-options", "");
|
||||
case Xol_msg_itm_.Id_xowa_portal_version_text: return new_(Xol_msg_itm_.Id_xowa_portal_version_text, "xowa-portal-version", "version");
|
||||
case Xol_msg_itm_.Id_xowa_portal_build_time_text: return new_(Xol_msg_itm_.Id_xowa_portal_build_time_text, "xowa-portal-build_time", "build time");
|
||||
case Xol_msg_itm_.Id_page_lang_header: return new_(Xol_msg_itm_.Id_page_lang_header, "otherlanguages", "In other languages");
|
||||
case Xol_msg_itm_.Id_xowa_window_go_bwd_btn_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_go_bwd_btn_tooltip, "xowa-window-go_bwd_btn-tooltip", "Go back one page");
|
||||
case Xol_msg_itm_.Id_xowa_window_go_fwd_btn_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_go_fwd_btn_tooltip, "xowa-window-go_fwd_btn-tooltip", "Go forward one page");
|
||||
case Xol_msg_itm_.Id_xowa_window_url_box_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_url_box_tooltip, "xowa-window-url_box-tooltip", "Enter address");
|
||||
case Xol_msg_itm_.Id_xowa_window_url_btn_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_url_btn_tooltip, "xowa-window-url_btn-tooltip", "Go to the address in the Location Bar");
|
||||
case Xol_msg_itm_.Id_xowa_window_search_box_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_search_box_tooltip, "xowa-window-search_box-tooltip", "Search using {{ns:Special}}:AllPages");
|
||||
case Xol_msg_itm_.Id_xowa_window_search_btn_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_search_btn_tooltip, "xowa-window-search_btn-tooltip", "Search");
|
||||
case Xol_msg_itm_.Id_xowa_window_find_close_btn_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_find_close_btn_tooltip, "xowa-window-find_close_btn-tooltip", "Close Find bar");
|
||||
case Xol_msg_itm_.Id_xowa_window_find_box_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_find_box_tooltip, "xowa-window-find_box-tooltip", "Enter phrase to find on this page");
|
||||
case Xol_msg_itm_.Id_xowa_window_find_fwd_btn_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_find_fwd_btn_tooltip, "xowa-window-find_fwd_btn-tooltip", "Find the next occurrence of the phrase");
|
||||
case Xol_msg_itm_.Id_xowa_window_find_bwd_btn_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_find_bwd_btn_tooltip, "xowa-window-find_bwd_btn-tooltip", "Find the previous occurrence of the phrase");
|
||||
case Xol_msg_itm_.Id_xowa_window_prog_box_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_prog_box_tooltip, "xowa-window-prog_box-tooltip", "Displays progress messages");
|
||||
case Xol_msg_itm_.Id_xowa_window_info_box_tooltip: return new_(Xol_msg_itm_.Id_xowa_window_info_box_tooltip, "xowa-window-info_box-tooltip", "Displays system messages");
|
||||
case Xol_msg_itm_.Id_scribunto_parser_error: return new_(Xol_msg_itm_.Id_scribunto_parser_error, "scribunto-parser-error", "Script error");
|
||||
case Xol_msg_itm_.Id_ns_blankns: return new_(Xol_msg_itm_.Id_ns_blankns, "blanknamespace", "(Main)");
|
||||
case Xol_msg_itm_.Id_ctg_page_label: return new_(Xol_msg_itm_.Id_ctg_page_label, "pagecategories", "{{PLURAL:~{0}|Category|Categories}}");
|
||||
case Xol_msg_itm_.Id_ctg_page_header: return new_(Xol_msg_itm_.Id_ctg_page_header, "category_header", "Pages in category \"~{0}\"");
|
||||
case Xol_msg_itm_.Id_ctg_subc_label: return new_(Xol_msg_itm_.Id_ctg_subc_label, "subcategories", "Subcategories");
|
||||
case Xol_msg_itm_.Id_ctg_file_header: return new_(Xol_msg_itm_.Id_ctg_file_header, "category-media-header", "Media in category \"~{0}\"");
|
||||
case Xol_msg_itm_.Id_ctg_empty: return new_(Xol_msg_itm_.Id_ctg_empty, "category-empty", "''This category currently contains no pages or media.''");
|
||||
case Xol_msg_itm_.Id_ctg_subc_count: return new_(Xol_msg_itm_.Id_ctg_subc_count, "category-subcat-count", "{{PLURAL:~{1}|This category has only the following subcategory.|This category has the following {{PLURAL:~{0}|subcategory|~{0} subcategories}}, out of ~{1} total.}}");
|
||||
case Xol_msg_itm_.Id_ctg_subc_count_limit: return new_(Xol_msg_itm_.Id_ctg_subc_count_limit, "category-subcat-count-limited", "This category has the following {{PLURAL:~{0}|subcategory|~{0} subcategories}}.");
|
||||
case Xol_msg_itm_.Id_ctg_page_count: return new_(Xol_msg_itm_.Id_ctg_page_count, "category-article-count", "{{PLURAL:~{1}|This category contains only the following page.|The following {{PLURAL:~{0}|page is|~{0} pages are}} in this category, out of ~{1} total.}}");
|
||||
case Xol_msg_itm_.Id_ctg_page_count_limit: return new_(Xol_msg_itm_.Id_ctg_page_count_limit, "category-article-count-limited", "The following {{PLURAL:~{0}|page is|~{0} pages are}} in the current category.");
|
||||
case Xol_msg_itm_.Id_ctg_file_count: return new_(Xol_msg_itm_.Id_ctg_file_count, "category-file-count", "{{PLURAL:~{1}|This category contains only the following file.|The following {{PLURAL:~{0}|file is|~{0} files are}} in this category, out of ~{1} total.}}");
|
||||
case Xol_msg_itm_.Id_ctg_file_count_limit: return new_(Xol_msg_itm_.Id_ctg_file_count_limit, "category-file-count-limited", "The following {{PLURAL:~{0}|file is|~{0} files are}} in the current category.");
|
||||
case Xol_msg_itm_.Id_ctgtree_subc_counts: return new_(Xol_msg_itm_.Id_ctgtree_subc_counts, "categorytree-member-counts", "contains {{PLURAL:~{0}|1 subcategory|~{0} subcategories}}, {{PLURAL:~{1}|1 page|~{1} pages}}, and {{PLURAL:~{2}|1 file|~{2} files}}");
|
||||
case Xol_msg_itm_.Id_ctgtree_subc_counts_ctg: return new_(Xol_msg_itm_.Id_ctgtree_subc_counts_ctg, "categorytree-num-categories", "~{0} C");
|
||||
case Xol_msg_itm_.Id_ctgtree_subc_counts_page: return new_(Xol_msg_itm_.Id_ctgtree_subc_counts_page, "categorytree-num-pages", "~{0} P");
|
||||
case Xol_msg_itm_.Id_ctgtree_subc_counts_file: return new_(Xol_msg_itm_.Id_ctgtree_subc_counts_file, "categorytree-num-files", "~{0} F");
|
||||
case Xol_msg_itm_.Id_prev_results: return new_(Xol_msg_itm_.Id_next_results, "prevn", "previous {{PLURAL:~{0}|~{0}}}");
|
||||
case Xol_msg_itm_.Id_next_results: return new_(Xol_msg_itm_.Id_prev_results, "nextn", "next {{PLURAL:~{0}|~{0}}}");
|
||||
case Xol_msg_itm_.Id_list_continues: return new_(Xol_msg_itm_.Id_list_continues, "listingcontinuesabbrev", "cont.");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_languages: return new_(Xol_msg_itm_.Id_xowa_wikidata_languages, "xowa-wikidata-languages", "en");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_labels: return new_(Xol_msg_itm_.Id_xowa_wikidata_labels, "xowa-wikidata-labels", "Labels");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_aliasesHead: return new_(Xol_msg_itm_.Id_xowa_wikidata_aliasesHead, "xowa-wikidata-aliasesHead", "Aliases");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_descriptions: return new_(Xol_msg_itm_.Id_xowa_wikidata_descriptions, "xowa-wikidata-descriptions", "Descriptions");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links: return new_(Xol_msg_itm_.Id_xowa_wikidata_links, "xowa-wikidata-links", "Links");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_claims: return new_(Xol_msg_itm_.Id_xowa_wikidata_claims, "xowa-wikidata-claims", "Claims");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_json: return new_(Xol_msg_itm_.Id_xowa_wikidata_json, "xowa-wikidata-json", "JSON");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_language: return new_(Xol_msg_itm_.Id_xowa_wikidata_language, "xowa-wikidata-language", "language");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_wiki: return new_(Xol_msg_itm_.Id_xowa_wikidata_wiki, "xowa-wikidata-wiki", "wiki");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_label: return new_(Xol_msg_itm_.Id_xowa_wikidata_label, "xowa-wikidata-label", "label");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_aliases: return new_(Xol_msg_itm_.Id_xowa_wikidata_aliases, "xowa-wikidata-aliases", "aliases");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_description: return new_(Xol_msg_itm_.Id_xowa_wikidata_description, "xowa-wikidata-description", "description");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_link: return new_(Xol_msg_itm_.Id_xowa_wikidata_link, "xowa-wikidata-link", "link");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_property: return new_(Xol_msg_itm_.Id_xowa_wikidata_property, "xowa-wikidata-property", "property");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_value: return new_(Xol_msg_itm_.Id_xowa_wikidata_value, "xowa-wikidata-value", "value");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_references: return new_(Xol_msg_itm_.Id_xowa_wikidata_references, "xowa-wikidata-references", "references");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_qualifiers: return new_(Xol_msg_itm_.Id_xowa_wikidata_qualifiers, "xowa-wikidata-qualifiers", "qualifiers");
|
||||
case Xol_msg_itm_.Id_search_results_header: return new_(Xol_msg_itm_.Id_search_results_header, "showingresultsheader", "{{PLURAL:~{4}\u007CResult '''~{0}''' of '''~{2}'''\u007CResults '''~{0} - ~{1}''' of '''~{2}'''}} for '''~{3}'''");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_bold_sample: return new_(Xol_msg_itm_.Id_edit_toolbar_bold_sample, "bold_sample", "Bold text");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_bold_tip: return new_(Xol_msg_itm_.Id_edit_toolbar_bold_tip, "bold_tip", "Bold text");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_italic_sample: return new_(Xol_msg_itm_.Id_edit_toolbar_italic_sample, "italic_sample", "Italic text");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_italic_tip: return new_(Xol_msg_itm_.Id_edit_toolbar_italic_tip, "italic_tip", "Italic text");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_link_sample: return new_(Xol_msg_itm_.Id_edit_toolbar_link_sample, "link_sample", "Link title");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_link_tip: return new_(Xol_msg_itm_.Id_edit_toolbar_link_tip, "link_tip", "Internal link");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_headline_sample: return new_(Xol_msg_itm_.Id_edit_toolbar_headline_sample, "headline_sample", "Headline text");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_headline_tip: return new_(Xol_msg_itm_.Id_edit_toolbar_headline_tip, "headline_tip", "Level 2 headline");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_ulist_tip: return new_(Xol_msg_itm_.Id_edit_toolbar_ulist_tip, "wikieditor-toolbar-tool-ulist", "Bulleted list");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_ulist_sample: return new_(Xol_msg_itm_.Id_edit_toolbar_ulist_sample, "wikieditor-toolbar-tool-ulist-example", "Bulleted list item");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_olist_tip: return new_(Xol_msg_itm_.Id_edit_toolbar_olist_tip, "wikieditor-toolbar-tool-olist", "Numbered list");
|
||||
case Xol_msg_itm_.Id_edit_toolbar_olist_sample: return new_(Xol_msg_itm_.Id_edit_toolbar_olist_sample, "wikieditor-toolbar-tool-olist-example", "Numbered list item");
|
||||
case Xol_msg_itm_.Id_xowa_portal_about_text: return new_(Xol_msg_itm_.Id_xowa_portal_about_text, "xowa-portal-about", "About");
|
||||
case Xol_msg_itm_.Id_xowa_portal_about_tooltip: return new_(Xol_msg_itm_.Id_xowa_portal_about_tooltip, "tooltip-xowa-portal-about", "About XOWA");
|
||||
case Xol_msg_itm_.Id_xowa_portal_about_accesskey: return new_(Xol_msg_itm_.Id_xowa_portal_about_accesskey, "accesskey-xowa-portal-about", "");
|
||||
case Xol_msg_itm_.Id_symbol_catseparator: return new_(Xol_msg_itm_.Id_symbol_catseparator, "catseparator", "\u007C");
|
||||
case Xol_msg_itm_.Id_symbol_semicolon_separator: return new_(Xol_msg_itm_.Id_symbol_semicolon_separator, "semicolon-separator", "; ");
|
||||
case Xol_msg_itm_.Id_symbol_comma_separator: return new_(Xol_msg_itm_.Id_symbol_comma_separator, "comma-separator", ", ");
|
||||
case Xol_msg_itm_.Id_symbol_colon_separator: return new_(Xol_msg_itm_.Id_symbol_colon_separator, "colon-separator", ": ");
|
||||
case Xol_msg_itm_.Id_symbol_autocomment_prefix: return new_(Xol_msg_itm_.Id_symbol_autocomment_prefix, "autocomment-prefix", "- ");
|
||||
case Xol_msg_itm_.Id_symbol_pipe_separator: return new_(Xol_msg_itm_.Id_symbol_pipe_separator, "pipe-separator", " \u007C ");
|
||||
case Xol_msg_itm_.Id_symbol_word_separator: return new_(Xol_msg_itm_.Id_symbol_word_separator, "word-separator", " ");
|
||||
case Xol_msg_itm_.Id_symbol_ellipsis: return new_(Xol_msg_itm_.Id_symbol_ellipsis, "ellipsis", "...");
|
||||
case Xol_msg_itm_.Id_symbol_percent: return new_(Xol_msg_itm_.Id_symbol_percent, "percent", "~{0}%");
|
||||
case Xol_msg_itm_.Id_symbol_parentheses: return new_(Xol_msg_itm_.Id_symbol_parentheses, "parentheses", "(~{0})");
|
||||
case Xol_msg_itm_.Id_duration_ago: return new_(Xol_msg_itm_.Id_duration_ago, "ago", "~{0} ago");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_novalue: return new_(Xol_msg_itm_.Id_xowa_wikidata_novalue, "xowa-wikidata-novalue", "—");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_somevalue: return new_(Xol_msg_itm_.Id_xowa_wikidata_somevalue, "xowa-wikidata-somevalue", "?");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links_wiki: return new_(Xol_msg_itm_.Id_xowa_wikidata_links_wiki, "xowa-wikidata-links-wiki", "Links (Wikipedia)");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links_wiktionary: return new_(Xol_msg_itm_.Id_xowa_wikidata_links_wiktionary, "xowa-wikidata-links-wiktionary", "Links (Wiktionary)");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links_wikisource: return new_(Xol_msg_itm_.Id_xowa_wikidata_links_wikisource, "xowa-wikidata-links-wikisource", "Links (Wikisource)");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links_wikivoyage: return new_(Xol_msg_itm_.Id_xowa_wikidata_links_wikivoyage, "xowa-wikidata-links-wikivoyage", "Links (Wikivoyage)");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links_wikiquote: return new_(Xol_msg_itm_.Id_xowa_wikidata_links_wikiquote, "xowa-wikidata-links-wikiquote", "Links (Wikiquote)");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links_wikibooks: return new_(Xol_msg_itm_.Id_xowa_wikidata_links_wikibooks, "xowa-wikidata-links-wikibooks", "Links (Wikibooks)");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links_wikiversity: return new_(Xol_msg_itm_.Id_xowa_wikidata_links_wikiversity, "xowa-wikidata-links-wikiversity", "Links (Wikiversity)");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links_wikinews: return new_(Xol_msg_itm_.Id_xowa_wikidata_links_wikinews, "xowa-wikidata-links-wikinews", "Links (Wikinews)");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_plus: return new_(Xol_msg_itm_.Id_xowa_wikidata_plus, "xowa-wikidata-plus", "+");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_minus: return new_(Xol_msg_itm_.Id_xowa_wikidata_minus, "xowa-wikidata-minus", "−");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_plusminus: return new_(Xol_msg_itm_.Id_xowa_wikidata_plusminus, "xowa-wikidata-plusminus", "±");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_degree: return new_(Xol_msg_itm_.Id_xowa_wikidata_degree, "xowa-wikidata-degree", "°");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_minute: return new_(Xol_msg_itm_.Id_xowa_wikidata_minute, "xowa-wikidata-minute", "′");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_second: return new_(Xol_msg_itm_.Id_xowa_wikidata_second, "xowa-wikidata-second", "″");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_north: return new_(Xol_msg_itm_.Id_xowa_wikidata_north, "xowa-wikidata-north", "N");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_south: return new_(Xol_msg_itm_.Id_xowa_wikidata_south, "xowa-wikidata-south", "S");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_west: return new_(Xol_msg_itm_.Id_xowa_wikidata_west, "xowa-wikidata-west", "W");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_east: return new_(Xol_msg_itm_.Id_xowa_wikidata_east, "xowa-wikidata-east", "E");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_meters: return new_(Xol_msg_itm_.Id_xowa_wikidata_meters, "xowa-wikidata-meters", " m");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_julian: return new_(Xol_msg_itm_.Id_xowa_wikidata_julian, "xowa-wikidata-julian", "<sup>jul</sup>");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_decade: return new_(Xol_msg_itm_.Id_xowa_wikidata_decade, "xowa-wikidata-decade", "~{0}0s");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_century: return new_(Xol_msg_itm_.Id_xowa_wikidata_century, "xowa-wikidata-century", "~{0}. century");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_millenium: return new_(Xol_msg_itm_.Id_xowa_wikidata_millenium, "xowa-wikidata-millenium", "~{0}. millenium");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_years1e4: return new_(Xol_msg_itm_.Id_xowa_wikidata_years1e4, "xowa-wikidata-years1e4", "~{0}0,000 years");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_years1e5: return new_(Xol_msg_itm_.Id_xowa_wikidata_years1e5, "xowa-wikidata-years1e5", "~{0}00,000 years");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_years1e6: return new_(Xol_msg_itm_.Id_xowa_wikidata_years1e6, "xowa-wikidata-years1e6", "~{0} million years");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_years1e7: return new_(Xol_msg_itm_.Id_xowa_wikidata_years1e7, "xowa-wikidata-years1e7", "~{0}0 million years");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_years1e8: return new_(Xol_msg_itm_.Id_xowa_wikidata_years1e8, "xowa-wikidata-years1e8", "~{0}00 million years");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_years1e9: return new_(Xol_msg_itm_.Id_xowa_wikidata_years1e9, "xowa-wikidata-years1e9", "~{0} billion years");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_bc: return new_(Xol_msg_itm_.Id_xowa_wikidata_bc, "xowa-wikidata-bc", "~{0} BC");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_inTime: return new_(Xol_msg_itm_.Id_xowa_wikidata_inTime, "xowa-wikidata-inTime", "in ~{0}");
|
||||
case Xol_msg_itm_.Id_ctg_tbl_hidden: return new_(Xol_msg_itm_.Id_ctg_tbl_hidden, "hidden-category-category", "Hidden categories");
|
||||
case Xol_msg_itm_.Id_ctg_help_page: return new_(Xol_msg_itm_.Id_ctg_help_page, "pagecategorieslink", "Special:Categories");
|
||||
case Xol_msg_itm_.Id_statistics_title: return new_(Xol_msg_itm_.Id_statistics_title, "statistics", "Statistics");
|
||||
case Xol_msg_itm_.Id_statistics_header_pages: return new_(Xol_msg_itm_.Id_statistics_header_pages, "statistics-header-pages", "Page statistics");
|
||||
case Xol_msg_itm_.Id_statistics_articles: return new_(Xol_msg_itm_.Id_statistics_articles, "statistics-articles", "Content pages");
|
||||
case Xol_msg_itm_.Id_statistics_pages: return new_(Xol_msg_itm_.Id_statistics_pages, "statistics-pages", "Pages");
|
||||
case Xol_msg_itm_.Id_statistics_pages_desc: return new_(Xol_msg_itm_.Id_statistics_pages_desc, "statistics-pages-desc", "All pages in the wiki, including talk pages, redirects, etc.");
|
||||
case Xol_msg_itm_.Id_statistics_header_ns: return new_(Xol_msg_itm_.Id_statistics_header_ns, "statistics-header-ns", "Namespace statistics");
|
||||
case Xol_msg_itm_.Id_wikibase_diffview_rank: return new_(Xol_msg_itm_.Id_wikibase_diffview_rank, "Wikibase-diffview-rank", "rank");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_deprecated: return new_(Xol_msg_itm_.Id_xowa_wikidata_deprecated, "xowa-wikidata-deprecated", "deprecated");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_normal: return new_(Xol_msg_itm_.Id_xowa_wikidata_normal, "xowa-wikidata-normal", "normal");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_preferred: return new_(Xol_msg_itm_.Id_xowa_wikidata_preferred, "xowa-wikidata-preferred", "preferred");
|
||||
case Xol_msg_itm_.Id_xowa_wikidata_links_special: return new_(Xol_msg_itm_.Id_xowa_wikidata_links_special, "xowa-wikidata-links-special", "Links (special wikis)");
|
||||
default: throw Exc_.new_unhandled(id);
|
||||
}
|
||||
}
|
||||
public static byte[] eval_(Bry_bfr bfr, Xol_msg_itm tmp_msg_itm, byte[] val, Object... args) {
|
||||
val = gplx.xowa.apps.Xoa_gfs_php_mgr.Xto_gfs(bfr, val);
|
||||
update_val_(tmp_msg_itm, val);
|
||||
return tmp_fmtr.Bld_bry_many(bfr, args);
|
||||
}
|
||||
}
|
||||
39
400_xowa/src_140_lang/gplx/xowa/Xol_msg_itm_tst.java
Normal file
39
400_xowa/src_140_lang/gplx/xowa/Xol_msg_itm_tst.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class Xol_msg_itm_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xol_msg_itm_fxt fxt = new Xol_msg_itm_fxt();
|
||||
@Test public void New_plain() {fxt.Test_new("a" , Bool_.N, Bool_.N);}
|
||||
@Test public void New_fmt() {fxt.Test_new("a~{0}b" , Bool_.Y, Bool_.N);}
|
||||
@Test public void New_tmpl() {fxt.Test_new("a{{b}}c" , Bool_.N, Bool_.Y);}
|
||||
@Test public void New_fmt_tmpl() {fxt.Test_new("a{{b}}c~{0}d" , Bool_.Y, Bool_.Y);}
|
||||
@Test public void New_space() {fxt.Test_val("a b" , "a b");}
|
||||
}
|
||||
class Xol_msg_itm_fxt {
|
||||
public void Clear() {}
|
||||
public void Test_new(String val, boolean has_fmt_arg, boolean has_tmpl_txt) {
|
||||
Xol_msg_itm itm = Xol_msg_itm_.new_(0, "test", val);
|
||||
Tfds.Eq(has_fmt_arg, itm.Has_fmt_arg(), "has_fmt_arg");
|
||||
Tfds.Eq(has_tmpl_txt, itm.Has_tmpl_txt(), "has_tmpl_txt");
|
||||
}
|
||||
public void Test_val(String val, String expd) {
|
||||
Xol_msg_itm itm = Xol_msg_itm_.new_(0, "test", val);
|
||||
Tfds.Eq(expd, String_.new_u8(itm.Val()), "has_fmt_arg");
|
||||
}
|
||||
}
|
||||
106
400_xowa/src_140_lang/gplx/xowa/Xol_msg_mgr.java
Normal file
106
400_xowa/src_140_lang/gplx/xowa/Xol_msg_mgr.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
public class Xol_msg_mgr implements GfoInvkAble {
|
||||
private final GfoInvkAble owner; private final boolean owner_is_lang;
|
||||
public Xol_msg_mgr(GfoInvkAble owner, boolean owner_is_lang) {
|
||||
this.owner = owner; this.owner_is_lang = owner_is_lang;
|
||||
this.Clear();
|
||||
}
|
||||
public void Clear() {
|
||||
if (owner_is_lang)
|
||||
itms = Ary_new();
|
||||
else
|
||||
itms = new Xol_msg_itm[Xol_msg_itm_.Id__max];
|
||||
hash = Hash_new(itms);
|
||||
itms_max = itms_id_next = Xol_msg_itm_.Id__max;
|
||||
}
|
||||
public int Itms_max() {return itms_max;} private Xol_msg_itm[] itms; int itms_max = Xol_msg_itm_.Id__max; int itms_id_next = Xol_msg_itm_.Id__max;
|
||||
public Xol_msg_itm Itm_by_id_or_null(int id) {return id < itms_max ? itms[id] : null;}
|
||||
public Xol_msg_itm Itm_by_key_or_null(byte[] key) {return (Xol_msg_itm)hash.Get_by(key);}
|
||||
public Xol_msg_itm Itms_new(byte[] msg_key) {
|
||||
Xol_msg_itm rv = new Xol_msg_itm(itms_id_next++, msg_key);
|
||||
Itms_reg(rv);
|
||||
return rv;
|
||||
}
|
||||
public Xol_msg_itm Itm_by_key_or_new(String key, String val) {return Itm_by_key_or_new(key, val, false);} // TEST:
|
||||
public Xol_msg_itm Itm_by_key_or_new(String key, String val, boolean has_fmt_arg) { // TEST:
|
||||
Xol_msg_itm rv = Itm_by_key_or_new(Bry_.new_u8(key));
|
||||
Xol_msg_itm_.update_val_(rv, Bry_.new_u8(val));
|
||||
return rv;
|
||||
}
|
||||
public Xol_msg_itm Itm_by_key_or_new(byte[] key) {
|
||||
Object o = hash.Get_by(key);
|
||||
Xol_msg_itm rv = null;
|
||||
if (o == null) { // key not found; likely not a system_id; generate a custom one
|
||||
rv = new Xol_msg_itm(itms_id_next++, key);
|
||||
Itms_reg(rv);
|
||||
}
|
||||
else {
|
||||
rv = (Xol_msg_itm)o;
|
||||
}
|
||||
return rv;
|
||||
} Hash_adp hash;
|
||||
public byte[] Val_by_id(int id) { // NOTE: Val_by_id needs to exist on lang (not wiki_msg_mgr); {{#time}} can pass in lang, and will need to call lang's msg_mgr directly
|
||||
Xol_msg_itm itm = Itm_by_id_or_null(id);
|
||||
return itm == null ? null : itm.Val();
|
||||
}
|
||||
public byte[] Val_by_id(Xowe_wiki wiki, int id) { // NOTE: Val_by_id needs to exist on lang (not wiki_msg_mgr); {{#time}} can pass in lang, and will need to call lang's msg_mgr directly
|
||||
Xol_msg_itm itm = Itm_by_id_or_null(id);
|
||||
if (itm == null) return null;
|
||||
byte[] rv = itm.Val();
|
||||
if (itm.Has_tmpl_txt()) rv = wiki.Parser().Parse_text_to_wtxt(rv);
|
||||
return rv;
|
||||
}
|
||||
public byte[] Val_by_str_or_empty(String str) {return Val_by_bry_or(Bry_.new_u8(str), Bry_.Empty);}
|
||||
public byte[] Val_by_bry_or(byte[] bry, byte[] or) {
|
||||
Xol_msg_itm itm = Itm_by_key_or_null(bry);
|
||||
return itm == null ? or : itm.Val();
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_lang)) return owner;
|
||||
else if (ctx.Match(k, Invk_load_text)) Xol_lang_srl.Load_messages(this, m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_lang = Xol_lang_srl.Invk_lang, Invk_load_text = Xol_lang_srl.Invk_load_text;
|
||||
private void Itms_reg(Xol_msg_itm itm) {
|
||||
int id = itm.Id();
|
||||
if (id >= itms_max) {
|
||||
int new_max = (id + 1) * 2;
|
||||
itms = (Xol_msg_itm[])Array_.Expand(itms, new Xol_msg_itm[new_max], itms_max);
|
||||
itms_max = new_max;
|
||||
}
|
||||
itms[id] = itm;
|
||||
hash.Add(itm.Key(), itm);
|
||||
}
|
||||
private static Xol_msg_itm[] Ary_new() {
|
||||
Xol_msg_itm[] rv = new Xol_msg_itm[Xol_msg_itm_.Id__max];
|
||||
for (int i = 0; i < Xol_msg_itm_.Id__max; i++)
|
||||
rv[i] = Xol_msg_itm_.new_(i);
|
||||
return rv;
|
||||
}
|
||||
private static Hash_adp Hash_new(Xol_msg_itm[] ary) {
|
||||
Hash_adp rv = Hash_adp_bry.ci_ascii_(); // ASCII:MW messages are currently all ASCII
|
||||
for (int i = 0; i < Xol_msg_itm_.Id__max; i++) {
|
||||
Xol_msg_itm itm = ary[i]; if (itm == null) continue; // NOTE: can be null when msg_mgr is owned by wiki
|
||||
rv.Add(itm.Key(), itm);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
static final String GRP_KEY = "xowa.lang.msg_mgr";
|
||||
}
|
||||
64
400_xowa/src_140_lang/gplx/xowa/Xol_msg_mgr_tst.java
Normal file
64
400_xowa/src_140_lang/gplx/xowa/Xol_msg_mgr_tst.java
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class Xol_msg_mgr_tst {
|
||||
Xol_msg_mgr_fxt fxt = new Xol_msg_mgr_fxt();
|
||||
@Before public void init() {fxt.Clear();}
|
||||
@Test public void Template_msg() {fxt.Test_val_by_key("About {{SITENAME}}", "About Wikipedia");} // PURPOSE.fix: {{Template}} not working inside label tags; EX:de.wikisource.org; DATE:2013-02-10
|
||||
@Test public void Template_mediawiki() { // PURPOSE.fix: {{Template}} not working inside MediaWiki template
|
||||
fxt.Test_mediaWiki_msg("About {{SITENAME}}", "About Wikipedia");
|
||||
}
|
||||
@Test public void Val_html_accesskey_and_title() {
|
||||
fxt.Clear().Test_val_html_accesskey_and_title("test_title" , "a" , " accesskey=\"a\" title=\"test_title [a]\"");
|
||||
fxt.Clear().Test_val_html_accesskey_and_title("test_title" , null , " title=\"test_title\""); // accesskey is missing
|
||||
fxt.Clear().Test_val_html_accesskey_and_title("test_title" , "" , " title=\"test_title\""); // accesskey is ""
|
||||
fxt.Clear().Test_val_html_accesskey_and_title(null , "a" , " title=\"\""); // no title; leave blank
|
||||
}
|
||||
}
|
||||
class Xol_msg_mgr_fxt {
|
||||
public Xol_msg_mgr_fxt Clear() {
|
||||
if (app == null) {
|
||||
app = Xoa_app_fxt.app_();
|
||||
wiki = Xoa_app_fxt.wiki_tst_(app);
|
||||
mgr = wiki.Msg_mgr();
|
||||
}
|
||||
mgr.Clear();
|
||||
wiki.Lang().Msg_mgr().Clear();
|
||||
return this;
|
||||
} private Xoae_app app; Xowe_wiki wiki; Xow_msg_mgr mgr;
|
||||
public void Test_val_by_key(String val, String expd) {
|
||||
Xol_msg_itm itm = wiki.Lang().Msg_mgr().Itm_by_key_or_new(Bry_.new_a7("test"));
|
||||
itm.Atrs_set(Bry_.new_a7(val), false, true);
|
||||
Tfds.Eq(expd, String_.new_u8(wiki.Msg_mgr().Val_by_key_obj(Bry_.new_a7("test"))), "has_tmpl_txt");
|
||||
}
|
||||
public void Test_mediaWiki_msg(String raw, String expd) {
|
||||
byte[] msg_ttl = Bry_.new_a7("MediaWiki:msg_ttl");
|
||||
wiki.Db_mgr().Save_mgr().Data_create(Xoa_ttl.parse_(wiki, msg_ttl), Bry_.new_a7(raw));
|
||||
Tfds.Eq(expd, String_.new_u8(wiki.Msg_mgr().Val_by_key_obj(Bry_.new_a7("msg_ttl"))));
|
||||
}
|
||||
public void Test_val_html_accesskey_and_title(String init_title, String init_accesskey, String expd) {
|
||||
if (init_title != null) new_msg_itm_("tooltip-test" , init_title);
|
||||
if (init_accesskey != null) new_msg_itm_("accesskey-test" , init_accesskey);
|
||||
Tfds.Eq(expd, String_.new_a7(wiki.Msg_mgr().Val_html_accesskey_and_title(Bry_.new_a7("test"))));
|
||||
}
|
||||
private void new_msg_itm_(String key, String val) {
|
||||
Xol_msg_itm itm = wiki.Lang().Msg_mgr().Itm_by_key_or_new(Bry_.new_a7(key));
|
||||
itm.Atrs_set(Bry_.new_a7(val), false, true);
|
||||
}
|
||||
}
|
||||
44
400_xowa/src_140_lang/gplx/xowa/Xol_ns_grp.java
Normal file
44
400_xowa/src_140_lang/gplx/xowa/Xol_ns_grp.java
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
public class Xol_ns_grp implements GfoInvkAble {
|
||||
public Xol_ns_grp(Xol_lang lang) {this.lang = lang;} private Xol_lang lang;
|
||||
public int Len() {return ary.length;}
|
||||
public Xow_ns Get_at(int i) {return ary[i];} private Xow_ns[] ary = Ary_empty;
|
||||
public void Ary_set_(Xow_ns[] v) {this.ary = v;}
|
||||
public void Ary_add_(Xow_ns[] add_ary) {
|
||||
int old_ary_len = ary.length;
|
||||
int add_ary_len = add_ary.length;
|
||||
Xow_ns[] new_ary = new Xow_ns[old_ary_len + add_ary_len];
|
||||
for (int i = 0; i < old_ary_len; i++)
|
||||
new_ary[i] = ary[i];
|
||||
for (int i = 0; i < add_ary_len; i++)
|
||||
new_ary[i + old_ary_len] = add_ary[i];
|
||||
this.ary = new_ary;
|
||||
}
|
||||
private static final Xow_ns[] Ary_empty = new Xow_ns[0];
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_lang)) return lang;
|
||||
else if (ctx.Match(k, Invk_load_text)) Exec_load_text(m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
} private static final String Invk_lang = Xol_lang_srl.Invk_lang, Invk_load_text = Xol_lang_srl.Invk_load_text;
|
||||
private void Exec_load_text(byte[] bry) {
|
||||
ary = (Xow_ns[])Array_.Resize_add(ary, Xol_lang_srl.Load_ns_grps(bry));
|
||||
}
|
||||
}
|
||||
23
400_xowa/src_140_lang/gplx/xowa/Xol_specials_itm.java
Normal file
23
400_xowa/src_140_lang/gplx/xowa/Xol_specials_itm.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; import gplx.*;
|
||||
public class Xol_specials_itm {
|
||||
public Xol_specials_itm(byte[] special, byte[][] aliases) {this.special = special; this.aliases = aliases;}
|
||||
public byte[] Special() {return special;} private byte[] special;
|
||||
public byte[][] Aliases() {return aliases;} private byte[][] aliases;
|
||||
}
|
||||
45
400_xowa/src_140_lang/gplx/xowa/Xol_specials_mgr.java
Normal file
45
400_xowa/src_140_lang/gplx/xowa/Xol_specials_mgr.java
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
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; import gplx.*;
|
||||
public class Xol_specials_mgr implements GfoInvkAble {
|
||||
private Ordered_hash hash_by_special = Ordered_hash_.new_bry_(), hash_by_aliases = Ordered_hash_.new_bry_();
|
||||
public Xol_specials_mgr(Xol_lang lang) {this.lang = lang;} private Xol_lang lang;
|
||||
public void Clear() {hash_by_special.Clear();}
|
||||
public int Count() {return hash_by_special.Count();}
|
||||
public Xol_specials_itm Get_at(int i) {return (Xol_specials_itm)hash_by_special.Get_at(i);}
|
||||
public Xol_specials_itm Get_by_alias(byte[] alias) {return (Xol_specials_itm)hash_by_aliases.Get_by(alias);}
|
||||
public Xol_specials_itm Get_by_key(byte[] special) {return (Xol_specials_itm)hash_by_special.Get_by(special);}
|
||||
public void Add(byte[] special, byte[][] alias_ary) {
|
||||
Xol_specials_itm itm = new Xol_specials_itm(special, alias_ary);
|
||||
hash_by_special.Add(special, itm);
|
||||
int len = alias_ary.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
byte[] alias = alias_ary[i];
|
||||
if (!hash_by_aliases.Has(alias))
|
||||
hash_by_aliases.Add(alias, itm);
|
||||
}
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_lang)) return lang;
|
||||
else if (ctx.Match(k, Invk_clear)) this.Clear();
|
||||
else if (ctx.Match(k, Invk_load_text)) Xol_lang_srl.Load_specials(this, m.ReadBry("v"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
public static final String Invk_lang = "lang", Invk_clear = "clear", Invk_load_text = "load_text";
|
||||
}
|
||||
Reference in New Issue
Block a user