From 2ac367a4bfafcac22b31687fa1b26d29926232f9 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Thu, 9 Nov 2023 07:41:31 -0800 Subject: [PATCH] Prettify + Add tests for #2515 --- .../modules/originalstring/components/OriginalString.tsx | 7 +++---- .../src/modules/placeable/components/Highlight.test.js | 2 ++ translate/src/modules/placeable/components/Highlight.tsx | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/translate/src/modules/originalstring/components/OriginalString.tsx b/translate/src/modules/originalstring/components/OriginalString.tsx index bbf3e59e76..f2fc73c5a2 100644 --- a/translate/src/modules/originalstring/components/OriginalString.tsx +++ b/translate/src/modules/originalstring/components/OriginalString.tsx @@ -65,7 +65,8 @@ export function OriginalString({ const markedTerm = target.dataset['match']; if (markedTerm) { setPopupTerms( - terms.terms?.filter((t) => t.text.toLowerCase() === markedTerm) ?? [], + terms.terms?.filter((t) => t.text.toLowerCase() === markedTerm) ?? + [], ); } } @@ -115,9 +116,7 @@ function InnerOriginalString({ return (

- - {source} - + {source}

); } diff --git a/translate/src/modules/placeable/components/Highlight.test.js b/translate/src/modules/placeable/components/Highlight.test.js index 50ef4b96a8..dfe8e1653d 100644 --- a/translate/src/modules/placeable/components/Highlight.test.js +++ b/translate/src/modules/placeable/components/Highlight.test.js @@ -223,6 +223,8 @@ describe('specific marker', () => { ['10 % complete', '10'], ['There were % d cows'], ['There were %(number) 3d cows'], + ['Verified by %@', '%@'], + ['Update login %1$@ for %2$@?', '%1$@', '%2$@'], // Qt ['Hello, %1', '%1'], ['Hello, %99', '%99'], diff --git a/translate/src/modules/placeable/components/Highlight.tsx b/translate/src/modules/placeable/components/Highlight.tsx index f8e4cff886..93fc2d8979 100644 --- a/translate/src/modules/placeable/components/Highlight.tsx +++ b/translate/src/modules/placeable/components/Highlight.tsx @@ -117,7 +117,6 @@ export function Highlight({ }); } - for (const { l10nId, re } of [ { l10nId: 'term-email', re: /(?:mailto:)?\w[\w.-]*@\w[\w.]*\w/g }, { l10nId: 'term-number', re: /[-+]?\d+(?:[\u00A0.,]\d+)*\b/gu },