mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-09-29 23:10:52 +00:00
Scribunto: Change fetchForLanguages to return a key of languageCode, not integer-id [#331]
This commit is contained in:
parent
4626203f16
commit
5fa8c20561
@ -35,15 +35,6 @@ public class Scrib_kv_utl_ {
|
|||||||
Keyval[] rv = new Keyval[len];
|
Keyval[] rv = new Keyval[len];
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
rv[i] = Keyval_.int_(i + Scrib_core.Base_1, list.Get_at(i));
|
rv[i] = Keyval_.int_(i + Scrib_core.Base_1, list.Get_at(i));
|
||||||
list.Clear();
|
|
||||||
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;
|
return rv;
|
||||||
}
|
}
|
||||||
public static Keyval[] flat_many_(Object... vals) {
|
public static Keyval[] flat_many_(Object... vals) {
|
||||||
|
@ -148,13 +148,8 @@ 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 lang_code = args.Cast_str_or_null(0);
|
||||||
String include = args.Cast_str_or(1, "mw");
|
String include = args.Cast_str_or(1, "mw");
|
||||||
Ordered_hash rv = core.App().Lang_mgr().Name_mgr().fetchLanguageNames(lang_code, include);
|
Ordered_hash hash = core.App().Lang_mgr().Name_mgr().fetchLanguageNames(lang_code, include);
|
||||||
return rslt.Init_obj(Scrib_kv_utl_.base1_list_(rv));
|
return rslt.Init_obj((Keyval[])hash.To_ary(Keyval.class));
|
||||||
/*
|
|
||||||
// byte[] lang_code = args.Cast_bry_or_null(0);
|
|
||||||
// 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
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
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