Fix locales slow

This commit is contained in:
Ward from fusion-voyager-3 2024-02-27 20:40:38 +03:00
parent 3f56e07b2a
commit bcb27c47f3
3 changed files with 165 additions and 25 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
pika-installer-gtk4 (1.0.2-100pika1) pikauwu; urgency=low pika-installer-gtk4 (1.0.2-100pika2) pikauwu; urgency=low
* First release * First release

3
debian/control vendored
View File

@ -16,5 +16,6 @@ Rules-Requires-Root: no
Package: pika-installer-gtk4 Package: pika-installer-gtk4
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, Depends: ${shlibs:Depends},
pikainstall pikainstall,
gir1.2-gnomedesktop-4.0
Description: A frontend in GTK 4 and Libadwaita for pikainstall. Description: A frontend in GTK 4 and Libadwaita for pikainstall.

View File

@ -163,32 +163,171 @@ pub fn language_page(content_stack: &gtk::Stack, window: &adw::ApplicationWindow
None => panic!("$LANG is not set"), None => panic!("$LANG is not set"),
}; };
let locale_cli = Command::new("locale") let locale_list = ["ab_GE",
.arg("-a") "aa_DJ",
.stdin(Stdio::piped()) "af_ZA",
.stdout(Stdio::piped()) "ak_GH",
.spawn() "sq_AL",
.unwrap_or_else(|e| panic!("failed {}", e)); "am_ET",
let locale_cli_cut = Command::new("cut") "ar_EG",
.arg("-d.") "an_ES",
.arg("-f1") "hy_AM",
.stdin(Stdio::from(locale_cli.stdout.unwrap())) // Pipe through. "as_IN",
.stdout(Stdio::piped()) "ar_AE",
.spawn() "az_AZ",
.unwrap(); "bs_BA",
let locale_cli_sort = Command::new("sort") "eu_ES",
.arg("-u") "be_BY",
.stdin(Stdio::from(locale_cli_cut.stdout.unwrap())) "bn_BD",
.stdout(Stdio::piped()) "ar_BH",
.spawn() "bi_VU",
.unwrap(); "bs_BA",
"br_FR",
let locale_reader = BufReader::new(locale_cli_sort.stdout.expect("could not get stdout")); "bg_BG",
"my_MM",
"ca_ES",
"de_CH",
"ce_RU",
"zh_CN",
"cv_RU",
"kw_GB",
"es_CO",
"es_CR",
"hr_HR",
"cs_CZ",
"da_DK",
"dv_MV",
"nl_NL",
"dz_BT",
"en_US",
"en_GB",
"eo",
"et_EE",
"et_EE",
"fo_FO",
"hif_FJ",
"fi_FI",
"fr_FR",
"ff_SN",
"gl_ES",
"ka_GE",
"de_DE",
"el_GR",
"gu_IN",
"ht_HT",
"ha_NG",
"he_IL",
"hi_IN",
"hu_HU",
"ia_FR",
"id_ID",
"en_IE",
"ga_IE",
"ig_NG",
"ik_CA",
"is_IS",
"it_IT",
"iu_CA",
"ja_JP",
"kl_GL",
"kn_IN",
"ko_KR",
"kk_KZ",
"km_KH",
"rw_RW",
"ky_KG",
"ky_KG",
"ko_KR",
"ku_TR",
"lo_LA",
"lb_LU",
"lg_UG",
"li_NL",
"ln_CD",
"lo_LA",
"lt_LT",
"fr_LU",
"lv_LV",
"gv_GB",
"mk_MK",
"mg_MG",
"ms_MY",
"ml_IN",
"mt_MT",
"mi_NZ",
"mr_IN",
"mn_MN",
"ne_NP",
"en_NG",
"nb_NO",
"nn_NO",
"no_NO",
"nr_ZA",
"oc_FR",
"es_CU",
"om_ET",
"or_IN",
"os_RU",
"pa_IN",
"fa_IR",
"pl_PL",
"ps_AF",
"pt_BR",
"ro_RO",
"ru_RU",
"sa_IN",
"sc_IT",
"sd_IN",
"se_NO",
"sm_WS",
"en_SG",
"sr_RS",
"gd_GB",
"wo_SN",
"si_LK",
"sk_SK",
"sl_SI",
"so_SO",
"st_ZA",
"es_ES",
"sw_KE",
"ss_ZA",
"sv_SE",
"ta_IN",
"te_IN",
"tg_TJ",
"th_TH",
"ti_ER",
"bo_CN",
"tk_TM",
"tl_PH",
"tn_ZA",
"to_TO",
"tr_TR",
"ts_ZA",
"tt_RU",
"zh_TW",
"ug_CN",
"uk_UA",
"ur_PK",
"ve_ZA",
"vi_VN",
"wa_BE",
"cy_GB",
"wo_SN",
"fy_NL",
"xh_ZA",
"yi_US",
"yo_NG",
"zu_ZA",
"zu_ZA",
"pt_BR",
"pt_PT",];
let lang_data_buffer = gtk::TextBuffer::builder().build(); let lang_data_buffer = gtk::TextBuffer::builder().build();
for locale in locale_reader.lines() { for locale in locale_list.iter() {
let locale = locale.unwrap(); let locale = locale.to_string();
let locale_name_cli = let locale_name_cli =
Command::new("/usr/lib/pika/pika-installer-gtk4/scripts/locale-name.py") Command::new("/usr/lib/pika/pika-installer-gtk4/scripts/locale-name.py")
.arg(locale.clone()) .arg(locale.clone())