From 5102f708a53861d6c4e4663e0a7d28f55cedeaf3 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 14 Oct 2024 09:52:14 -0300 Subject: [PATCH] Bug 38164: Skip fuzzy translations This patch was envisioned by Julian Maurice. Test plan: 0. Apply the 1st patch (the revert) 1. Go to `misc/translator/po` 2. es-ES-messages-js.po 3. Mark "Edit" string as fuzzy (around line 48). It should look like: ``` msgid "Edit" msgstr "Editar" ``` 4. Edit ./intranet-main.tt and add the following lines at the bottom, inside the `$(document).ready` block: ```javascript console.log(_("Edit")); console.log(__("Edit")); ``` 5. Install the templates k$ koha-translate --install es-ES --dev kohadev && restart_all 6. Enable *es-ES* by searching for `language` in the sysprefs and switch to it for the staff interface. 7. Go to the Koha home page, open the browser console => FAIL: Notice that the second log in the console is displaying the fuzzy string (i.e. is being translated when it shouldn't) 8. Apply this patch 9. Re-install the translated templates: k$ koha-translate --update es-ES --dev kohadev && restart_all 10. Repeat 7 => SUCCESS: With this patch applied both logs show the English version of the string. 11. Remove the fuzzy flag on `es-ES-messages-js.po` 12. Repeat 9 and 10 => SUCCESS: The results are similar to step 7, but in this case they are expected as the string is not marked fuzzy. 13. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Aleisha Amohia Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer --- misc/translator/po2json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/misc/translator/po2json b/misc/translator/po2json index a04d85949f..81202820d9 100755 --- a/misc/translator/po2json +++ b/misc/translator/po2json @@ -72,6 +72,8 @@ sub main foreach my $po (@$pos) { + next if $po->fuzzy; + my $qmsgid1 = $po->msgid; my $msgid1 = $po->dequote( $qmsgid1 ); -- 2.39.5