mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-21 22:07:59 -05:00
feat: translations support
This commit is contained in:
@@ -3,13 +3,14 @@ import { ApiUrlConsumer } from '../utils/contexts/';
|
||||
import { MediaListWrapper } from '../components/MediaListWrapper';
|
||||
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync.jsx';
|
||||
import { Page } from './Page';
|
||||
import { translateString } from '../utils/helpers/';
|
||||
|
||||
interface CategoriesPageProps {
|
||||
id?: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export const CategoriesPage: React.FC<CategoriesPageProps> = ({ id = 'categories', title = 'Categories' }) => (
|
||||
export const CategoriesPage: React.FC<CategoriesPageProps> = ({ id = 'categories', title = translateString('Categories') }) => (
|
||||
<Page id={id}>
|
||||
<ApiUrlConsumer>
|
||||
{(apiUrl) => (
|
||||
|
||||
@@ -4,6 +4,7 @@ import { PageStore } from '../utils/stores/';
|
||||
import { MediaListWrapper } from '../components/MediaListWrapper';
|
||||
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync.jsx';
|
||||
import { Page } from './Page';
|
||||
import { translateString } from '../utils/helpers/';
|
||||
|
||||
interface FeaturedMediaPageProps {
|
||||
id?: string;
|
||||
@@ -12,7 +13,7 @@ interface FeaturedMediaPageProps {
|
||||
|
||||
export const FeaturedMediaPage: React.FC<FeaturedMediaPageProps> = ({
|
||||
id = 'featured-media',
|
||||
title = PageStore.get('config-enabled').pages.featured.title,
|
||||
title = translateString('Featured'),
|
||||
}) => (
|
||||
<Page id={id}>
|
||||
<ApiUrlConsumer>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { MediaListWrapper } from '../components/MediaListWrapper';
|
||||
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync.jsx';
|
||||
import { ProfileHistoryPage } from './ProfileHistoryPage';
|
||||
import { Page } from './Page';
|
||||
import { translateString } from '../utils/helpers/';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -21,7 +22,7 @@ interface AnonymousHistoryPageProps {
|
||||
|
||||
export const AnonymousHistoryPage: React.FC<AnonymousHistoryPageProps> = ({
|
||||
id = 'history-media',
|
||||
title = PageStore.get('config-enabled').pages.history.title,
|
||||
title = translateString('History'),
|
||||
}) => {
|
||||
const [resultsCount, setResultsCount] = useState<number | null>(null);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { MediaMultiListWrapper } from '../components/MediaMultiListWrapper';
|
||||
import { ItemListAsync } from '../components/item-list/ItemListAsync.jsx';
|
||||
import { InlineSliderItemListAsync } from '../components/item-list/InlineSliderItemListAsync.jsx';
|
||||
import { Page } from './Page';
|
||||
import { translateString } from '../utils/helpers/';
|
||||
|
||||
const EmptyMedia: React.FC = ({}) => {
|
||||
return (
|
||||
@@ -35,9 +36,12 @@ interface HomePageProps {
|
||||
|
||||
export const HomePage: React.FC<HomePageProps> = ({
|
||||
id = 'home',
|
||||
featured_title = PageStore.get('config-options').pages.home.sections.featured.title,
|
||||
recommended_title = PageStore.get('config-options').pages.home.sections.recommended.title,
|
||||
latest_title = PageStore.get('config-options').pages.home.sections.latest.title,
|
||||
//featured_title = PageStore.get('config-options').pages.home.sections.featured.title,
|
||||
//recommended_title = PageStore.get('config-options').pages.home.sections.recommended.title,
|
||||
//latest_title = PageStore.get('config-options').pages.home.sections.latest.title,
|
||||
featured_title = translateString('Featured'),
|
||||
recommended_title = translateString('Recommended'),
|
||||
latest_title = translateString('Latest'),
|
||||
latest_view_all_link = false,
|
||||
featured_view_all_link = true,
|
||||
recommended_view_all_link = true,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { PageStore } from '../utils/stores/';
|
||||
import { MediaListWrapper } from '../components/MediaListWrapper';
|
||||
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync';
|
||||
import { Page } from './Page';
|
||||
import { translateString } from '../utils/helpers/';
|
||||
|
||||
interface LatestMediaPageProps {
|
||||
id?: string;
|
||||
@@ -12,7 +13,7 @@ interface LatestMediaPageProps {
|
||||
|
||||
export const LatestMediaPage: React.FC<LatestMediaPageProps> = ({
|
||||
id = 'latest-media',
|
||||
title = PageStore.get('config-enabled').pages.latest.title,
|
||||
title = translateString('Recent uploads'),
|
||||
}) => (
|
||||
<Page id={id}>
|
||||
<ApiUrlConsumer>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { MediaListWrapper } from '../components/MediaListWrapper';
|
||||
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync';
|
||||
import { ProfileLikedPage } from './ProfileLikedPage';
|
||||
import { Page } from './Page';
|
||||
import { translateString } from '../utils/helpers/';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -21,7 +22,7 @@ interface AnonymousLikedMediaPageProps {
|
||||
|
||||
export const AnonymousLikedMediaPage: React.FC<AnonymousLikedMediaPageProps> = ({
|
||||
id = 'liked-media',
|
||||
title = PageStore.get('config-enabled').pages.liked.title,
|
||||
title = translateString('Liked media'),
|
||||
}) => {
|
||||
const [resultsCount, setResultsCount] = useState<number | null>(null);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { PageStore } from '../utils/stores/';
|
||||
import { MediaListWrapper } from '../components/MediaListWrapper';
|
||||
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync.jsx';
|
||||
import { Page } from './Page';
|
||||
import { translateString } from '../utils/helpers/';
|
||||
|
||||
interface RecommendedMediaPageProps {
|
||||
id?: string;
|
||||
@@ -12,7 +13,7 @@ interface RecommendedMediaPageProps {
|
||||
|
||||
export const RecommendedMediaPage: React.FC<RecommendedMediaPageProps> = ({
|
||||
id = 'recommended-media',
|
||||
title = PageStore.get('config-enabled').pages.recommended.title,
|
||||
title = translateString('Recommended'),
|
||||
}) => (
|
||||
<Page id={id}>
|
||||
<ApiUrlConsumer>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListA
|
||||
import { SearchMediaFiltersRow } from '../components/search-filters/SearchMediaFiltersRow';
|
||||
import { SearchResultsFilters } from '../components/search-filters/SearchResultsFilters';
|
||||
import { Page } from './_Page';
|
||||
import { translateString } from '../utils/helpers/';
|
||||
|
||||
export class SearchPage extends Page {
|
||||
constructor(props) {
|
||||
@@ -114,13 +115,13 @@ export class SearchPage extends Page {
|
||||
} else {
|
||||
if (this.state.searchCategories) {
|
||||
title = null === this.state.resultsCount || 0 === this.state.resultsCount ? 'No' : this.state.resultsCount;
|
||||
title += ' media in category "' + this.state.searchCategories + '"';
|
||||
title += ' ' + translateString('media in category') + ' "' + this.state.searchCategories + '"';
|
||||
} else if (this.state.searchTags) {
|
||||
title = null === this.state.resultsCount || 0 === this.state.resultsCount ? 'No' : this.state.resultsCount;
|
||||
title += ' media in tag "' + this.state.searchTags + '"';
|
||||
title += ' ' + translateString('media in tag') + ' "' + this.state.searchTags + '"';
|
||||
} else {
|
||||
if (null === this.state.resultsCount || 0 === this.state.resultsCount) {
|
||||
title = 'No results for "' + this.state.searchQuery + '"';
|
||||
title = translateString('No results for') + ' "' + this.state.searchQuery + '"';
|
||||
} else {
|
||||
title =
|
||||
this.state.resultsCount +
|
||||
|
||||
@@ -3,13 +3,14 @@ import { ApiUrlConsumer } from '../utils/contexts/';
|
||||
import { MediaListWrapper } from '../components/MediaListWrapper';
|
||||
import { LazyLoadItemListAsync } from '../components/item-list/LazyLoadItemListAsync.jsx';
|
||||
import { Page } from './Page';
|
||||
import { translateString } from '../utils/helpers/';
|
||||
|
||||
interface TagsPageProps {
|
||||
id?: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export const TagsPage: React.FC<TagsPageProps> = ({ id = 'tags', title = 'Tags' }) => (
|
||||
export const TagsPage: React.FC<TagsPageProps> = ({ id = 'tags', title = translateString('Tags') }) => (
|
||||
<Page id={id}>
|
||||
<ApiUrlConsumer>
|
||||
{(apiUrl) => (
|
||||
|
||||
Reference in New Issue
Block a user