Sidebar: add option to not localize certain strings
I think we want to keep Premium as a product name (consistent for all languages). It was popping up in the `window.new_strings` because the current code localizes every link.
This commit is contained in:
parent
2c6fb66206
commit
e21db9d58e
1 changed files with 13 additions and 11 deletions
|
@ -22,15 +22,16 @@ const touch = isTouch();
|
||||||
|
|
||||||
type SideNavLink = {
|
type SideNavLink = {
|
||||||
title: string,
|
title: string,
|
||||||
|
icon: string,
|
||||||
link?: string,
|
link?: string,
|
||||||
route?: string,
|
route?: string,
|
||||||
onClick?: () => any,
|
onClick?: () => any,
|
||||||
icon: string,
|
|
||||||
extra?: Node,
|
extra?: Node,
|
||||||
hideForUnauth?: boolean,
|
hideForUnauth?: boolean,
|
||||||
|
noI18n?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
const GO_LIVE = {
|
const GO_LIVE: SideNavLink = {
|
||||||
title: 'Go Live',
|
title: 'Go Live',
|
||||||
link: `/$/${PAGES.LIVESTREAM}`,
|
link: `/$/${PAGES.LIVESTREAM}`,
|
||||||
icon: ICONS.VIDEO,
|
icon: ICONS.VIDEO,
|
||||||
|
@ -56,7 +57,7 @@ const RECENT_FROM_FOLLOWING = {
|
||||||
icon: ICONS.SUBSCRIBE,
|
icon: ICONS.SUBSCRIBE,
|
||||||
};
|
};
|
||||||
|
|
||||||
const NOTIFICATIONS = {
|
const NOTIFICATIONS: SideNavLink = {
|
||||||
title: 'Notifications',
|
title: 'Notifications',
|
||||||
link: `/$/${PAGES.NOTIFICATIONS}`,
|
link: `/$/${PAGES.NOTIFICATIONS}`,
|
||||||
icon: ICONS.NOTIFICATION,
|
icon: ICONS.NOTIFICATION,
|
||||||
|
@ -64,32 +65,33 @@ const NOTIFICATIONS = {
|
||||||
hideForUnauth: true,
|
hideForUnauth: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const WATCH_LATER = {
|
const WATCH_LATER: SideNavLink = {
|
||||||
title: 'Watch Later',
|
title: 'Watch Later',
|
||||||
link: `/$/${PAGES.LIST}/watchlater`,
|
link: `/$/${PAGES.LIST}/watchlater`,
|
||||||
icon: ICONS.TIME,
|
icon: ICONS.TIME,
|
||||||
hideForUnauth: true,
|
hideForUnauth: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const FAVORITES = {
|
const FAVORITES: SideNavLink = {
|
||||||
title: 'Favorites',
|
title: 'Favorites',
|
||||||
link: `/$/${PAGES.LIST}/favorites`,
|
link: `/$/${PAGES.LIST}/favorites`,
|
||||||
icon: ICONS.STAR,
|
icon: ICONS.STAR,
|
||||||
hideForUnauth: true,
|
hideForUnauth: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const PLAYLISTS = {
|
const PLAYLISTS: SideNavLink = {
|
||||||
title: 'Lists',
|
title: 'Lists',
|
||||||
link: `/$/${PAGES.LISTS}`,
|
link: `/$/${PAGES.LISTS}`,
|
||||||
icon: ICONS.STACK,
|
icon: ICONS.STACK,
|
||||||
hideForUnauth: true,
|
hideForUnauth: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const PREMIUM = {
|
const PREMIUM: SideNavLink = {
|
||||||
title: 'Premium',
|
title: 'Premium',
|
||||||
link: `/$/${PAGES.ODYSEE_MEMBERSHIP}`,
|
link: `/$/${PAGES.ODYSEE_MEMBERSHIP}`,
|
||||||
icon: ICONS.UPGRADE,
|
icon: ICONS.UPGRADE,
|
||||||
hideForUnauth: true,
|
hideForUnauth: true,
|
||||||
|
noI18n: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const UNAUTH_LINKS: Array<SideNavLink> = [
|
const UNAUTH_LINKS: Array<SideNavLink> = [
|
||||||
|
@ -115,7 +117,7 @@ const UNAUTH_LINKS: Array<SideNavLink> = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const WILD_WEST = {
|
const WILD_WEST: SideNavLink = {
|
||||||
title: 'Wild West',
|
title: 'Wild West',
|
||||||
link: `/$/${PAGES.WILD_WEST}`,
|
link: `/$/${PAGES.WILD_WEST}`,
|
||||||
icon: ICONS.WILD_WEST,
|
icon: ICONS.WILD_WEST,
|
||||||
|
@ -298,7 +300,7 @@ function SideNavigation(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLink(props: SideNavLink) {
|
function getLink(props: SideNavLink) {
|
||||||
const { hideForUnauth, route, link, ...passedProps } = props;
|
const { hideForUnauth, route, link, noI18n, ...passedProps } = props;
|
||||||
const { title, icon, extra } = passedProps;
|
const { title, icon, extra } = passedProps;
|
||||||
|
|
||||||
if (hideForUnauth && !email) {
|
if (hideForUnauth && !email) {
|
||||||
|
@ -311,8 +313,8 @@ function SideNavigation(props: Props) {
|
||||||
{...passedProps}
|
{...passedProps}
|
||||||
icon={icon}
|
icon={icon}
|
||||||
navigate={route || link}
|
navigate={route || link}
|
||||||
label={__(title)}
|
label={noI18n ? title : __(title)}
|
||||||
title={__(title)}
|
title={noI18n ? title : __(title)}
|
||||||
className={classnames('navigation-link', {
|
className={classnames('navigation-link', {
|
||||||
'navigation-link--pulse': icon === ICONS.LIBRARY && pulseLibrary,
|
'navigation-link--pulse': icon === ICONS.LIBRARY && pulseLibrary,
|
||||||
'navigation-link--highlighted': icon === ICONS.NOTIFICATION && unseenCount > 0,
|
'navigation-link--highlighted': icon === ICONS.NOTIFICATION && unseenCount > 0,
|
||||||
|
|
Loading…
Reference in a new issue