From 8dcf7cbfaedfc7fb717a027a30d08a6b0eb2109d Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Wed, 1 Feb 2023 15:49:27 +0100 Subject: [PATCH] Avoid translating lines with `;` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a very simple work-around for us extracting lots of code to the `messages.pot` file. The comments in the code can be translated, but Cloud Translate doesn’t know about it: instead it translates everything, keywords and all. The course text uses `;` only very sparingly: I found a single page which uses the character. So we are not losing much by skipping these messages. Long-term, we should extract code blocks at a unit and we should mark them in the `messages.pot` file (#318). That will allow us to be more selective about what we translate. --- cloud-translate/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-translate/src/main.rs b/cloud-translate/src/main.rs index 89a4e0ce98d4..32226164d539 100644 --- a/cloud-translate/src/main.rs +++ b/cloud-translate/src/main.rs @@ -137,7 +137,7 @@ async fn translate_catalog( continue; } let msgid = msg.get_msgid().unwrap(); - if msgid.trim().is_empty() || msgid.contains("```") { + if msgid.trim().is_empty() || msgid.contains("```") || msgid.contains(";") { continue; } char_count += msgid.chars().count();