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) { pub fn set_locale(locale: String) {
files_eval( 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", "add en_US.UTF-8 UTF-8 to locale.gen",
); );
files_eval( for i in locale.split(' ') {
files::append_file("/mnt/etc/locale.gen", locale.as_str()), files_eval(
"add locales to locale.gen", files::append_file("/mnt/etc/locale.gen", format!("{}\n", i).as_str()),
); "add locales to locale.gen",
);
}
exec_eval( exec_eval(
exec_chroot("locale-gen", vec!["".to_string()]), exec_chroot("locale-gen", vec![]),
"generate locales", "generate locales",
); );
files::create_file("/mnt/etc/locale.conf"); files::create_file("/mnt/etc/locale.conf");

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

Loading…
Cancel
Save