(temp?) fixed list_localization function + add sub_directories to other languages

This commit is contained in:
Vincent Foulon 2020-12-28 22:24:12 +01:00
parent 00140384f7
commit bb7cc3d53b
17 changed files with 30 additions and 5 deletions

View File

@ -27,6 +27,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -39,6 +39,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
/// Texts used in multiple locations with the same formatting

View File

@ -40,6 +40,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -41,6 +41,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -27,6 +27,7 @@
scale_ratio: 0.9,
),
},
sub_directories: [],
string_map: {
// Common texts used in multiple locations
"common.username": "pseudo",

View File

@ -42,6 +42,8 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -41,6 +41,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -41,6 +41,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -27,6 +27,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -27,6 +27,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -41,6 +41,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -40,6 +40,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section

View File

@ -41,6 +41,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -41,6 +41,7 @@
scale_ratio: 1.0,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -41,6 +41,7 @@
scale_ratio: 0.75,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -27,6 +27,7 @@
scale_ratio: 0.75,
),
},
sub_directories: [],
string_map: {
/// Start Common section
// Texts used in multiple locations with the same formatting

View File

@ -242,11 +242,19 @@ pub fn init_localization_expect(asset_key: &str) -> Localization {
/// Load all the available languages located in the voxygen asset directory
pub fn list_localizations() -> Vec<LanguageMetadata> {
assets::load_dir::<Localization>("voxygen.i18n")
.unwrap()
.iter_all()
.filter_map(|(_, lang)| lang.ok().map(|e| e.read().metadata.clone()))
.collect()
let mut languages = vec![];
// list language directories
for l18n_directory in std::fs::read_dir("assets/voxygen/i18n").unwrap() {
if let Ok(l18n_entry) = l18n_directory {
if let Some(l18n_key) = l18n_entry.file_name().to_str() {
// load the root file of all the subdirectories
if let Ok(localization) = Localization::load(&("voxygen.i18n.".to_string() + l18n_key + "._root")) {
languages.push(localization.read().metadata.clone());
}
}
}
}
languages
}
/// Return the asset associated with the language_id