fix locale issue ( #2 )

axtloss/rework-partitioning
amy 3 years ago
parent 9729a1006f
commit 2a6c27a339

@ -21,15 +21,17 @@ pub fn set_timezone(timezone: &str) {
pub fn set_locale(locale: String) {
files_eval(
files::append_file("/mnt/etc/locale.gen", "en_US.UTF-8 UTF-8"),
files::append_file("/mnt/etc/locale.gen", "en_US.UTF-8 UTF-8\n"),
"add en_US.UTF-8 UTF-8 to locale.gen",
);
files_eval(
files::append_file("/mnt/etc/locale.gen", locale.as_str()),
"add locales to locale.gen",
);
for i in locale.split(' ') {
files_eval(
files::append_file("/mnt/etc/locale.gen", format!("{}\n", i).as_str()),
"add locales to locale.gen",
);
}
exec_eval(
exec_chroot("locale-gen", vec!["".to_string()]),
exec_chroot("locale-gen", vec![]),
"generate locales",
);
files::create_file("/mnt/etc/locale.conf");

@ -154,13 +154,7 @@ fn main() {
} else if let Some(app) = app.subcommand_matches("locale") {
let kbrlayout = app.value_of("keyboard").unwrap();
let timezn = app.value_of("timezone").unwrap();
let locale: String = app
.values_of("locales")
.unwrap()
.into_iter()
.map(|s| s.to_string())
.collect();
locale::set_locale(locale);
locale::set_locale(app.values_of("locales").unwrap().collect::<Vec<&str>>().join(" "));
locale::set_keyboard(kbrlayout);
locale::set_timezone(timezn);
} else if let Some(app) = app.subcommand_matches("networking") {

Loading…
Cancel
Save