i18n: Fix invalid template literal use + split strings

This commit is contained in:
infinite-persistence 2021-07-18 22:39:43 +08:00
parent abe32e5f5c
commit f3ed597ff6
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
3 changed files with 23 additions and 22 deletions

View file

@ -2014,11 +2014,16 @@
"Chat": "Chat", "Chat": "Chat",
"Tipped": "Tipped", "Tipped": "Tipped",
"Fromage": "Fromage", "Fromage": "Fromage",
"Item %action% Watch Later": "Item %action% Watch Later", "In Favorites": "In Favorites",
"added to --[substring for \"Item %action% Watch Later\"]--": "added to",
"removed from --[substring for \"Item %action% Watch Later\"]--": "removed from",
"In Watch Later": "In Watch Later", "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 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", "Your publish is being confirmed and will be live soon": "Your publish is being confirmed and will be live soon",
"Clear Edits": "Clear Edits", "Clear Edits": "Clear Edits",
"Something not quite right..": "Something not quite right..", "Something not quite right..": "Something not quite right..",

View file

@ -234,11 +234,9 @@ function ClaimMenuList(props: Props) {
className="comment__menu-option" className="comment__menu-option"
onSelect={() => { onSelect={() => {
doToast({ doToast({
message: __('Item %action% Watch Later', { message: hasClaimInWatchLater
action: hasClaimInWatchLater ? __('Item removed from Watch Later')
? __('removed from --[substring for "Item %action% Watch Later"]--') : __('Item added to Watch Later'),
: __('added to --[substring for "Item %action% Watch Later"]--'),
}),
}); });
doCollectionEdit(COLLECTIONS_CONSTS.WATCH_LATER_ID, { doCollectionEdit(COLLECTIONS_CONSTS.WATCH_LATER_ID, {
claims: [contentClaim], claims: [contentClaim],
@ -259,9 +257,9 @@ function ClaimMenuList(props: Props) {
className="comment__menu-option" className="comment__menu-option"
onSelect={() => { onSelect={() => {
doToast({ doToast({
message: __(`Item %action% ${lastCollectionName}`, { message: hasClaimInCustom
action: hasClaimInCustom ? __('removed from') : __('added to'), ? __('Item removed from %lastCollectionName%', { lastCollectionName })
}), : __('Item added to %lastCollectionName%', { lastCollectionName }),
}); });
doCollectionEdit(COLLECTIONS_CONSTS.FAVORITES_ID, { doCollectionEdit(COLLECTIONS_CONSTS.FAVORITES_ID, {
claims: [contentClaim], claims: [contentClaim],
@ -272,7 +270,9 @@ function ClaimMenuList(props: Props) {
> >
<div className="menu__link"> <div className="menu__link">
<Icon aria-hidden icon={hasClaimInCustom ? ICONS.DELETE : ICONS.STAR} /> <Icon aria-hidden icon={hasClaimInCustom ? ICONS.DELETE : ICONS.STAR} />
{hasClaimInCustom ? __(`In ${lastCollectionName}`) : __(`${lastCollectionName}`)} {hasClaimInCustom
? __('In %lastCollectionName%', { lastCollectionName })
: __(`${lastCollectionName}`)}
</div> </div>
</MenuItem> </MenuItem>
)} )}

View file

@ -14,12 +14,7 @@ type Props = {
}; };
function FileWatchLaterLink(props: Props) { function FileWatchLaterLink(props: Props) {
const { const { claim, hasClaimInWatchLater, doToast, doCollectionEdit } = props;
claim,
hasClaimInWatchLater,
doToast,
doCollectionEdit,
} = props;
const buttonRef = useRef(); const buttonRef = useRef();
let isHovering = useHover(buttonRef); let isHovering = useHover(buttonRef);
@ -30,9 +25,7 @@ function FileWatchLaterLink(props: Props) {
function handleWatchLater(e) { function handleWatchLater(e) {
e.preventDefault(); e.preventDefault();
doToast({ doToast({
message: __('Item %action% Watch Later', { message: hasClaimInWatchLater ? __('Item removed from Watch Later') : __('Item added to Watch Later'),
action: hasClaimInWatchLater ? __('removed from') : __('added to'),
}),
linkText: !hasClaimInWatchLater && __('See All'), linkText: !hasClaimInWatchLater && __('See All'),
linkTarget: !hasClaimInWatchLater && '/list/watchlater', linkTarget: !hasClaimInWatchLater && '/list/watchlater',
}); });
@ -53,7 +46,10 @@ function FileWatchLaterLink(props: Props) {
title={title} title={title}
label={label} label={label}
className="button--file-action" 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)} onClick={(e) => handleWatchLater(e)}
/> />
); );