Skip to content

Commit

Permalink
fix: [DHIS-8998] unspllit and escape translatable strings
Browse files Browse the repository at this point in the history
  • Loading branch information
simonadomnisoru authored May 3, 2021
1 parent b8c63c0 commit 475b27d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
13 changes: 8 additions & 5 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down Expand Up @@ -198,7 +198,7 @@ msgstr ""
msgid "No write access"
msgstr ""

msgid "New"
msgid "New {{titleText}}"
msgstr ""

msgid "Switch to form view"
Expand Down Expand Up @@ -498,6 +498,9 @@ msgstr ""
msgid "Selected program is invalid for selected registering unit"
msgstr ""

msgid "New"
msgstr ""

msgid "New {{trackedEntityName}} in {{programName}}"
msgstr ""

Expand Down Expand Up @@ -769,7 +772,7 @@ msgstr ""
msgid "Back"
msgstr ""

msgid "Search for "
msgid "Search for {{titleText}}"
msgstr ""

msgid "Search for"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ const NewEventDataEntryWrapperPlain = ({
return (
<Paper className={classes.paper}>
<div className={classes.title} >
${i18n.t('New')} {titleText}
{i18n.t('New {{titleText}}', {
titleText,
interpolation: { escapeValue: false },
})}
</div>

<div className={classes.flexContainer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ const RegistrationDataEntryPlain = ({
scopeType === scopeTypes.TRACKER_PROGRAM &&
<Paper className={classes.paper}>
<div className={classes.title} >
{i18n.t('New')} {titleText}
{i18n.t('New {{titleText}}', {
titleText,
interpolation: { escapeValue: false },
})}
</div>

<div className={classes.registrationContainer}>
Expand Down Expand Up @@ -166,7 +169,10 @@ const RegistrationDataEntryPlain = ({
scopeType === scopeTypes.TRACKED_ENTITY_TYPE &&
<Paper className={classes.paper}>
<div className={classes.title} >
{i18n.t('New')} {titleText}
{i18n.t('New {{titleText}}', {
titleText,
interpolation: { escapeValue: false },
})}
</div>

<div className={classes.tetypeContainer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const Index = ({
<Paper className={classes.paper}>
<div className={classes.maxWidth}>
<div className={classes.title} >
{i18n.t('Search for ')} {titleText}
{i18n.t('Search for {{titleText}}', { titleText, interpolation: { escapeValue: false } })}
</div>
{
(selectedSearchScopeType !== searchScopes.PROGRAM) &&
Expand Down
11 changes: 8 additions & 3 deletions src/core_modules/capture-core/hooks/useScopeTitleText.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] : '';
Expand Down

0 comments on commit 475b27d

Please sign in to comment.