1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

v2.11.1.1

This commit is contained in:
gnosygnu
2015-11-01 20:50:05 -05:00
parent 4f43f51b18
commit b990ec409f
858 changed files with 6758 additions and 4187 deletions

View File

@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.core.log_msgs.*;
import gplx.xowa.apps.fsys.*;
import gplx.xowa.langs.*;
public class Xobc_utl_make_lang implements GfoInvkAble {

View File

@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.core.primitives.*; import gplx.core.btries.*; import gplx.core.consoles.*; import gplx.core.intls.*; import gplx.langs.phps.*;
import gplx.core.primitives.*; import gplx.core.btries.*; import gplx.core.consoles.*; import gplx.core.intls.*; import gplx.langs.phps.*; import gplx.core.log_msgs.*;
import gplx.xowa.apps.gfs.*;
import gplx.xowa.apps.fsys.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.msgs.*; import gplx.xowa.langs.kwds.*; import gplx.xowa.langs.numbers.*; import gplx.xowa.langs.parsers.*; import gplx.xowa.langs.specials.*;
@@ -227,7 +227,7 @@ public class Xol_mw_lang_parser {
Bry_.Replace_all_direct(kv_val, Byte_ascii.Underline, Byte_ascii.Space); // NOTE: siteInfo.xml names have " " not "_" (EX: "User talk"). for now, follow that convention
int ns_id = Id_by_mw_name(kv_key);
// if (ns_id == Xow_ns_.Id_null) throw Err_mgr.Instance.fmt_auto_(GRP_KEY, "namespace_names", String_.new_u8(kv_key));
rv[i / 2] = new Xow_ns(ns_id, Xow_ns_case_.Id_1st, kv_val, false); // note that Xow_ns is being used as glorified id-name struct; case_match and alias values do not matter
rv[i / 2] = new Xow_ns(ns_id, Xow_ns_case_.Tid__1st, kv_val, false); // note that Xow_ns is being used as glorified id-name struct; case_match and alias values do not matter
}
return rv;
}

View File

@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.bldrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import org.junit.*;
import gplx.core.intls.*; import gplx.xowa.parsers.lnkis.*;
import gplx.core.intls.*; import gplx.core.log_msgs.*; import gplx.xowa.parsers.lnkis.*;
import gplx.xowa.wikis.nss.*;
import gplx.xowa.langs.*; import gplx.xowa.langs.kwds.*; import gplx.xowa.langs.msgs.*; import gplx.xowa.langs.specials.*;
public class Xol_mw_lang_parser_tst {

View File

@@ -83,8 +83,8 @@ public class Xol_case_itm_ {
private static int parse_mw_grp(Ordered_hash hash, byte[] raw, boolean section_is_upper, int find_bgn) {
byte[] find = section_is_upper ? parse_mw_upper : parse_mw_lower;
int raw_len = raw.length;
int pos = Bry_find_.Find_fwd(raw, find, find_bgn); if (pos == Bry_.NotFound) throw Err_.new_wo_type("could not find section name", "name", String_.new_u8(find));
pos = Bry_find_.Find_fwd(raw, Byte_ascii.Curly_bgn, pos, raw_len); if (pos == Bry_.NotFound) throw Err_.new_wo_type("could not find '{' after section name", "name", String_.new_u8(find));
int pos = Bry_find_.Find_fwd(raw, find, find_bgn); if (pos == Bry_find_.Not_found) throw Err_.new_wo_type("could not find section name", "name", String_.new_u8(find));
pos = Bry_find_.Find_fwd(raw, Byte_ascii.Curly_bgn, pos, raw_len); if (pos == Bry_find_.Not_found) throw Err_.new_wo_type("could not find '{' after section name", "name", String_.new_u8(find));
int itm_bgn = 0;
boolean quote_off = true, itm_is_first = true;
byte[] cur_lhs = Bry_.Empty;

View File

@@ -40,6 +40,7 @@ public class Xol_grammar_ {
switch (lang_id) {
case Xol_lang_stub_.Id_fi: return new Xol_grammar_fi();
case Xol_lang_stub_.Id_ru: return new Xol_grammar_ru();
case Xol_lang_stub_.Id_he: return new Xol_grammar_he();
case Xol_lang_stub_.Id_pl: return Xol_grammar__noop.Instance;
default: return Xol_grammar__unimplemented.Instance;
}

View File

@@ -0,0 +1,53 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.grammars; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.core.btries.*;
public class Xol_grammar_he implements Xol_grammar {
public boolean Grammar_eval(Bry_bfr bfr, Xol_lang_itm lang, byte[] word, byte[] type) {
// if ( isset( $wgGrammarForms['he'][$case][$word] ) ) return $wgGrammarForms['he'][$case][$word]; // TODO: implement global $wgGrammarForms; WHEN: need to find he.w entries for DefaultSettings.php
if (hash.Get_as_int_or(type, -1) == Tid__prefixed) {
// Duplicate the "Waw" if prefixed, but not if it is already double.
if ( Bry_.Match(word, 0, 2, Bry__waw__0) // "ו"
&& !Bry_.Match(word, 0, 4, Bry__waw__1) // "וו"
)
word = Bry_.Add(Bry__waw__0, word);
// Remove the "He" article if prefixed
if ( Bry_.Match(word, 0, 2, Bry__he__0)) // "ה"
word = Bry_.Mid(word, 2);
// Add a hyphen (maqaf) before non-Hebrew letters.
if ( Bry_.Match(word, 0, 2, Bry__maqaf__0) // "א"
|| Bry_.Compare(word, 0, 2, Bry__maqaf__1, 0, 2) == CompareAble_.More // "ת"
)
word = Bry_.Add(Bry__maqaf__2, word);
}
bfr.Add(word);
return true;
}
private static final int Tid__prefixed = 1;
private static final Hash_adp_bry hash = Hash_adp_bry.ci_u8(gplx.xowa.langs.cases.Xol_case_mgr_.U8())
.Add_str_int("prefixed" , Tid__prefixed)
.Add_str_int("תחילית" , Tid__prefixed)
;
private static final byte[]
Bry__waw__0 = Bry_.new_u8("ו"), Bry__waw__1 = Bry_.new_u8("וו")
, Bry__he__0 = Bry_.new_u8("ה")
, Bry__maqaf__0 = Bry_.new_u8("א"), Bry__maqaf__1 = Bry_.new_u8("ת"), Bry__maqaf__2 = Bry_.new_u8("־")
;
}

View File

@@ -66,7 +66,7 @@ public class Xol_msg_mgr_ {
public static Xol_msg_itm Get_msg_itm(Bry_bfr tmp_bfr, Xowe_wiki wiki, Xol_lang_itm lang, byte[] msg_key) {
byte[] msg_key_sub_root = msg_key;
int slash_pos = Bry_find_.Find_bwd(msg_key, Byte_ascii.Slash);
if (slash_pos != Bry_.NotFound) { // key is of format "key/lang"; EX: "January/en"
if (slash_pos != Bry_find_.Not_found) { // key is of format "key/lang"; EX: "January/en"
int msg_key_len = msg_key.length;
if (slash_pos != msg_key_len) { // get text after slash; EX: "en"
Object o = Xol_lang_stub_.Regy().Get_by_mid(msg_key, slash_pos + 1, msg_key_len);

View File

@@ -36,7 +36,7 @@ public class Xol_lang_srl {
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);
Xow_ns ns = new Xow_ns(cur_id, Xow_ns_case_.Tid__1st, cur_name, false);
rv.Add(ns);
fld_bgn = pos + 1;
cur_id = -1;

View File

@@ -208,7 +208,7 @@ class Xol_lang_srl_fxt {
} GfsCtx ctx = GfsCtx.new_(); Xoa_gfs_bldr bldr = new Xoa_gfs_bldr(); //Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
public Xoae_app App() {return app;} private Xoae_app app;
public Xol_lang_itm Lang() {return lang;} private Xol_lang_itm 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 Xow_ns ns_(int id, String s) {return new Xow_ns(id, Xow_ns_case_.Tid__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));

View File

@@ -16,8 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.vnts.converts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*; import gplx.xowa.langs.vnts.*;
import org.junit.*;
import gplx.langs.phps.*;
import org.junit.*; import gplx.core.log_msgs.*; import gplx.langs.phps.*;
public class Xol_mw_parse_tst {
private final Xol_mw_parse_fxt fxt = new Xol_mw_parse_fxt();
// @Test public void Basic() {
@@ -54,13 +53,13 @@ class Xol_mw_parse_grp {
Write_end(bfr);
}
private void Write_bgn(Bry_bfr bfr) {
bfr.Add_str_a7("// ").Add(lng).Add_str("_").Add(vnt).Add_byte_nl();
bfr.Add_str_a7("// ").Add(lng).Add_str_a7("_").Add(vnt).Add_byte_nl();
bfr.Add_str_a7("app.langs.get('");
bfr.Add(lng);
bfr.Add_str_a7("').converts.get('");
bfr.Add(vnt);
bfr.Add_str_a7("').add_bulk(");
bfr.Add_byte_nl().Add_str("<:['").Add_byte_nl();
bfr.Add_byte_nl().Add_str_a7("<:['").Add_byte_nl();
}
private void Write_itm(Bry_bfr bfr, Xol_mw_parse_itm itm) {
bfr.Add(itm.Src());