Compare commits

..

2 commits

View file

@ -67,11 +67,18 @@ impl TranslationFile {
} }
fn get(&self, key: &str) -> Option<&String> { fn get(&self, key: &str) -> Option<&String> {
self.messages.get(key) let result = self.messages.get(key);
if result.is_none() {
log::warn!("Translation key not found in bundle: {} (available keys: {})", key, self.messages.len());
}
result
} }
fn merge(&mut self, other: Self) { fn merge(&mut self, other: Self) {
let before = self.messages.len();
self.messages.extend(other.messages); self.messages.extend(other.messages);
let after = self.messages.len();
log::debug!("Merged {} translations (total: {})", after - before, after);
} }
} }
@ -132,11 +139,14 @@ impl LocaleBundle {
messages: HashMap::new(), messages: HashMap::new(),
}; };
log::info!("Loading embedded files for locale: {}", locale_str);
for file in EmbeddedLocales::iter() { for file in EmbeddedLocales::iter() {
if file.starts_with(locale_str) && file.ends_with(".ftl") { if file.starts_with(locale_str) && file.ends_with(".ftl") {
log::info!("Found .ftl file for locale {}: {}", locale_str, file);
if let Some(content_bytes) = EmbeddedLocales::get(&file) { if let Some(content_bytes) = EmbeddedLocales::get(&file) {
if let Ok(content) = std::str::from_utf8(content_bytes.data.as_ref()) { if let Ok(content) = std::str::from_utf8(content_bytes.data.as_ref()) {
let file_translations = TranslationFile::parse(content); let file_translations = TranslationFile::parse(content);
log::info!("Parsed {} keys from {}", file_translations.messages.len(), file);
translations.merge(file_translations); translations.merge(file_translations);
} }
} }