Add localization support (#333)

* Add updated i18n config and en locale
This commit is contained in:
Jeff 2023-10-30 19:22:45 -07:00 committed by GitHub
parent 11863fd4c1
commit 8430b1ec95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
90 changed files with 2679 additions and 908 deletions

View file

@ -22,6 +22,7 @@ import {
FontType,
} from '/@/renderer/types';
import { randomString } from '/@/renderer/utils';
import i18n from '/@/i18n/i18n';
const utils = isElectron() ? window.electron.utils : null;
@ -33,26 +34,61 @@ export type SidebarItemType = {
};
export const sidebarItems = [
{ disabled: true, id: 'Now Playing', label: 'Now Playing', route: AppRoute.NOW_PLAYING },
{
disabled: true,
id: 'Now Playing',
label: i18n.t('page.sidebar.nowPlaying'),
route: AppRoute.NOW_PLAYING,
},
{
disabled: true,
id: 'Search',
label: 'Search',
label: i18n.t('page.sidebar.search'),
route: generatePath(AppRoute.SEARCH, { itemType: LibraryItem.SONG }),
},
{ disabled: false, id: 'Home', label: 'Home', route: AppRoute.HOME },
{ disabled: false, id: 'Albums', label: 'Albums', route: AppRoute.LIBRARY_ALBUMS },
{ disabled: false, id: 'Tracks', label: 'Tracks', route: AppRoute.LIBRARY_SONGS },
{ disabled: false, id: 'Home', label: i18n.t('page.sidebar.home'), route: AppRoute.HOME },
{
disabled: false,
id: 'Albums',
label: i18n.t('page.sidebar.albums'),
route: AppRoute.LIBRARY_ALBUMS,
},
{
disabled: false,
id: 'Tracks',
label: i18n.t('page.sidebar.tracks'),
route: AppRoute.LIBRARY_SONGS,
},
{
disabled: false,
id: 'Artists',
label: 'Artists',
label: i18n.t('page.sidebar.artists'),
route: AppRoute.LIBRARY_ALBUM_ARTISTS,
},
{ disabled: false, id: 'Genres', label: 'Genres', route: AppRoute.LIBRARY_GENRES },
{ disabled: true, id: 'Folders', label: 'Folders', route: AppRoute.LIBRARY_FOLDERS },
{ disabled: true, id: 'Playlists', label: 'Playlists', route: AppRoute.PLAYLISTS },
{ disabled: true, id: 'Settings', label: 'Settings', route: AppRoute.SETTINGS },
{
disabled: false,
id: 'Genres',
label: i18n.t('page.sidebar.genres'),
route: AppRoute.LIBRARY_GENRES,
},
{
disabled: true,
id: 'Folders',
label: i18n.t('page.sidebar.folders'),
route: AppRoute.LIBRARY_FOLDERS,
},
{
disabled: true,
id: 'Playlists',
label: i18n.t('page.sidebar.playlists'),
route: AppRoute.PLAYLISTS,
},
{
disabled: true,
id: 'Settings',
label: i18n.t('page.sidebar.settings'),
route: AppRoute.SETTINGS,
},
];
export type PersistedTableColumn = {
@ -135,7 +171,7 @@ export interface SettingsState {
accent: string;
defaultFullPlaylist: boolean;
followSystemTheme: boolean;
language: string;
playButtonBehavior: Play;
resume: boolean;
showQueueDrawerButton: boolean;
@ -246,6 +282,7 @@ const initialState: SettingsState = {
accent: 'rgb(53, 116, 252)',
defaultFullPlaylist: true,
followSystemTheme: false,
language: 'en',
playButtonBehavior: Play.NOW,
resume: false,
showQueueDrawerButton: false,