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",
"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..",

View file

@ -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) {
>
<div className="menu__link">
<Icon aria-hidden icon={hasClaimInCustom ? ICONS.DELETE : ICONS.STAR} />
{hasClaimInCustom ? __(`In ${lastCollectionName}`) : __(`${lastCollectionName}`)}
{hasClaimInCustom
? __('In %lastCollectionName%', { lastCollectionName })
: __(`${lastCollectionName}`)}
</div>
</MenuItem>
)}

View file

@ -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)}
/>
);