mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
(temp?) fixed list_localization function + add sub_directories to other languages
This commit is contained in:
parent
00140384f7
commit
bb7cc3d53b
@ -27,6 +27,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
/// Texts used in multiple locations with the same formatting
|
/// Texts used in multiple locations with the same formatting
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
scale_ratio: 0.9,
|
scale_ratio: 0.9,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
// Common texts used in multiple locations
|
// Common texts used in multiple locations
|
||||||
"common.username": "pseudo",
|
"common.username": "pseudo",
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
|
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
scale_ratio: 1.0,
|
scale_ratio: 1.0,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
scale_ratio: 0.75,
|
scale_ratio: 0.75,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
scale_ratio: 0.75,
|
scale_ratio: 0.75,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
sub_directories: [],
|
||||||
string_map: {
|
string_map: {
|
||||||
/// Start Common section
|
/// Start Common section
|
||||||
// Texts used in multiple locations with the same formatting
|
// Texts used in multiple locations with the same formatting
|
||||||
|
@ -242,11 +242,19 @@ pub fn init_localization_expect(asset_key: &str) -> Localization {
|
|||||||
|
|
||||||
/// Load all the available languages located in the voxygen asset directory
|
/// Load all the available languages located in the voxygen asset directory
|
||||||
pub fn list_localizations() -> Vec<LanguageMetadata> {
|
pub fn list_localizations() -> Vec<LanguageMetadata> {
|
||||||
assets::load_dir::<Localization>("voxygen.i18n")
|
let mut languages = vec![];
|
||||||
.unwrap()
|
// list language directories
|
||||||
.iter_all()
|
for l18n_directory in std::fs::read_dir("assets/voxygen/i18n").unwrap() {
|
||||||
.filter_map(|(_, lang)| lang.ok().map(|e| e.read().metadata.clone()))
|
if let Ok(l18n_entry) = l18n_directory {
|
||||||
.collect()
|
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
|
/// Return the asset associated with the language_id
|
||||||
|
Loading…
Reference in New Issue
Block a user