diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1ad566ac..e148c49d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -16,7 +16,7 @@ PODS: - ExpoModulesCore - EXNotifications (0.17.0): - ExpoModulesCore - - Expo (47.0.8): + - Expo (47.0.9): - ExpoModulesCore - ExpoCrypto (12.0.0): - ExpoModulesCore @@ -26,7 +26,7 @@ PODS: - ExpoModulesCore - ExpoLocalization (14.0.0): - ExpoModulesCore - - ExpoModulesCore (1.0.3): + - ExpoModulesCore (1.0.4): - React-Core - ReactCommon/turbomodule/core - ExpoRandom (13.0.0): @@ -297,7 +297,7 @@ PODS: - React-Core - react-native-cameraroll (5.2.0): - React-Core - - react-native-image-picker (4.10.2): + - react-native-image-picker (4.10.3): - React-Core - react-native-ios-context-menu (1.15.1): - React-Core @@ -694,12 +694,12 @@ SPEC CHECKSUMS: EXFileSystem: 60602b6eefa6873f97172c684b7537c9760b50d6 EXFont: 319606bfe48c33b5b5063fb0994afdc496befe80 EXNotifications: babce2a87b7922051354fcfe7a74dd279b7e272a - Expo: 36b5f625d36728adbdd1934d4d57182f319ab832 + Expo: 5523a4835730104a301caeac1e68dad095a9dfff ExpoCrypto: 51e7662c7f5bfeab25b7909b8a5d545ec15d4877 ExpoHaptics: 5a56d30a87ea213dd00b09566dc4b441a4dff97f ExpoKeepAwake: 69b59d0a8d2b24de9f82759c39b3821fec030318 ExpoLocalization: e202d1e2a4950df17ac8d0889d65a1ffd7532d7e - ExpoModulesCore: b5d21c8880afda6fb6ee95469f9ac2ec9b98e995 + ExpoModulesCore: 8211c89bcc3ba86e2d02c54b1d31f1fa81acb6de ExpoRandom: 58b7e0a5fe1adf1cb6dc1cbe503a6fe9524f36ce ExpoStoreReview: ff6d631f2949eb7e4b2d14146ef6af25a16d770d ExpoWebBrowser: 073e50f16669d498fb49063b9b7fe780b24f7fda @@ -732,7 +732,7 @@ SPEC CHECKSUMS: react-native-blur: 50c9feabacbc5f49b61337ebc32192c6be7ec3c3 react-native-blurhash: add4df9a937b4e021a24bc67a0714f13e0bd40b7 react-native-cameraroll: 0ff04cc4e0ff5f19a94ff4313e5c8bc4503cd86d - react-native-image-picker: bf34f3f516d139ed3e24c5f5a381a91819e349ea + react-native-image-picker: 60f4246eb5bb7187fc15638a8c1f13abd3820695 react-native-ios-context-menu: b170594b4448c0cd10c79e13432216bac99de1ac react-native-language-detection: f414937fa715108ab50a6269a3de0bcb95e4ceb0 react-native-menu: 8e172cfcf0e42e92f028e7781eddf84d430cae24 diff --git a/src/@types/i18next.d.ts b/src/@types/i18next.d.ts index a1693a61..0eebc410 100644 --- a/src/@types/i18next.d.ts +++ b/src/@types/i18next.d.ts @@ -1,8 +1,46 @@ import 'i18next' +import common from '../i18n/en/common.json' +import screens from '../i18n/en/screens.json' + +import screenAccountSelection from '../i18n/en/screens/accountSelection.json' +import screenActions from '../i18n/en/screens/actions.json' +import screenAnnouncements from '../i18n/en/screens/announcements.json' +import screenCompose from '../i18n/en/screens/compose.json' +import screenImageViewer from '../i18n/en/screens/imageViewer.json' +import screenTabs from '../i18n/en/screens/tabs.json' + +import componentContextMenu from '../i18n/en/components/contextMenu.json' +import componentEmojis from '../i18n/en/components/emojis.json' +import componentInstance from '../i18n/en/components/instance.json' +import componentMediaSelector from '../i18n/en/components/mediaSelector.json' +import componentParse from '../i18n/en/components/parse.json' +import componentRelationship from '../i18n/en/components/relationship.json' +import componentTimeline from '../i18n/en/components/timeline.json' + declare module 'i18next' { interface CustomTypeOptions { - defaultNS: 'common', + defaultNS: 'common' + resources: { + common: typeof common + screens: typeof screens + + screenAccountSelection: typeof screenAccountSelection + screenActions: typeof screenActions + screenAnnouncements: typeof screenAnnouncements + screenCompose: typeof screenCompose + screenImageViewer: typeof screenImageViewer + screenTabs: typeof screenTabs + + componentContextMenu: typeof componentContextMenu + componentEmojis: typeof componentEmojis + componentInstance: typeof componentInstance + componentMediaSelector: typeof componentMediaSelector + componentParse: typeof componentParse + componentRelationship: typeof componentRelationship + componentTimeline: typeof componentTimeline + } returnNull: false + returnEmptyString: false } } diff --git a/src/Screens.tsx b/src/Screens.tsx index 6febfbde..cc16181e 100644 --- a/src/Screens.tsx +++ b/src/Screens.tsx @@ -39,7 +39,12 @@ export interface Props { } const Screens: React.FC = ({ localCorrupt }) => { - const { t } = useTranslation('screens') + const { t } = useTranslation([ + 'common', + 'screens', + 'screenAnnouncements', + 'screenAccountSelection' + ]) const dispatch = useAppDispatch() const instanceActive = useSelector(getInstanceActive) const { colors, theme } = useTheme() @@ -55,7 +60,7 @@ const Screens: React.FC = ({ localCorrupt }) => { // Prevent screenshot alert useEffect(() => { const screenshotListener = addScreenshotListener(() => - Alert.alert(t('screenshot.title'), t('screenshot.message'), [ + Alert.alert(t('screens:screenshot.title'), t('screens:screenshot.message'), [ { text: t('common:buttons.confirm'), style: 'destructive' } ]) ) @@ -68,7 +73,7 @@ const Screens: React.FC = ({ localCorrupt }) => { const showLocalCorrect = () => { if (localCorrupt) { displayMessage({ - message: t('localCorrupt.message'), + message: t('screens:localCorrupt.message'), description: localCorrupt.length ? localCorrupt : undefined, type: 'danger' }) @@ -176,7 +181,7 @@ const Screens: React.FC = ({ localCorrupt }) => { if (!typesImage.includes(mime.split('/')[1])) { console.warn('Image type not supported:', mime.split('/')[1]) displayMessage({ - message: t('shareError.imageNotSupported', { + message: t('screens:shareError.imageNotSupported', { type: mime.split('/')[1] }), type: 'danger' @@ -188,7 +193,7 @@ const Screens: React.FC = ({ localCorrupt }) => { if (!typesVideo.includes(mime.split('/')[1])) { console.warn('Video type not supported:', mime.split('/')[1]) displayMessage({ - message: t('shareError.videoNotSupported', { + message: t('screens:shareError.videoNotSupported', { type: mime.split('/')[1] }), type: 'danger' diff --git a/src/components/Emojis.tsx b/src/components/Emojis.tsx index ca744678..5b876f2e 100644 --- a/src/components/Emojis.tsx +++ b/src/components/Emojis.tsx @@ -7,7 +7,6 @@ import { chunk, forEach, groupBy, sortBy } from 'lodash' import React, { createRef, PropsWithChildren, useEffect, useReducer, useState } from 'react' import { useTranslation } from 'react-i18next' import { Keyboard, KeyboardAvoidingView, View } from 'react-native' -import FastImage from 'react-native-fast-image' import { Edge, SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context' import { useSelector } from 'react-redux' import EmojisContext, { Emojis, emojisReducer, EmojisState } from './Emojis/helpers/EmojisContext' @@ -35,7 +34,7 @@ const ComponentEmojis: React.FC = ({ emojisDispatch({ type: 'input', payload: inputProps }) }, [inputProps]) - const { t } = useTranslation() + const { t } = useTranslation(['componentEmojis']) const { data } = useEmojisQuery({}) const frequentEmojis = useSelector(getInstanceFrequentEmojis, () => true) useEffect(() => { diff --git a/src/components/Emojis/List.tsx b/src/components/Emojis/List.tsx index 8b2c243d..983316e0 100644 --- a/src/components/Emojis/List.tsx +++ b/src/components/Emojis/List.tsx @@ -25,7 +25,7 @@ import EmojisContext from './helpers/EmojisContext' const EmojisList = () => { const dispatch = useAppDispatch() const { reduceMotionEnabled } = useAccessibility() - const { t } = useTranslation() + const { t } = useTranslation(['common', 'screenCompose']) const { emojisState, emojisDispatch } = useContext(EmojisContext) const { colors } = useTheme() diff --git a/src/components/Instance/index.tsx b/src/components/Instance/index.tsx index f0fe1b3a..8ebfea24 100644 --- a/src/components/Instance/index.tsx +++ b/src/components/Instance/index.tsx @@ -35,7 +35,7 @@ const ComponentInstance: React.FC = ({ disableHeaderImage, goBack = false }) => { - const { t } = useTranslation('componentInstance') + const { t } = useTranslation(['common', 'componentInstance']) const { colors, mode } = useTheme() const navigation = useNavigation>() @@ -113,16 +113,20 @@ const ComponentInstance: React.FC = ({ const processUpdate = useCallback(() => { if (domain) { if (instances && instances.filter(instance => instance.url === domain).length) { - Alert.alert(t('update.alert.title'), t('update.alert.message'), [ - { - text: t('common:buttons.cancel'), - style: 'cancel' - }, - { - text: t('common:buttons.continue'), - onPress: () => appsMutation.mutate({ domain }) - } - ]) + Alert.alert( + t('componentInstance:update.alert.title'), + t('componentInstance:update.alert.message'), + [ + { + text: t('common:buttons.cancel'), + style: 'cancel' + }, + { + text: t('common:buttons.continue'), + onPress: () => appsMutation.mutate({ domain }) + } + ] + ) } else { appsMutation.mutate({ domain }) } @@ -209,7 +213,7 @@ const ComponentInstance: React.FC = ({ processUpdate() } }} - placeholder={' ' + t('server.textInput.placeholder')} + placeholder={' ' + t('componentInstance:server.textInput.placeholder')} placeholderTextColor={colors.secondary} returnKeyType='go' keyboardAppearance={mode} @@ -222,7 +226,7 @@ const ComponentInstance: React.FC = ({ />