From 9a72a918c1dc457c4f8f996d200a67d15b6cc0c8 Mon Sep 17 00:00:00 2001 From: Andrea Ciprietti Date: Thu, 19 Dec 2024 00:32:12 +0100 Subject: [PATCH] Address review comments --- i18n-helpers/src/gettext.rs | 2 +- i18n-helpers/src/lib.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/i18n-helpers/src/gettext.rs b/i18n-helpers/src/gettext.rs index 16e8dca4..46ee2fb7 100644 --- a/i18n-helpers/src/gettext.rs +++ b/i18n-helpers/src/gettext.rs @@ -44,7 +44,7 @@ fn translate(text: &str, catalog: &Catalog) -> anyhow::Result { let events = extract_events(text, None); // Translation should always succeed. let translated_events = - translate_events(&events, catalog).expect("Fatal: failed to translate events"); + translate_events(&events, catalog).expect("Failed to translate events"); let (translated, _) = reconstruct_markdown(&translated_events, None) .map_err(|e| match e { CmarkError::FormatFailed(_) => e.into(), diff --git a/i18n-helpers/src/lib.rs b/i18n-helpers/src/lib.rs index 3ed1b97b..3ab04c10 100644 --- a/i18n-helpers/src/lib.rs +++ b/i18n-helpers/src/lib.rs @@ -462,7 +462,7 @@ fn heuristic_codeblock<'a>( _ => true, }; - Ok(if is_translate { + let (groups, ctx) = if is_translate { ( vec![Group::Translate { events: events.into(), @@ -472,7 +472,8 @@ fn heuristic_codeblock<'a>( ) } else { (vec![Group::Skip(events.into())], ctx) - }) + }; + Ok((groups, ctx)) } /// Creates groups by parsing codeblock.