Skip to content

Commit

Permalink
chore: translate remaining strings
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Jan 24, 2024
1 parent 4e7302c commit e4ffeac
Show file tree
Hide file tree
Showing 31 changed files with 1,141 additions and 900 deletions.
6 changes: 3 additions & 3 deletions src/hooks/persisted/useDownload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const downloadChapterAction = async (taskData?: TaskData) => {
Notifications.scheduleNotificationAsync({
content: {
title: chapter.name,
body: `Download failed: ${error.message}`,
body: getString('downloader.failed', { message: error.message }),
},
trigger: null,
}),
Expand All @@ -57,8 +57,8 @@ const downloadChapterAction = async (taskData?: TaskData) => {
MMKVStorage.delete(BACKGROUND_ACTION);
await Notifications.scheduleNotificationAsync({
content: {
title: 'Downloader',
body: 'Download completed',
title: getString('downloader.title'),
body: getString('downloader.completed'),
},
trigger: null,
});
Expand Down
11 changes: 9 additions & 2 deletions src/hooks/persisted/useNovel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { showToast } from '@utils/showToast';
import { useCallback } from 'react';
import { NovelDownloadFolder } from '@utils/constants/download';
import * as RNFS from 'react-native-fs';
import { getString } from '@strings/translations';

// store key: PREFIX + '_' + novel.url,

Expand Down Expand Up @@ -301,7 +302,9 @@ export const useNovel = (url: string, pluginId: string) => {
};
}),
);
showToast(`Deleted ${_chapter.name}`);
showToast(
getString('updatesScreen.deleteChapter', { name: _chapter.name }),
);
});
}
};
Expand All @@ -310,7 +313,11 @@ export const useNovel = (url: string, pluginId: string) => {
(_chaters: ChapterInfo[]) => {
if (novel) {
_deleteChapters(novel.pluginId, novel.id, _chaters).then(() => {
showToast(`Deleted ${_chaters.length} chapters`);
showToast(
getString('updatesScreen.deletedChapters', {
num: _chaters.length,
}),
);
setChapters(
chapters.map(chapter => {
if (_chaters.some(_c => _c.id === chapter.id)) {
Expand Down
4 changes: 2 additions & 2 deletions src/screens/browse/BrowseSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ const BrowseSettings = ({ navigation }: BrowseSettingsScreenProp) => {
{getString('browseScreen.discover')}
</List.SubHeader>
<SwitchItem
label="Show AniList"
label={getString('browseScreen.show.anilist')}
value={showAniList}
onPress={() => setBrowseSettings({ showAniList: !showAniList })}
theme={theme}
/>
<SwitchItem
label="Show MyAnimeList"
label={getString('browseScreen.show.myanimelist')}
value={showMyAnimeList}
onPress={() =>
setBrowseSettings({ showMyAnimeList: !showMyAnimeList })
Expand Down
5 changes: 3 additions & 2 deletions src/screens/browse/SourceNovels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useLibraryNovels } from '@screens/library/hooks/useLibrary';
import { Appbar } from '@components';
import { SourceNovelsScreenProps } from '@navigators/types';
import { NovelInfo } from '@database/types';
import { getString } from '@strings/translations';

const SourceNovels = ({ navigation, route }: SourceNovelsScreenProps) => {
const pluginId = route.params.pluginId;
Expand All @@ -30,7 +31,7 @@ const SourceNovels = ({ navigation, route }: SourceNovelsScreenProps) => {
return (
<View style={[styles.container]}>
<Appbar
title="Select Novel"
title={getString('browseScreen.selectNovel')}
handleGoBack={navigation.goBack}
theme={theme}
/>
Expand All @@ -46,7 +47,7 @@ const SourceNovels = ({ navigation, route }: SourceNovelsScreenProps) => {
textAlign: 'center',
}}
>
Your library does not have any novels from this source
{getString('browseScreen.noSource')}
</Text>
}
/>
Expand Down
20 changes: 17 additions & 3 deletions src/screens/browse/components/PluginCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ const PluginCard: React.FC<Props> = ({
onLongPress={() => {
setIsLoading(true);
updatePlugin(plugin)
.then(version => showToast(`Updated to ${version}`))
.then(version =>
showToast(getString('browseScreen.updatedTo', { version })),
)
.catch((error: Error) => showToast(error.message))
.finally(() => setIsLoading(false));
}}
Expand Down Expand Up @@ -93,11 +95,23 @@ const PluginCard: React.FC<Props> = ({
setIsLoading(true);
if (installed) {
uninstallPlugin(plugin)
.then(() => showToast(`Uninstalled ${plugin.name}`))
.then(() =>
showToast(
getString('browseScreen.uninstalledPlugin', {
name: plugin.name,
}),
),
)
.finally(() => setIsLoading(false));
} else {
installPlugin(plugin)
.then(() => showToast(`Installed ${plugin.name}`))
.then(() =>
showToast(
getString('browseScreen.installedPlugin', {
name: plugin.name,
}),
),
)
.catch((error: Error) => showToast(error.message))
.finally(() => setIsLoading(false));
}
Expand Down
5 changes: 3 additions & 2 deletions src/screens/browse/migration/Migration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useLibraryNovels } from '@screens/library/hooks/useLibrary';
import { Appbar } from '@components';
import { MigrationScreenProps } from '@navigators/types';
import { PluginItem } from '@plugins/types';
import { getString } from '@strings/translations';

const Migration = ({ navigation }: MigrationScreenProps) => {
const theme = useTheme();
Expand All @@ -33,14 +34,14 @@ const Migration = ({ navigation }: MigrationScreenProps) => {

const ListHeaderComponent = (
<Text style={[{ color: theme.onSurfaceVariant }, styles.listHeader]}>
Select a Source To Migrate From
{getString('browseScreen.migration.selectSourceDesc')}
</Text>
);

return (
<View style={[styles.container]}>
<Appbar
title="Select Source"
title={getString('browseScreen.migration.selectSource')}
handleGoBack={navigation.goBack}
theme={theme}
/>
Expand Down
8 changes: 5 additions & 3 deletions src/screens/browse/migration/MigrationNovelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const MigrationNovelList = ({

const showModal = (url: string, name: string) => {
if (inLibrary(url)) {
showToast('Novel already in library');
showToast(getString('browseScreen.migration.novelAlreadyInLibrary'));
} else {
setSelectedNovel({ url, name });
showMigrateNovelDialog();
Expand All @@ -81,7 +81,7 @@ const MigrationNovelList = ({
paddingVertical: 4,
}}
>
No results found
{getString('sourceScreen.noResultsFound')}
</Text>
}
/>
Expand All @@ -103,7 +103,9 @@ const MigrationNovelList = ({
marginBottom: 16,
}}
>
{`Migrate ${selectedNovel.url}?`}
{getString('browseScreen.migration.dialogMessage', {
url: selectedNovel.url,
})}
</Text>
<View
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MD3ThemeType } from '@theme/types';
import { ActivityIndicator, StyleSheet } from 'react-native';

import { IconButton, Menu, overlay } from 'react-native-paper';
import { getString } from '@strings/translations';

interface DownloadButtonProps {
isDownloaded: boolean;
Expand Down Expand Up @@ -39,7 +40,7 @@ export const DownloadButton: React.FC<DownloadButtonProps> = ({
>
<Menu.Item
onPress={deleteChapter}
title="Delete"
title={getString('common.delete')}
titleStyle={{ color: theme.onSurface }}
/>
</Menu>
Expand Down
5 changes: 4 additions & 1 deletion src/screens/novel/components/ChapterItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ThemeColors } from '@theme/types';
import { ChapterInfo } from '@database/types';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import dayjs from 'dayjs';
import { getString } from '@strings/translations';

interface ChapterItemProps {
isDownloading?: boolean;
Expand Down Expand Up @@ -114,7 +115,9 @@ const ChapterItem: React.FC<ChapterItemProps> = ({
]}
numberOfLines={1}
>
{showChapterTitles ? name : `Chapter ${chapNum}`}
{showChapterTitles
? name
: getString('novelScreen.chapterChapnum', { num: chapNum })}
</Text>
</Row>
<View style={styles.textRow}>
Expand Down
5 changes: 3 additions & 2 deletions src/screens/novel/components/DownloadCustomChapterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { StyleSheet, Text, View, TextInput } from 'react-native';
import { Button, IconButton, Modal, Portal } from 'react-native-paper';
import { ThemeColors } from '@theme/types';
import { ChapterInfo, NovelInfo } from '@database/types';
import { getString } from '@strings/translations';

interface DownloadCustomChapterModalProps {
theme: ThemeColors;
Expand Down Expand Up @@ -56,7 +57,7 @@ const DownloadCustomChapterModal = ({
]}
>
<Text style={[styles.modalTitle, { color: theme.onSurface }]}>
Download custom amount
{getString('novelScreen.download.customAmount')}
</Text>
<View style={{ flexDirection: 'row', justifyContent: 'center' }}>
<IconButton
Expand Down Expand Up @@ -100,7 +101,7 @@ const DownloadCustomChapterModal = ({
textColor={theme.onPrimary}
buttonColor={theme.primary}
>
Download
{getString('libraryScreen.bottomSheet.display.download')}
</Button>
</Modal>
</Portal>
Expand Down
16 changes: 12 additions & 4 deletions src/screens/novel/components/EditInfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ const EditInfoModal = ({
setNovel({ ...novel, genres: tags?.join(',') });
};

const status = ['Ongoing', 'Hiatus', 'Completed', 'Unknown', 'Cancelled'];
const status = [
getString('novelScreen.status.onGoing'),
getString('novelScreen.status.hiatus'),
getString('novelScreen.status.completed'),
getString('novelScreen.status.unknown'),
getString('novelScreen.status.cancelled'),
];

return (
<Portal>
Expand All @@ -51,7 +57,7 @@ const EditInfoModal = ({
]}
>
<Text style={[styles.modalTitle, { color: theme.onSurface }]}>
Edit info
{getString('novelScreen.edit.info')}
</Text>
<View
style={{
Expand Down Expand Up @@ -117,7 +123,9 @@ const EditInfoModal = ({
dense
/>
<TextInput
placeholder={`Description: ${novel.summary?.substring(0, 16)}...`}
placeholder={getString('novelScreen.edit.summary', {
summary: novel.summary?.substring(0, 16),
})}
style={{ fontSize: 14 }}
numberOfLines={1}
mode="outlined"
Expand All @@ -127,7 +135,7 @@ const EditInfoModal = ({
/>

<TextInput
placeholder={'Add Tag'}
placeholder={getString('novelScreen.edit.addTag')}
style={{ fontSize: 14 }}
numberOfLines={1}
mode="outlined"
Expand Down
9 changes: 7 additions & 2 deletions src/screens/novel/components/Info/NovelInfoComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { TouchableWithoutFeedback } from 'react-native-gesture-handler';
import { Chip } from '../../../../components';
import { coverPlaceholderColor } from '../../../../theme/colors';
import { ThemeColors } from '@theme/types';
import { getString } from '@strings/translations';

interface CoverImageProps {
children: React.ReactNode;
Expand Down Expand Up @@ -199,7 +200,9 @@ const FollowButton = ({
color: followed ? theme.primary : theme.outline,
}}
>
{followed ? 'In Library' : 'Add to library'}
{followed
? getString('novelScreen.inLibaray')
: getString('novelScreen.addToLibaray')}
</Text>
</Pressable>
</View>
Expand Down Expand Up @@ -239,7 +242,9 @@ const TrackerButton = ({
color: isTracked ? theme.primary : theme.outline,
}}
>
{isTracked ? 'Tracked' : 'Tracking'}
{isTracked
? getString('novelScreen.tracked')
: getString('novelScreen.tracking')}
</Text>
</Pressable>
</View>
Expand Down
12 changes: 9 additions & 3 deletions src/screens/novel/components/Info/NovelInfoHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ const NovelInfoHeader = ({
}
onLongPress={() => {
Clipboard.setStringAsync(novel.name).then(() =>
showToast('Copied to clipboard: ' + novel.name),
showToast(
getString('novelScreen.copiedToClipboard', {
name: novel.name,
}),
),
);
}}
>
Expand Down Expand Up @@ -131,7 +135,9 @@ const NovelInfoHeader = ({
style={{ marginRight: 4 }}
/>
<NovelInfo theme={theme}>
{(novel.status || 'Unknown status') + ' • ' + novel.pluginId}
{(novel.status || getString('novelScreen.unknownStatus')) +
' • ' +
novel.pluginId}
</NovelInfo>
</Row>
</View>
Expand All @@ -153,7 +159,7 @@ const NovelInfoHeader = ({
theme={theme}
/>
<NovelSummary
summary={novel.summary || 'No summary'}
summary={novel.summary || getString('novelScreen.noSummary')}
isExpanded={!novel.inLibrary}
theme={theme}
/>
Expand Down
4 changes: 3 additions & 1 deletion src/screens/novel/components/Info/ReadButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const ReadButton = ({
title={
lastRead
? `${getString('novelScreen.continueReading')} ${lastRead.name}`
: `Start reading ${chapters[0].name}`
: getString('novelScreen.startReadingChapters', {
name: chapters[0].name,
})
}
style={{ margin: 16 }}
onPress={navigateToLastReadChapter}
Expand Down
Loading

0 comments on commit e4ffeac

Please sign in to comment.