diff options
Diffstat (limited to 'android')
| -rw-r--r-- | android/translations-converter/src/gettext.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/android/translations-converter/src/gettext.rs b/android/translations-converter/src/gettext.rs index 818ca6c7eb..f42462f4bd 100644 --- a/android/translations-converter/src/gettext.rs +++ b/android/translations-converter/src/gettext.rs @@ -100,13 +100,17 @@ impl Translation { let mut current_plural_id = None; let mut plural_form = None; let mut variants = BTreeMap::new(); - let file = BufReader::new(File::open(file_path).expect("Failed to open gettext file")); - for line in file.lines() { - let line = line.expect("Failed to read from gettext file"); - let line = line.trim(); + let file = BufReader::new(File::open(file_path).expect("Failed to open gettext file")); + // Ensure there's an empty line at the end so that the "else" part of the string matching + // code will run for the last message in the file. + let lines = file + .lines() + .map(|line_result| line_result.expect("Failed to read from gettext file")) + .chain(Some(String::new())); - match_str! { (line) + for line in lines { + match_str! { (line.trim()) ["msgid \"", msg_id, "\""] => { current_id = Some(normalize(msg_id)); } |
