From 5441871f038e7ae601b8c003e1b47ae685d18530 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: 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 --- misc/translator/po2json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/misc/translator/po2json b/misc/translator/po2json index a04d85949fe..81202820d92 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