From f3ed597ff672f41408d40d183c4b98d3bca48452 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Sun, 18 Jul 2021 22:39:43 +0800 Subject: [PATCH] i18n: Fix invalid template literal use + split strings --- static/app-strings.json | 11 ++++++++--- ui/component/claimMenuList/view.jsx | 18 +++++++++--------- ui/component/fileWatchLaterLink/view.jsx | 16 ++++++---------- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index d2a6511d2..339a8c504 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -2014,11 +2014,16 @@ "Chat": "Chat", "Tipped": "Tipped", "Fromage": "Fromage", - "Item %action% Watch Later": "Item %action% Watch Later", - "added to --[substring for \"Item %action% Watch Later\"]--": "added to", - "removed from --[substring for \"Item %action% Watch Later\"]--": "removed from", + "In Favorites": "In Favorites", "In Watch Later": "In Watch Later", + "In %lastCollectionName%": "In %lastCollectionName%", + "Remove from Watch Later": "Remove from Watch Later", + "Add to Watch Later": "Add to Watch Later", + "Added": "Added", "Item added to Watch Later": "Item added to Watch Later", + "Item removed from Watch Later": "Item removed from Watch Later", + "Item added to %lastCollectionName%": "Item added to %lastCollectionName%", + "Item removed from %lastCollectionName%": "Item removed from %lastCollectionName%", "Your publish is being confirmed and will be live soon": "Your publish is being confirmed and will be live soon", "Clear Edits": "Clear Edits", "Something not quite right..": "Something not quite right..", diff --git a/ui/component/claimMenuList/view.jsx b/ui/component/claimMenuList/view.jsx index 204181e4f..9d08f1e71 100644 --- a/ui/component/claimMenuList/view.jsx +++ b/ui/component/claimMenuList/view.jsx @@ -234,11 +234,9 @@ function ClaimMenuList(props: Props) { className="comment__menu-option" onSelect={() => { doToast({ - message: __('Item %action% Watch Later', { - action: hasClaimInWatchLater - ? __('removed from --[substring for "Item %action% Watch Later"]--') - : __('added to --[substring for "Item %action% Watch Later"]--'), - }), + message: hasClaimInWatchLater + ? __('Item removed from Watch Later') + : __('Item added to Watch Later'), }); doCollectionEdit(COLLECTIONS_CONSTS.WATCH_LATER_ID, { claims: [contentClaim], @@ -259,9 +257,9 @@ function ClaimMenuList(props: Props) { className="comment__menu-option" onSelect={() => { doToast({ - message: __(`Item %action% ${lastCollectionName}`, { - action: hasClaimInCustom ? __('removed from') : __('added to'), - }), + message: hasClaimInCustom + ? __('Item removed from %lastCollectionName%', { lastCollectionName }) + : __('Item added to %lastCollectionName%', { lastCollectionName }), }); doCollectionEdit(COLLECTIONS_CONSTS.FAVORITES_ID, { claims: [contentClaim], @@ -272,7 +270,9 @@ function ClaimMenuList(props: Props) { >
- {hasClaimInCustom ? __(`In ${lastCollectionName}`) : __(`${lastCollectionName}`)} + {hasClaimInCustom + ? __('In %lastCollectionName%', { lastCollectionName }) + : __(`${lastCollectionName}`)}
)} diff --git a/ui/component/fileWatchLaterLink/view.jsx b/ui/component/fileWatchLaterLink/view.jsx index daeb6d833..43001e7f6 100644 --- a/ui/component/fileWatchLaterLink/view.jsx +++ b/ui/component/fileWatchLaterLink/view.jsx @@ -14,12 +14,7 @@ type Props = { }; function FileWatchLaterLink(props: Props) { - const { - claim, - hasClaimInWatchLater, - doToast, - doCollectionEdit, - } = props; + const { claim, hasClaimInWatchLater, doToast, doCollectionEdit } = props; const buttonRef = useRef(); let isHovering = useHover(buttonRef); @@ -30,9 +25,7 @@ function FileWatchLaterLink(props: Props) { function handleWatchLater(e) { e.preventDefault(); doToast({ - message: __('Item %action% Watch Later', { - action: hasClaimInWatchLater ? __('removed from') : __('added to'), - }), + message: hasClaimInWatchLater ? __('Item removed from Watch Later') : __('Item added to Watch Later'), linkText: !hasClaimInWatchLater && __('See All'), linkTarget: !hasClaimInWatchLater && '/list/watchlater', }); @@ -53,7 +46,10 @@ function FileWatchLaterLink(props: Props) { title={title} label={label} className="button--file-action" - icon={(hasClaimInWatchLater && (isHovering ? ICONS.REMOVE : ICONS.COMPLETED)) || (isHovering ? ICONS.COMPLETED : ICONS.TIME)} + icon={ + (hasClaimInWatchLater && (isHovering ? ICONS.REMOVE : ICONS.COMPLETED)) || + (isHovering ? ICONS.COMPLETED : ICONS.TIME) + } onClick={(e) => handleWatchLater(e)} /> );