From 475b27d142c52672efe9a7b399fb92342bcc1837 Mon Sep 17 00:00:00 2001 From: Simona Domnisoru Date: Mon, 3 May 2021 08:07:36 +0200 Subject: [PATCH] fix: [DHIS-8998] unspllit and escape translatable strings --- i18n/en.pot | 13 ++++++++----- .../NewEventDataEntryWrapper.component.js | 5 ++++- .../RegistrationDataEntry.component.js | 10 ++++++++-- .../components/Pages/Search/SearchPage.component.js | 2 +- .../capture-core/hooks/useScopeTitleText.js | 11 ++++++++--- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/i18n/en.pot b/i18n/en.pot index c4b40c6095..9663ada829 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2021-04-26T09:11:58.819Z\n" -"PO-Revision-Date: 2021-04-26T09:11:58.819Z\n" +"POT-Creation-Date: 2021-04-30T12:14:22.957Z\n" +"PO-Revision-Date: 2021-04-30T12:14:22.957Z\n" msgid "Choose one or more dates..." msgstr "" @@ -198,7 +198,7 @@ msgstr "" msgid "No write access" msgstr "" -msgid "New" +msgid "New {{titleText}}" msgstr "" msgid "Switch to form view" @@ -498,6 +498,9 @@ msgstr "" msgid "Selected program is invalid for selected registering unit" msgstr "" +msgid "New" +msgstr "" + msgid "New {{trackedEntityName}} in {{programName}}" msgstr "" @@ -769,7 +772,7 @@ msgstr "" msgid "Back" msgstr "" -msgid "Search for " +msgid "Search for {{titleText}}" msgstr "" msgid "Search for" @@ -896,7 +899,7 @@ msgstr "" msgid "An error has occured. See log for details" msgstr "" -msgid "{{trackedEntityName}} in program" +msgid "{{trackedEntityName}} in program{{escape}} {{programName}}" msgstr "" msgid "Program not found" diff --git a/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/DataEntryWrapper/NewEventDataEntryWrapper.component.js b/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/DataEntryWrapper/NewEventDataEntryWrapper.component.js index 172f3d1b27..99036c5c94 100644 --- a/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/DataEntryWrapper/NewEventDataEntryWrapper.component.js +++ b/src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/DataEntryWrapper/NewEventDataEntryWrapper.component.js @@ -55,7 +55,10 @@ const NewEventDataEntryWrapperPlain = ({ return (
- ${i18n.t('New')} {titleText} + {i18n.t('New {{titleText}}', { + titleText, + interpolation: { escapeValue: false }, + })}
diff --git a/src/core_modules/capture-core/components/Pages/New/RegistrationDataEntry/RegistrationDataEntry.component.js b/src/core_modules/capture-core/components/Pages/New/RegistrationDataEntry/RegistrationDataEntry.component.js index 827e0e4abc..4d1619c4ed 100644 --- a/src/core_modules/capture-core/components/Pages/New/RegistrationDataEntry/RegistrationDataEntry.component.js +++ b/src/core_modules/capture-core/components/Pages/New/RegistrationDataEntry/RegistrationDataEntry.component.js @@ -129,7 +129,10 @@ const RegistrationDataEntryPlain = ({ scopeType === scopeTypes.TRACKER_PROGRAM &&
- {i18n.t('New')} {titleText} + {i18n.t('New {{titleText}}', { + titleText, + interpolation: { escapeValue: false }, + })}
@@ -166,7 +169,10 @@ const RegistrationDataEntryPlain = ({ scopeType === scopeTypes.TRACKED_ENTITY_TYPE &&
- {i18n.t('New')} {titleText} + {i18n.t('New {{titleText}}', { + titleText, + interpolation: { escapeValue: false }, + })}
diff --git a/src/core_modules/capture-core/components/Pages/Search/SearchPage.component.js b/src/core_modules/capture-core/components/Pages/Search/SearchPage.component.js index b8d043eb88..7953ed9cb4 100644 --- a/src/core_modules/capture-core/components/Pages/Search/SearchPage.component.js +++ b/src/core_modules/capture-core/components/Pages/Search/SearchPage.component.js @@ -149,7 +149,7 @@ const Index = ({
- {i18n.t('Search for ')} {titleText} + {i18n.t('Search for {{titleText}}', { titleText, interpolation: { escapeValue: false } })}
{ (selectedSearchScopeType !== searchScopes.PROGRAM) && diff --git a/src/core_modules/capture-core/hooks/useScopeTitleText.js b/src/core_modules/capture-core/hooks/useScopeTitleText.js index 09b7befc6b..9dc05aea7f 100644 --- a/src/core_modules/capture-core/hooks/useScopeTitleText.js +++ b/src/core_modules/capture-core/hooks/useScopeTitleText.js @@ -7,10 +7,15 @@ export const useScopeTitleText = (scopeId: ?string) => { const { trackedEntityName, programName, scopeType } = useScopeInfo(scopeId); const text = { - [scopeTypes.EVENT_PROGRAM]: `${programName}`, + [scopeTypes.EVENT_PROGRAM]: programName, [scopeTypes.TRACKER_PROGRAM]: - `${i18n.t('{{trackedEntityName}} in program', { trackedEntityName })}: ${programName}`, - [scopeTypes.TRACKED_ENTITY_TYPE]: `${trackedEntityName}`, + i18n.t('{{trackedEntityName}} in program{{escape}} {{programName}}', { + trackedEntityName, + escape: ':', + programName, + interpolation: { escapeValue: false }, + }), + [scopeTypes.TRACKED_ENTITY_TYPE]: trackedEntityName, }; return scopeType ? text[scopeType] : '';