mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Scribunto: Change default for fetchLanguageName from 'mw' to null [#331]
This commit is contained in:
parent
b3120bab39
commit
5d8a139903
@ -38,6 +38,14 @@ public class Scrib_kv_utl_ {
|
|||||||
list.Clear();
|
list.Clear();
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
public static Keyval[] base1_list_(Ordered_hash list) {
|
||||||
|
int len = list.Count();
|
||||||
|
Keyval[] rv = new Keyval[len];
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
rv[i] = Keyval_.int_(i + Scrib_core.Base_1, list.Get_at(i));
|
||||||
|
list.Clear();
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
public static Keyval[] flat_many_(Object... vals) {
|
public static Keyval[] flat_many_(Object... vals) {
|
||||||
int len = vals.length;
|
int len = vals.length;
|
||||||
Keyval[] rv = new Keyval[len / 2];
|
Keyval[] rv = new Keyval[len / 2];
|
||||||
|
@ -132,7 +132,7 @@ public class Scrib_lib_language implements Scrib_lib {
|
|||||||
public boolean FetchLanguageName(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
public boolean FetchLanguageName(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||||
String lang_code = args.Pull_str(0);
|
String lang_code = args.Pull_str(0);
|
||||||
String inLanguage = args.Cast_str_or_null(1);
|
String inLanguage = args.Cast_str_or_null(1);
|
||||||
String include = args.Cast_str_or(2, "mw");
|
String include = args.Cast_str_or(2, null);
|
||||||
String rv = core.App().Lang_mgr().Name_mgr().fetchLanguageName(lang_code, inLanguage, include);
|
String rv = core.App().Lang_mgr().Name_mgr().fetchLanguageName(lang_code, inLanguage, include);
|
||||||
return rslt.Init_obj(rv);
|
return rslt.Init_obj(rv);
|
||||||
/*
|
/*
|
||||||
@ -146,9 +146,15 @@ public class Scrib_lib_language implements Scrib_lib {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
public boolean FetchLanguageNames(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
public boolean FetchLanguageNames(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||||
|
String lang_code = args.Cast_str_or_null(0);
|
||||||
|
String include = args.Cast_str_or(1, "mw");
|
||||||
|
Ordered_hash rv = core.App().Lang_mgr().Name_mgr().fetchLanguageNames(lang_code, include);
|
||||||
|
return rslt.Init_obj(Scrib_kv_utl_.base1_list_(rv));
|
||||||
|
/*
|
||||||
// byte[] lang_code = args.Cast_bry_or_null(0);
|
// byte[] lang_code = args.Cast_bry_or_null(0);
|
||||||
// byte[] include = args.Form_bry_or(1, FetchLanguageNames_mw);
|
// byte[] include = args.Form_bry_or(1, FetchLanguageNames_mw);
|
||||||
return rslt.Init_obj(core.Wiki().Cache_mgr().Scrib_lang_names()); // NOTE: return current language only; MW iterates over langs in wiki; XO is more complicated as technically all langs are available; need to map subset of langs per wiki, which is not trivial
|
return rslt.Init_obj(core.Wiki().Cache_mgr().Scrib_lang_names()); // NOTE: return current language only; MW iterates over langs in wiki; XO is more complicated as technically all langs are available; need to map subset of langs per wiki, which is not trivial
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
public boolean GetFallbacksFor(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
public boolean GetFallbacksFor(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||||
byte[] lang_code = args.Pull_bry(0);
|
byte[] lang_code = args.Pull_bry(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user