コード例 #1
0
  public static Keyval[] new_() {
    Ordered_hash translated = Ordered_hash_.New_bry();
    List_adp untranslated = List_adp_.New();
    Add_itm_many(
        translated,
        Xol_lang_stub_.Id_en,
        Xol_lang_stub_.Id_de,
        Xol_lang_stub_.Id_pl,
        Xol_lang_stub_.Id_zh_hans,
        Xol_lang_stub_
            .Id_zh_hant); // add langs with translations first, so they alphabetize to top of list
    int len = Xol_lang_stub_.Id__max;
    for (int i = 0; i < len; i++) { // add rest of langs, but sort by code
      Xol_lang_stub itm = Xol_lang_stub_.Get_by_id(i);
      if (translated.Has(itm.Key())) continue;
      untranslated.Add(itm);
    }
    untranslated.Sort_by(Xol_lang_stub_.Comparer_key);

    Keyval[] rv = new Keyval[len];
    int translated_max = translated.Count();
    for (int i = 0; i < translated_max; i++) rv[i] = new_itm((Xol_lang_stub) translated.Get_at(i));

    for (int i = translated_max; i < len; i++)
      rv[i] = new_itm((Xol_lang_stub) untranslated.Get_at(i - translated_max));
    return rv;
  }
コード例 #2
0
 private static void Add_itm_many(Ordered_hash translated, int... langs) {
   int langs_len = langs.length;
   for (int i = 0; i < langs_len; i++) {
     Xol_lang_stub itm = Xol_lang_stub_.Get_by_id(langs[i]);
     translated.Add_if_dupe_use_nth(itm.Key(), itm);
   }
 }
コード例 #3
0
 public Xoa_sys_cfg Lang_(byte[] v) {
   lang_key = Xol_lang_stub_.Get_by_key_or_en(v).Key();
   if (app.Stage()
       == gplx.xowa.apps.Xoa_stage_
           .Tid_launch) { // do not update user lang unless launched; DATE:2014-05-26
     Xol_lang_itm lang = app.Lang_mgr().Get_by_or_load(lang_key);
     app.Usere().Lang_(lang);
     app.Usere().Wiki().Html_mgr().Portal_mgr().Init();
   }
   return this;
 }