Skip to content

Commit

Permalink
Avoid translating lines with ;
Browse files Browse the repository at this point in the history
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 (google#318). That will allow us to be more
selective about what we translate.
  • Loading branch information
mgeisler committed Feb 9, 2023
1 parent d6a0ecb commit 8dcf7cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cloud-translate/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 8dcf7cb

Please sign in to comment.