Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved translations for English and Russian versions. #760

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"smartPlaylist": "smart $t(entity.playlist_one)",
"track_one": "track",
"track_other": "tracks",
"song_many": "{{ count }} songs",
"trackWithCount_one": "{{count}} track",
"trackWithCount_other": "{{count}} tracks"
},
Expand Down Expand Up @@ -315,6 +316,14 @@
"settings": "$t(common.setting_other)",
"version": "version {{version}}"
},
"manageServers": {
"title": "manage servers",
"serverDetails": "server details",
"url": "URL",
"username": "username",
"editServerDetailsTooltip": "edit server details",
"removeServer": "remove server"
},
"contextMenu": {
"addFavorite": "$t(action.addToFavorites)",
"addLast": "$t(player.addLast)",
Expand Down Expand Up @@ -345,6 +354,7 @@
"dynamicIsImage": "enable background image",
"followCurrentLyric": "follow current lyric",
"lyricAlignment": "lyric alignment",
"lyricOffset": "lyrics offset (ms)",
"lyricGap": "lyric gap",
"lyricSize": "lyric size",
"opacity": "opacity",
Expand All @@ -357,7 +367,8 @@
"lyrics": "lyrics",
"related": "related",
"upNext": "up next",
"visualizer": "visualizer"
"visualizer": "visualizer",
"noLyrics": "no lyrics found"
},
"genreList": {
"showAlbums": "show $t(entity.genre_one) $t(entity.album_other)",
Expand Down Expand Up @@ -449,7 +460,8 @@
"stop": "stop",
"toggleFullscreenPlayer": "toggle fullscreen player",
"unfavorite": "unfavorite",
"pause": "pause"
"pause": "pause",
"viewQueue": "view queue"
},
"setting": {
"accentColor": "accent color",
Expand Down Expand Up @@ -706,6 +718,7 @@
"config": {
"general": {
"autoFitColumns": "auto fit columns",
"followCurrentSong": "follow current song",
"displayType": "display type",
"gap": "$t(common.gap)",
"itemGap": "item gap (px)",
Expand Down
239 changes: 151 additions & 88 deletions src/i18n/locales/ru.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/renderer/components/feature-carousel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ export const FeatureCarousel = ({ data }: FeatureCarouselProps) => {
</Badge>
))}
<Badge size="lg">{currentItem?.releaseYear}</Badge>
<Badge size="lg">{currentItem?.songCount} tracks</Badge>
<Badge size="lg">
{t('entity.trackWithCount', {
count: currentItem?.songCount || 0,
})}
</Badge>
</Group>
<Group position="apart">
<Button
Expand Down
12 changes: 10 additions & 2 deletions src/renderer/components/virtual-table/table-config-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useSettingsStoreActions, useSettingsStore } from '/@/renderer/store/set
import { TableColumn, TableType } from '/@/renderer/types';
import { Option } from '/@/renderer/components/option';
import i18n from '/@/i18n/i18n';
import { useTranslation } from 'react-i18next';

export const SONG_TABLE_COLUMNS = [
{
Expand Down Expand Up @@ -285,6 +286,7 @@ interface TableConfigDropdownProps {
}

export const TableConfigDropdown = ({ type }: TableConfigDropdownProps) => {
const { t } = useTranslation();
const { setSettings } = useSettingsStoreActions();
const tableConfig = useSettingsStore((state) => state.tables);

Expand Down Expand Up @@ -374,7 +376,9 @@ export const TableConfigDropdown = ({ type }: TableConfigDropdownProps) => {
return (
<>
<Option>
<Option.Label>Auto-fit Columns</Option.Label>
<Option.Label>
{t('table.config.general.autoFitColumns', { postProcess: 'sentenceCase' })}
</Option.Label>
<Option.Control>
<Switch
defaultChecked={tableConfig[type]?.autoFit}
Expand All @@ -384,7 +388,11 @@ export const TableConfigDropdown = ({ type }: TableConfigDropdownProps) => {
</Option>
{type !== 'albumDetail' && (
<Option>
<Option.Label>Follow current song</Option.Label>
<Option.Label>
{t('table.config.general.followCurrentSong', {
postProcess: 'sentenceCase',
})}
</Option.Label>
<Option.Control>
<Switch
defaultChecked={tableConfig[type]?.followCurrentSong}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ActionRequiredRoute = () => {
const handleManageServersModal = () => {
openModal({
children: <ServerList />,
title: 'Manage Servers',
title: t('page.appMenu.manageServers', { postProcess: 'sentenceCase' }),
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export const AlbumDetailHeader = forwardRef(
},
{
id: 'songCount',
value: `${detailQuery?.data?.songCount} songs`,
value: t('entity.song_many', {
count: detailQuery?.data?.songCount as number,
}),
},
{
id: 'duration',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ export const AlbumListHeaderFilters = ({ gridRef, tableRef }: AlbumListHeaderFil
},
}}
tooltip={{
label: t('common.filter', { count: 2, postProcess: 'sentenceCase' }),
label: t('common.filters', { count: 2, postProcess: 'sentenceCase' }),
}}
variant="subtle"
onClick={handleOpenFiltersModal}
Expand Down Expand Up @@ -514,7 +514,9 @@ export const AlbumListHeaderFilters = ({ gridRef, tableRef }: AlbumListHeaderFil
</Button>
</DropdownMenu.Target>
<DropdownMenu.Dropdown>
<DropdownMenu.Label>Display type</DropdownMenu.Label>
<DropdownMenu.Label>
{t('table.config.general.displayType', { postProcess: 'sentenceCase' })}
</DropdownMenu.Label>
<DropdownMenu.Item
$isActive={display === ListDisplayType.CARD}
value={ListDisplayType.CARD}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,9 @@ export const AlbumArtistListHeaderFilters = ({
icon={<RiRefreshLine />}
onClick={handleRefresh}
>
Refresh
{t('common.refresh', {
postProcess: 'titleCase',
})}
</DropdownMenu.Item>
</DropdownMenu.Dropdown>
</DropdownMenu>
Expand All @@ -436,7 +438,9 @@ export const AlbumArtistListHeaderFilters = ({
</Button>
</DropdownMenu.Target>
<DropdownMenu.Dropdown>
<DropdownMenu.Label>Display type</DropdownMenu.Label>
<DropdownMenu.Label>
{t('table.config.general.displayType', { postProcess: 'sentenceCase' })}
</DropdownMenu.Label>
<DropdownMenu.Item
$isActive={display === ListDisplayType.CARD}
value={ListDisplayType.CARD}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
},
],
id: 'setRating',
label: 'Set rating',
label: t('action.setRating', { postProcess: 'sentenceCase' }),
leftIcon: <RiStarFill size="1.1rem" />,
onClick: () => {},
rightIcon: <RiArrowRightSFill size="1.2rem" />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export const GenreListHeaderFilters = ({ gridRef, tableRef }: GenreListHeaderFil
</DropdownMenu.Target>
<DropdownMenu.Dropdown>
<DropdownMenu.Label>
{t('table.config.general.displayType', { postProcess: 'titleCase' })}
{t('table.config.general.displayType', { postProcess: 'sentenceCase' })}
</DropdownMenu.Label>
<DropdownMenu.Item
$isActive={display === ListDisplayType.CARD}
Expand Down Expand Up @@ -404,7 +404,11 @@ export const GenreListHeaderFilters = ({ gridRef, tableRef }: GenreListHeaderFil
</DropdownMenu.Item>
{isGrid && (
<>
<DropdownMenu.Label>Item gap</DropdownMenu.Label>
<DropdownMenu.Label>
{t('table.config.general.itemGap', {
postProcess: 'sentenceCase',
})}
</DropdownMenu.Label>
<DropdownMenu.Item closeMenuOnClick={false}>
<Slider
defaultValue={grid?.itemGap || 0}
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/features/lyrics/lyrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
import { Center, Group } from '@mantine/core';
import { AnimatePresence, motion } from 'framer-motion';
import { ErrorBoundary } from 'react-error-boundary';
import { useTranslation } from 'react-i18next';
import { RiInformationFill } from 'react-icons/ri';
import styled from 'styled-components';
import { useSongLyricsByRemoteId, useSongLyricsBySong } from './queries/lyric-query';
Expand Down Expand Up @@ -86,6 +87,7 @@ const ScrollContainer = styled(motion.div)`
export const Lyrics = () => {
const currentSong = useCurrentSong();
const lyricsSettings = useLyricsSettings();
const { t } = useTranslation();
const [index, setIndex] = useState(0);
const [translatedLyrics, setTranslatedLyrics] = useState<string | null>(null);
const [showTranslation, setShowTranslation] = useState(false);
Expand Down Expand Up @@ -217,7 +219,9 @@ export const Lyrics = () => {
order={3}
weight={700}
>
No lyrics found
{t('page.fullscreenPlayer.noLyrics', {
postProcess: 'sentenceCase',
})}
</TextTitle>
</Group>
</Center>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const FullScreenPlayerQueue = () => {
items.push({
active: activeTab === 'visualizer',
icon: <RiFileTextLine size="1.5rem" />,
label: t('page.fullscreenPlayer.visualizer'),
label: t('page.fullscreenPlayer.visualizer', { postProcess: 'titleCase' }),
onClick: () => setStore({ activeTab: 'visualizer' }),
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,11 @@ const Controls = () => {
</Option.Control>
</Option>
<Option>
<Option.Label>Lyrics offset (ms)</Option.Label>
<Option.Label>
{t('page.fullscreenPlayer.config.lyricOffset', {
postProcess: 'sentenceCase',
})}
</Option.Label>
<Option.Control>
<NumberInput
defaultValue={lyricConfig.delayMs}
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/features/player/components/right-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ export const RightControls = () => {
{!isMinWidth ? (
<PlayerButton
icon={<HiOutlineQueueList size="1.1rem" />}
tooltip={{ label: 'View queue', openDelay: 500 }}
tooltip={{
label: t('player.viewQueue', { postProcess: 'titleCase' }),
openDelay: 500,
}}
variant="secondary"
onClick={handleToggleQueue}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,9 @@ export const PlaylistDetailSongListHeaderFilters = ({
</Button>
</DropdownMenu.Target>
<DropdownMenu.Dropdown>
<DropdownMenu.Label>Display type</DropdownMenu.Label>
<DropdownMenu.Label>
{t('table.config.general.displayType', { postProcess: 'sentenceCase' })}
</DropdownMenu.Label>
<DropdownMenu.Item
$isActive={page.display === ListDisplayType.TABLE}
value={ListDisplayType.TABLE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export const PlaylistListHeaderFilters = ({
</DropdownMenu.Target>
<DropdownMenu.Dropdown>
<DropdownMenu.Label>
{t('table.config.general.displayType', { postProcess: 'titleCase' })}
{t('table.config.general.displayType', { postProcess: 'sentenceCase' })}
</DropdownMenu.Label>
<DropdownMenu.Item
$isActive={display === ListDisplayType.CARD}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,11 @@ export const PlaylistQueryBuilder = forwardRef(
<Select
data={[
{
label: t('common.ascending', { postProcess: 'titleCase' }),
label: t('common.ascending', { postProcess: 'sentenceCase' }),
value: 'asc',
},
{
label: t('common.descending', { postProcess: 'titleCase' }),
label: t('common.descending', { postProcess: 'sentenceCase' }),
value: 'desc',
},
]}
Expand Down
30 changes: 24 additions & 6 deletions src/renderer/features/servers/components/server-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Stack, Group, Divider } from '@mantine/core';
import { Button, Text, TimeoutButton } from '/@/renderer/components';
import { useDisclosure } from '@mantine/hooks';
import isElectron from 'is-electron';
import { useTranslation } from 'react-i18next';
import { RiDeleteBin2Line, RiEdit2Fill } from 'react-icons/ri';
import { EditServerForm } from '/@/renderer/features/servers/components/edit-server-form';
import { ServerSection } from '/@/renderer/features/servers/components/server-section';
Expand All @@ -16,6 +17,7 @@ interface ServerListItemProps {
}

export const ServerListItem = ({ server }: ServerListItemProps) => {
const { t } = useTranslation();
const [edit, editHandlers] = useDisclosure(false);
const [savedPassword, setSavedPassword] = useState('');
const { deleteServer } = useAuthStoreActions();
Expand Down Expand Up @@ -54,7 +56,11 @@ export const ServerListItem = ({ server }: ServerListItemProps) => {
<ServerSection
title={
<Group position="apart">
<Text>Server details</Text>
<Text>
{t('page.manageServers.serverDetails', {
postProcess: 'sentenceCase',
})}
</Text>
</Group>
}
>
Expand All @@ -68,8 +74,16 @@ export const ServerListItem = ({ server }: ServerListItemProps) => {
<Stack>
<Group noWrap>
<Stack>
<Text>URL</Text>
<Text>Username</Text>
<Text>
{t('page.manageServers.url', {
postProcess: 'sentenceCase',
})}
</Text>
<Text>
{t('page.manageServers.username', {
postProcess: 'sentenceCase',
})}
</Text>
</Stack>
<Stack>
<Text>{server.url}</Text>
Expand All @@ -79,11 +93,15 @@ export const ServerListItem = ({ server }: ServerListItemProps) => {
<Group grow>
<Button
leftIcon={<RiEdit2Fill />}
tooltip={{ label: 'Edit server details' }}
tooltip={{
label: t('page.manageServers.editServerDetailsTooltip', {
postProcess: 'sentenceCase',
}),
}}
variant="subtle"
onClick={() => handleEdit()}
>
Edit
{t('common.edit')}
</Button>
</Group>
</Stack>
Expand All @@ -95,7 +113,7 @@ export const ServerListItem = ({ server }: ServerListItemProps) => {
timeoutProps={{ callback: handleDeleteServer, duration: 1000 }}
variant="subtle"
>
Remove server
{t('page.manageServers.removeServer', { postProcess: 'sentenceCase' })}
</TimeoutButton>
</Stack>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const OrderToggleButton = ({ sortOrder, onToggle, buttonProps }: OrderTog
<Tooltip
label={
sortOrder === SortOrder.ASC
? t('common.ascending', { postProcess: 'titleCase' })
: t('common.descending', { postProcess: 'titleCase' })
? t('common.ascending', { postProcess: 'sentenceCase' })
: t('common.descending', { postProcess: 'sentenceCase' })
}
>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ export const SongListHeaderFilters = ({ gridRef, tableRef }: SongListHeaderFilte
icon={<RiRefreshLine />}
onClick={handleRefresh}
>
Refresh
{t('common.refresh', { postProcess: 'titleCase' })}
</DropdownMenu.Item>
</DropdownMenu.Dropdown>
</DropdownMenu>
Expand Down
Loading
Loading