diff --git a/rslib/i18n/src/generated.rs b/rslib/i18n/src/generated.rs index 0dea3292e..7463a594e 100644 --- a/rslib/i18n/src/generated.rs +++ b/rslib/i18n/src/generated.rs @@ -10,6 +10,6 @@ pub struct All; include!(concat!(env!("OUT_DIR"), "/strings.rs")); impl Translations for All { - const _STRINGS: &phf::Map<&str, &phf::Map<&str, &str>> = &STRINGS; - const _KEYS_BY_MODULE: &[&[&str]] = &KEYS_BY_MODULE; + const STRINGS: &phf::Map<&str, &phf::Map<&str, &str>> = &_STRINGS; + const KEYS_BY_MODULE: &[&[&str]] = &_KEYS_BY_MODULE; } diff --git a/rslib/i18n/src/generated_launcher.rs b/rslib/i18n/src/generated_launcher.rs index b7adac8e6..35dc3f28b 100644 --- a/rslib/i18n/src/generated_launcher.rs +++ b/rslib/i18n/src/generated_launcher.rs @@ -10,6 +10,6 @@ pub struct Launcher; include!(concat!(env!("OUT_DIR"), "/strings_launcher.rs")); impl Translations for Launcher { - const _STRINGS: &phf::Map<&str, &phf::Map<&str, &str>> = &STRINGS; - const _KEYS_BY_MODULE: &[&[&str]] = &KEYS_BY_MODULE; + const STRINGS: &phf::Map<&str, &phf::Map<&str, &str>> = &_STRINGS; + const KEYS_BY_MODULE: &[&[&str]] = &_KEYS_BY_MODULE; } diff --git a/rslib/i18n/src/lib.rs b/rslib/i18n/src/lib.rs index 6ef3ad168..95b960fad 100644 --- a/rslib/i18n/src/lib.rs +++ b/rslib/i18n/src/lib.rs @@ -191,8 +191,8 @@ fn get_bundle_with_extra( } pub trait Translations { - const _STRINGS: &phf::Map<&str, &phf::Map<&str, &str>>; - const _KEYS_BY_MODULE: &[&[&str]]; + const STRINGS: &phf::Map<&str, &phf::Map<&str, &str>>; + const KEYS_BY_MODULE: &[&[&str]]; } #[derive(Clone)] @@ -203,7 +203,7 @@ pub struct I18n { impl I18n

{ fn get_key(module_idx: usize, translation_idx: usize) -> &'static str { - P::_KEYS_BY_MODULE + P::KEYS_BY_MODULE .get(module_idx) .and_then(|translations| translations.get(translation_idx)) .cloned() @@ -217,7 +217,7 @@ impl I18n

{ .map(|lang| { let mut buf = String::new(); let lang_name = remapped_lang_name(&lang); - if let Some(strings) = P::_STRINGS.get(lang_name) { + if let Some(strings) = P::STRINGS.get(lang_name) { if desired_modules.is_empty() { // empty list, provide all modules for value in strings.values() { @@ -240,7 +240,7 @@ impl I18n

{ /// either access each &str separately, or load them on demand. fn ftl_localized_text(lang: &LanguageIdentifier) -> Option { let lang = remapped_lang_name(lang); - if let Some(module) = P::_STRINGS.get(lang) { + if let Some(module) = P::STRINGS.get(lang) { let mut text = String::new(); for module_text in module.values() { text.push_str(module_text) diff --git a/rslib/i18n/write_strings.rs b/rslib/i18n/write_strings.rs index fb92c63b8..db31be2b7 100644 --- a/rslib/i18n/write_strings.rs +++ b/rslib/i18n/write_strings.rs @@ -144,7 +144,7 @@ fn write_translation_key_index(modules: &[Module], buf: &mut String) { writeln!( buf, - "pub(crate) const KEYS_BY_MODULE: [&[&str]; {count}] = [", + "pub(crate) const _KEYS_BY_MODULE: [&[&str]; {count}] = [", count = modules.len(), ) .unwrap(); @@ -164,7 +164,7 @@ fn write_translation_key_index(modules: &[Module], buf: &mut String) { fn write_lang_map(map: &TranslationsByLang, buf: &mut String) { buf.push_str( " -pub(crate) const STRINGS: phf::Map<&str, &phf::Map<&str, &str>> = phf::phf_map! { +pub(crate) const _STRINGS: phf::Map<&str, &phf::Map<&str, &str>> = phf::phf_map! { ", );