mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Use concat
to build i18n specifiers"
This commit is contained in:
parent
055df2a8df
commit
67642b0467
@ -201,7 +201,7 @@ impl assets::Compound for Localization {
|
|||||||
asset_key: &str,
|
asset_key: &str,
|
||||||
) -> Result<Self, assets::Error> {
|
) -> Result<Self, assets::Error> {
|
||||||
let raw = cache
|
let raw = cache
|
||||||
.load::<RawLocalization>(&(asset_key.to_string() + "." + LANG_MANIFEST_FILE))?
|
.load::<RawLocalization>(&[asset_key, ".", LANG_MANIFEST_FILE].concat())?
|
||||||
.cloned();
|
.cloned();
|
||||||
let mut localization = Localization::from(raw);
|
let mut localization = Localization::from(raw);
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ impl assets::Compound for Localization {
|
|||||||
// Use the localization's subdirectory list to load fragments from there
|
// Use the localization's subdirectory list to load fragments from there
|
||||||
for sub_directory in localization.sub_directories.iter() {
|
for sub_directory in localization.sub_directories.iter() {
|
||||||
for localization_asset in cache
|
for localization_asset in cache
|
||||||
.load_dir::<LocalizationFragment>(&(asset_key.to_string() + "." + &sub_directory))?
|
.load_dir::<LocalizationFragment>(&[asset_key, ".", sub_directory].concat())?
|
||||||
.iter()
|
.iter()
|
||||||
{
|
{
|
||||||
localization
|
localization
|
||||||
@ -264,7 +264,7 @@ impl assets::Compound for LocalizationList {
|
|||||||
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
|
||||||
if let Ok(localization) = cache.load::<RawLocalization>(
|
if let Ok(localization) = cache.load::<RawLocalization>(
|
||||||
&(specifier.to_string() + "." + i18n_key + "." + LANG_MANIFEST_FILE),
|
&[specifier, ".", i18n_key, ".", LANG_MANIFEST_FILE].concat(),
|
||||||
) {
|
) {
|
||||||
languages.push(localization.read().metadata.clone());
|
languages.push(localization.read().metadata.clone());
|
||||||
}
|
}
|
||||||
@ -282,11 +282,7 @@ pub fn list_localizations() -> Vec<LanguageMetadata> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Return the asset associated with the language_id
|
/// Return the asset associated with the language_id
|
||||||
pub fn i18n_asset_key(language_id: &str) -> String {
|
pub fn i18n_asset_key(language_id: &str) -> String { ["voxygen.i18n.", language_id].concat() }
|
||||||
let prefix = "voxygen.i18n.";
|
|
||||||
let s = String::with_capacity(prefix.len() + language_id.len());
|
|
||||||
s + prefix + language_id
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user