mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'a1phyr/fix_list_localization' into 'master'
Fix i18n::list_localizations Closes #910 See merge request veloren/veloren!1673
This commit is contained in:
commit
da8fdafd6a
@ -205,6 +205,11 @@ lazy_static! {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the actual path of the specifier with the extension.
|
||||||
|
///
|
||||||
|
/// For directories, give `""` as extension.
|
||||||
|
pub fn path_of(specifier: &str, ext: &str) -> PathBuf { ASSETS.source().path_of(specifier, ext) }
|
||||||
|
|
||||||
fn get_dir_files(files: &mut Vec<String>, path: &Path, specifier: &str) -> io::Result<()> {
|
fn get_dir_files(files: &mut Vec<String>, path: &Path, specifier: &str) -> io::Result<()> {
|
||||||
for entry in fs::read_dir(path)? {
|
for entry in fs::read_dir(path)? {
|
||||||
if let Ok(entry) = entry {
|
if let Ok(entry) = entry {
|
||||||
|
@ -251,7 +251,8 @@ impl assets::Compound for Localization {
|
|||||||
pub fn list_localizations() -> Vec<LanguageMetadata> {
|
pub fn list_localizations() -> Vec<LanguageMetadata> {
|
||||||
let mut languages = vec![];
|
let mut languages = vec![];
|
||||||
// List language directories
|
// List language directories
|
||||||
for i18n_directory in std::fs::read_dir("assets/voxygen/i18n").unwrap() {
|
let i18n_root = assets::path_of("voxygen.i18n", "");
|
||||||
|
for i18n_directory in std::fs::read_dir(&i18n_root).unwrap() {
|
||||||
if let Ok(i18n_entry) = i18n_directory {
|
if let Ok(i18n_entry) = i18n_directory {
|
||||||
if let Some(i18n_key) = i18n_entry.file_name().to_str() {
|
if let Some(i18n_key) = i18n_entry.file_name().to_str() {
|
||||||
// load the root file of all the subdirectories
|
// load the root file of all the subdirectories
|
||||||
|
Loading…
Reference in New Issue
Block a user