diff --git a/src/Index.tsx b/src/Index.tsx index 9a1b6f22..15d9deea 100644 --- a/src/Index.tsx +++ b/src/Index.tsx @@ -17,6 +17,7 @@ import { themes } from 'src/utils/styles/themes' import { useTheme } from 'src/utils/styles/ThemeManager' import getCurrentTab from 'src/utils/getCurrentTab' import { toastConfig } from 'src/components/toast' +import { useTranslation } from 'react-i18next' enableScreens() const Tab = createBottomTabNavigator() @@ -30,6 +31,7 @@ export type RootStackParamList = { } export const Index: React.FC = () => { + const { i18n } = useTranslation() const { mode, theme } = useTheme() enum barStyle { light = 'dark-content', @@ -39,7 +41,7 @@ export const Index: React.FC = () => { return ( <> - + ({ tabBarIcon: ({ focused, color, size }) => { diff --git a/src/components/BottomSheet.tsx b/src/components/BottomSheet.tsx index f30c4f1e..a385fdaa 100644 --- a/src/components/BottomSheet.tsx +++ b/src/components/BottomSheet.tsx @@ -11,8 +11,7 @@ import { } from 'react-native' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useTheme } from 'src/utils/styles/ThemeManager' - -import constants from 'src/utils/styles/constants' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { children: React.ReactNode @@ -104,23 +103,23 @@ const styles = StyleSheet.create({ justifyContent: 'flex-end' }, container: { - padding: constants.SPACING_L, - paddingTop: constants.SPACING_M + padding: StyleConstants.Spacing.L, + paddingTop: StyleConstants.Spacing.M }, handle: { alignSelf: 'center', - width: constants.GLOBAL_SPACING_BASE * 8, - height: constants.GLOBAL_SPACING_BASE / 2, + width: StyleConstants.Spacing.Global.PagePadding * 8, + height: StyleConstants.Spacing.Global.PagePadding / 2, borderRadius: 100, - top: -constants.SPACING_M * 2 + top: -StyleConstants.Spacing.M * 2 }, cancel: { - padding: constants.SPACING_S, + padding: StyleConstants.Spacing.S, borderWidth: 1, borderRadius: 100 }, text: { - fontSize: constants.FONT_SIZE_L, + fontSize: StyleConstants.Font.Size.L, textAlign: 'center' } }) diff --git a/src/components/BottomSheet/Row.tsx b/src/components/BottomSheet/Row.tsx index bf5a6f81..c4c771df 100644 --- a/src/components/BottomSheet/Row.tsx +++ b/src/components/BottomSheet/Row.tsx @@ -2,8 +2,8 @@ import React from 'react' import { Pressable, StyleSheet, Text } from 'react-native' import { Feather } from '@expo/vector-icons' -import constants from 'src/utils/styles/constants' import { useTheme } from 'src/utils/styles/ThemeManager' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { onPressFunction: () => void @@ -16,7 +16,11 @@ const BottomSheetRow: React.FC = ({ onPressFunction, icon, text }) => { return ( onPressFunction()} style={styles.pressable}> - + {text} ) @@ -25,12 +29,12 @@ const BottomSheetRow: React.FC = ({ onPressFunction, icon, text }) => { const styles = StyleSheet.create({ pressable: { flexDirection: 'row', - marginBottom: constants.SPACING_L + marginBottom: StyleConstants.Spacing.L }, text: { - fontSize: constants.FONT_SIZE_M, - lineHeight: constants.FONT_SIZE_L, - marginLeft: constants.SPACING_S + fontSize: StyleConstants.Font.Size.M, + lineHeight: StyleConstants.Font.Size.L, + marginLeft: StyleConstants.Spacing.S } }) diff --git a/src/components/Header.tsx b/src/components/Header.tsx new file mode 100644 index 00000000..868ea669 --- /dev/null +++ b/src/components/Header.tsx @@ -0,0 +1,4 @@ +import HeaderLeft from './Header/Left' +import HeaderRight from './Header/Right' + +export { HeaderLeft, HeaderRight } diff --git a/src/components/Header/Left.tsx b/src/components/Header/Left.tsx new file mode 100644 index 00000000..b8bab0e9 --- /dev/null +++ b/src/components/Header/Left.tsx @@ -0,0 +1,41 @@ +import { Feather } from '@expo/vector-icons' +import React from 'react' +import { Pressable, StyleSheet, Text } from 'react-native' + +import { useTheme } from 'src/utils/styles/ThemeManager' +import { StyleConstants } from 'src/utils/styles/constants' + +export interface Props { + onPress: () => void + text?: string + icon?: string +} + +const HeaderLeft: React.FC = ({ onPress, text, icon }) => { + const { theme } = useTheme() + + return ( + + {text ? ( + {text} + ) : ( + + )} + + ) +} + +const styles = StyleSheet.create({ + base: { + paddingRight: StyleConstants.Spacing.S + }, + text: { + fontSize: StyleConstants.Font.Size.L + } +}) + +export default HeaderLeft diff --git a/src/components/Header/Right.tsx b/src/components/Header/Right.tsx new file mode 100644 index 00000000..12ddd04d --- /dev/null +++ b/src/components/Header/Right.tsx @@ -0,0 +1,52 @@ +import { Feather } from '@expo/vector-icons' +import React from 'react' +import { Pressable, StyleSheet, Text } from 'react-native' + +import { useTheme } from 'src/utils/styles/ThemeManager' +import { StyleConstants } from 'src/utils/styles/constants' + +type PropsBase = { + onPress: () => void +} + +export interface PropsText extends PropsBase { + text: string + icon?: string +} + +export interface PropsIcon extends PropsBase { + text?: string + icon: string +} + +const HeaderRight: React.FC = ({ + onPress, + text, + icon +}) => { + const { theme } = useTheme() + + return ( + + {text && {text}} + {icon && ( + + )} + + ) +} + +const styles = StyleSheet.create({ + base: { + paddingLeft: StyleConstants.Spacing.S + }, + text: { + fontSize: StyleConstants.Font.Size.L + } +}) + +export default HeaderRight diff --git a/src/components/Menu/Button.tsx b/src/components/Menu/Button.tsx index a46d0188..906e9b34 100644 --- a/src/components/Menu/Button.tsx +++ b/src/components/Menu/Button.tsx @@ -9,8 +9,7 @@ import { View } from 'react-native' import { useTheme } from 'src/utils/styles/ThemeManager' - -import constants from 'src/utils/styles/constants' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { text: string @@ -66,8 +65,8 @@ const styles = StyleSheet.create({ flexDirection: 'row', justifyContent: 'center', alignItems: 'center', - paddingLeft: constants.GLOBAL_PAGE_PADDING, - paddingRight: constants.GLOBAL_PAGE_PADDING + paddingLeft: StyleConstants.Spacing.Global.PagePadding, + paddingRight: StyleConstants.Spacing.Global.PagePadding } }) diff --git a/src/components/Menu/Container.tsx b/src/components/Menu/Container.tsx index 0caa5d78..2d1960c2 100644 --- a/src/components/Menu/Container.tsx +++ b/src/components/Menu/Container.tsx @@ -1,8 +1,7 @@ import React from 'react' import { StyleSheet, View } from 'react-native' import { useTheme } from 'src/utils/styles/ThemeManager' - -import constants from 'src/utils/styles/constants' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { children: React.ReactNode @@ -18,7 +17,9 @@ const MenuContainer: React.FC = ({ ...props }) => { styles.base, { borderTopColor: theme.separator, - marginTop: props.marginTop ? constants.GLOBAL_PAGE_PADDING : 0 + marginTop: props.marginTop + ? StyleConstants.Spacing.Global.PagePadding + : 0 } ]} > @@ -30,7 +31,7 @@ const MenuContainer: React.FC = ({ ...props }) => { const styles = StyleSheet.create({ base: { borderTopWidth: 1, - marginBottom: constants.GLOBAL_PAGE_PADDING + marginBottom: StyleConstants.Spacing.Global.PagePadding } }) diff --git a/src/components/Menu/Item.tsx b/src/components/Menu/Item.tsx index 39f6b412..be33d081 100644 --- a/src/components/Menu/Item.tsx +++ b/src/components/Menu/Item.tsx @@ -3,8 +3,8 @@ import { Pressable, StyleSheet, Text, View } from 'react-native' import { Feather } from '@expo/vector-icons' import { useTheme } from 'src/utils/styles/ThemeManager' -import constants from 'src/utils/styles/constants' import { ColorDefinitions } from 'src/utils/styles/themes' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { iconFront?: string @@ -34,7 +34,7 @@ const Core: React.FC = ({ {iconFront && ( @@ -55,7 +55,7 @@ const Core: React.FC = ({ {iconBack && ( @@ -90,8 +90,8 @@ const styles = StyleSheet.create({ core: { flex: 1, flexDirection: 'row', - paddingLeft: constants.GLOBAL_PAGE_PADDING, - paddingRight: constants.GLOBAL_PAGE_PADDING + paddingLeft: StyleConstants.Spacing.Global.PagePadding, + paddingRight: StyleConstants.Spacing.Global.PagePadding }, front: { flex: 1, @@ -108,10 +108,10 @@ const styles = StyleSheet.create({ marginRight: 8 }, text: { - fontSize: constants.FONT_SIZE_M + fontSize: StyleConstants.Font.Size.M }, content: { - fontSize: constants.FONT_SIZE_M + fontSize: StyleConstants.Font.Size.M }, iconBack: { marginLeft: 8 diff --git a/src/components/NetworkState.tsx b/src/components/NetworkState.tsx new file mode 100644 index 00000000..07e1ce72 --- /dev/null +++ b/src/components/NetworkState.tsx @@ -0,0 +1,3 @@ +import NetworkStateError from './NetworkState/Error' + +export { NetworkStateError } diff --git a/src/components/NetworkState/Error.tsx b/src/components/NetworkState/Error.tsx new file mode 100644 index 00000000..55d0dcfc --- /dev/null +++ b/src/components/NetworkState/Error.tsx @@ -0,0 +1,20 @@ +import React from 'react' +import { StyleSheet, Text, View } from 'react-native' + +const NetworkStateError = () => { + return ( + + 加载错误 + + ) +} + +const styles = StyleSheet.create({ + base: { + flex: 1, + // justifyContent: 'center', + alignItems: 'center' + } +}) + +export default NetworkStateError diff --git a/src/components/Timelines/Timeline/Conversation.tsx b/src/components/Timelines/Timeline/Conversation.tsx index 73a87db5..c8aadddb 100644 --- a/src/components/Timelines/Timeline/Conversation.tsx +++ b/src/components/Timelines/Timeline/Conversation.tsx @@ -5,8 +5,7 @@ import { useNavigation } from '@react-navigation/native' import Avatar from './Shared/Avatar' import HeaderConversation from './Shared/HeaderConversation' import Content from './Shared/Content' - -import constants from 'src/utils/styles/constants' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { item: Mastodon.Conversation @@ -60,7 +59,7 @@ const styles = StyleSheet.create({ statusView: { flex: 1, flexDirection: 'column', - padding: constants.GLOBAL_PAGE_PADDING + padding: StyleConstants.Spacing.Global.PagePadding }, status: { flex: 1, diff --git a/src/components/Timelines/Timeline/Default.tsx b/src/components/Timelines/Timeline/Default.tsx index 600a6f92..10d3eeaf 100644 --- a/src/components/Timelines/Timeline/Default.tsx +++ b/src/components/Timelines/Timeline/Default.tsx @@ -10,8 +10,7 @@ import Poll from './Shared/Poll' import Attachment from './Shared/Attachment' import Card from './Shared/Card' import ActionsStatus from './Shared/ActionsStatus' - -import constants from 'src/utils/styles/constants' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { item: Mastodon.Status @@ -51,7 +50,7 @@ const TimelineDefault: React.FC = ({ item, queryKey }) => { media_attachments={actualStatus.media_attachments} sensitive={actualStatus.sensitive} width={ - Dimensions.get('window').width - constants.SPACING_M * 2 - 50 - 8 + Dimensions.get('window').width - StyleConstants.Spacing.M * 2 - 50 - 8 } /> )} @@ -107,7 +106,7 @@ const styles = StyleSheet.create({ statusView: { flex: 1, flexDirection: 'column', - padding: constants.GLOBAL_PAGE_PADDING + padding: StyleConstants.Spacing.Global.PagePadding }, status: { flex: 1, diff --git a/src/components/Timelines/Timeline/Notifications.tsx b/src/components/Timelines/Timeline/Notifications.tsx index 4f9d20ab..78cf2455 100644 --- a/src/components/Timelines/Timeline/Notifications.tsx +++ b/src/components/Timelines/Timeline/Notifications.tsx @@ -10,8 +10,7 @@ import Poll from './Shared/Poll' import Attachment from './Shared/Attachment' import Card from './Shared/Card' import ActionsStatus from './Shared/ActionsStatus' - -import constants from 'src/utils/styles/constants' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { notification: Mastodon.Notification @@ -98,7 +97,7 @@ const styles = StyleSheet.create({ notificationView: { flex: 1, flexDirection: 'column', - padding: constants.GLOBAL_PAGE_PADDING + padding: StyleConstants.Spacing.Global.PagePadding }, notification: { flex: 1, diff --git a/src/components/Timelines/Timeline/Separator.tsx b/src/components/Timelines/Timeline/Separator.tsx index 29697056..f7f871d0 100644 --- a/src/components/Timelines/Timeline/Separator.tsx +++ b/src/components/Timelines/Timeline/Separator.tsx @@ -1,8 +1,8 @@ import React from 'react' import { StyleSheet, View } from 'react-native' -import constants from 'src/utils/styles/constants' import { useTheme } from 'src/utils/styles/ThemeManager' +import { StyleConstants } from 'src/utils/styles/constants' const TimelineSeparator = () => { const { theme } = useTheme() @@ -13,8 +13,11 @@ const TimelineSeparator = () => { const styles = StyleSheet.create({ base: { borderTopWidth: 1, - marginLeft: constants.SPACING_M + constants.AVATAR_S + constants.SPACING_S, - marginRight: constants.SPACING_M + marginLeft: + StyleConstants.Spacing.M + + StyleConstants.Avatar.S + + StyleConstants.Spacing.S, + marginRight: StyleConstants.Spacing.M } }) diff --git a/src/components/Timelines/Timeline/Shared/Actioned.tsx b/src/components/Timelines/Timeline/Shared/Actioned.tsx index a8480d48..f246c3fc 100644 --- a/src/components/Timelines/Timeline/Shared/Actioned.tsx +++ b/src/components/Timelines/Timeline/Shared/Actioned.tsx @@ -4,8 +4,7 @@ import { Feather } from '@expo/vector-icons' import Emojis from './Emojis' import { useTheme } from 'src/utils/styles/ThemeManager' - -import constants from 'src/utils/styles/constants' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { action: 'favourite' | 'follow' | 'mention' | 'poll' | 'reblog' @@ -30,7 +29,7 @@ const Actioned: React.FC = ({ icon = ( @@ -41,7 +40,7 @@ const Actioned: React.FC = ({ icon = ( @@ -52,7 +51,7 @@ const Actioned: React.FC = ({ icon = ( @@ -63,7 +62,7 @@ const Actioned: React.FC = ({ icon = ( @@ -81,7 +80,7 @@ const Actioned: React.FC = ({ ) : ( {content} @@ -97,11 +96,11 @@ const Actioned: React.FC = ({ const styles = StyleSheet.create({ actioned: { flexDirection: 'row', - marginBottom: constants.SPACING_S + marginBottom: StyleConstants.Spacing.S }, icon: { - marginLeft: constants.AVATAR_S - constants.FONT_SIZE_S, - marginRight: constants.SPACING_S + marginLeft: StyleConstants.Avatar.S - StyleConstants.Font.Size.S, + marginRight: StyleConstants.Spacing.S }, content: { flexDirection: 'row' diff --git a/src/components/Timelines/Timeline/Shared/ActionsStatus.tsx b/src/components/Timelines/Timeline/Shared/ActionsStatus.tsx index bc7a5e22..64666fbb 100644 --- a/src/components/Timelines/Timeline/Shared/ActionsStatus.tsx +++ b/src/components/Timelines/Timeline/Shared/ActionsStatus.tsx @@ -14,9 +14,9 @@ import { Feather } from '@expo/vector-icons' import client from 'src/api/client' import { getLocalAccountId } from 'src/utils/slices/instancesSlice' import { useTheme } from 'src/utils/styles/ThemeManager' -import constants from 'src/utils/styles/constants' import { toast } from 'src/components/toast' import { useSelector } from 'react-redux' +import { StyleConstants } from 'src/utils/styles/constants' const fireMutation = async ({ id, @@ -175,14 +175,14 @@ const ActionsStatus: React.FC = ({ queryKey, status }) => { {status.replies_count > 0 && ( {status.replies_count} @@ -201,7 +201,7 @@ const ActionsStatus: React.FC = ({ queryKey, status }) => { ? iconColorAction(status.reblogged) : theme.disabled } - size={constants.FONT_SIZE_M + 2} + size={StyleConstants.Font.Size.M + 2} /> ), [status.reblogged] @@ -211,7 +211,7 @@ const ActionsStatus: React.FC = ({ queryKey, status }) => { ), [status.favourited] @@ -221,7 +221,7 @@ const ActionsStatus: React.FC = ({ queryKey, status }) => { ), [status.bookmarked] @@ -231,7 +231,7 @@ const ActionsStatus: React.FC = ({ queryKey, status }) => { ), [] @@ -374,7 +374,7 @@ const styles = StyleSheet.create({ width: '100%', flex: 1, flexDirection: 'row', - marginTop: constants.SPACING_M + marginTop: StyleConstants.Spacing.M }, action: { width: '20%', diff --git a/src/components/Timelines/Timeline/Shared/Avatar.tsx b/src/components/Timelines/Timeline/Shared/Avatar.tsx index 2aadf714..a21494dd 100644 --- a/src/components/Timelines/Timeline/Shared/Avatar.tsx +++ b/src/components/Timelines/Timeline/Shared/Avatar.tsx @@ -1,8 +1,7 @@ import React, { useCallback } from 'react' import { Image, Pressable, StyleSheet } from 'react-native' import { useNavigation } from '@react-navigation/native' - -import constants from 'src/utils/styles/constants' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { uri: string @@ -27,9 +26,9 @@ const Avatar: React.FC = ({ uri, id }) => { const styles = StyleSheet.create({ avatar: { - width: constants.AVATAR_S, - height: constants.AVATAR_S, - marginRight: constants.SPACING_S + width: StyleConstants.Avatar.S, + height: StyleConstants.Avatar.S, + marginRight: StyleConstants.Spacing.S }, image: { width: '100%', diff --git a/src/components/Timelines/Timeline/Shared/Content.tsx b/src/components/Timelines/Timeline/Shared/Content.tsx index a1a2adff..c8688f07 100644 --- a/src/components/Timelines/Timeline/Shared/Content.tsx +++ b/src/components/Timelines/Timeline/Shared/Content.tsx @@ -4,8 +4,8 @@ import Collapsible from 'react-native-collapsible' import ParseContent from 'src/components/ParseContent' -import constants from 'src/utils/styles/constants' import { useTheme } from 'src/utils/styles/ThemeManager' +import { StyleConstants } from 'src/utils/styles/constants' export interface Props { content: string @@ -40,7 +40,7 @@ const Content: React.FC = ({ @@ -49,7 +49,7 @@ const Content: React.FC = ({ ) : ( diff --git a/src/components/Timelines/Timeline/Shared/Emojis.tsx b/src/components/Timelines/Timeline/Shared/Emojis.tsx index a8969025..954a0184 100644 --- a/src/components/Timelines/Timeline/Shared/Emojis.tsx +++ b/src/components/Timelines/Timeline/Shared/Emojis.tsx @@ -1,8 +1,7 @@ import React from 'react' import { Image, StyleSheet, Text } from 'react-native' import { useTheme } from 'src/utils/styles/ThemeManager' - -import constants from 'src/utils/styles/constants' +import { StyleConstants } from 'src/utils/styles/constants' const regexEmoji = new RegExp(/(:[a-z0-9_]+:)/) @@ -25,7 +24,7 @@ const Emojis: React.FC = ({ fontSize: size, lineHeight: size + 2, color: theme.primary, - ...(fontBold && { fontWeight: constants.FONT_WEIGHT_BOLD }) + ...(fontBold && { fontWeight: StyleConstants.Font.Weight.Bold }) }, image: { width: size, diff --git a/src/components/Timelines/Timeline/Shared/HeaderDefault.tsx b/src/components/Timelines/Timeline/Shared/HeaderDefault.tsx index ca0dcdee..10c089fd 100644 --- a/src/components/Timelines/Timeline/Shared/HeaderDefault.tsx +++ b/src/components/Timelines/Timeline/Shared/HeaderDefault.tsx @@ -9,11 +9,11 @@ import relativeTime from 'src/utils/relativeTime' import client from 'src/api/client' import { getLocalAccountId, getLocalUrl } from 'src/utils/slices/instancesSlice' import { useTheme } from 'src/utils/styles/ThemeManager' -import constants from 'src/utils/styles/constants' import BottomSheet from 'src/components/BottomSheet' import BottomSheetRow from 'src/components/BottomSheet/Row' import { toast } from 'src/components/toast' import { useSelector } from 'react-redux' +import { StyleConstants } from 'src/utils/styles/constants' const fireMutation = async ({ id, @@ -156,7 +156,7 @@ const HeaderDefault: React.FC = ({ ), [] @@ -170,7 +170,7 @@ const HeaderDefault: React.FC = ({ ) : ( @@ -202,7 +202,7 @@ const HeaderDefault: React.FC = ({ {visibility === 'private' && ( @@ -297,24 +297,24 @@ const styles = StyleSheet.create({ }, account: { flexShrink: 1, - marginLeft: constants.SPACING_XS, - lineHeight: constants.FONT_SIZE_M + 2 + marginLeft: StyleConstants.Spacing.XS, + lineHeight: StyleConstants.Font.Size.M + 2 }, meta: { flexDirection: 'row', alignItems: 'center', - marginTop: constants.SPACING_XS, - marginBottom: constants.SPACING_S + marginTop: StyleConstants.Spacing.XS, + marginBottom: StyleConstants.Spacing.S }, created_at: { - fontSize: constants.FONT_SIZE_S + fontSize: StyleConstants.Font.Size.S }, visibility: { - marginLeft: constants.SPACING_S + marginLeft: StyleConstants.Spacing.S }, application: { - fontSize: constants.FONT_SIZE_S, - marginLeft: constants.SPACING_S + fontSize: StyleConstants.Font.Size.S, + marginLeft: StyleConstants.Spacing.S } }) diff --git a/src/components/toast.tsx b/src/components/toast.tsx index a55f6f20..466de66c 100644 --- a/src/components/toast.tsx +++ b/src/components/toast.tsx @@ -3,8 +3,8 @@ import { StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' import Toast from 'react-native-toast-message' import { useTheme } from 'src/utils/styles/ThemeManager' -import constants from 'src/utils/styles/constants' import { Feather } from '@expo/vector-icons' +import { StyleConstants } from 'src/utils/styles/constants' export interface Params { type: 'success' | 'error' | 'warning' @@ -65,7 +65,7 @@ const ToastBase = ({ config }: { config: Config }) => { {config.text1} @@ -91,11 +91,11 @@ const styles = StyleSheet.create({ flex: 1, flexDirection: 'row', justifyContent: 'center', - padding: constants.SPACING_M + padding: StyleConstants.Spacing.M }, text: { - fontSize: constants.FONT_SIZE_M, - marginLeft: constants.SPACING_S + fontSize: StyleConstants.Font.Size.M, + marginLeft: StyleConstants.Spacing.S } }) diff --git a/src/i18n/zh/_all.ts b/src/i18n/zh/_all.ts index d977627f..6446cf93 100644 --- a/src/i18n/zh/_all.ts +++ b/src/i18n/zh/_all.ts @@ -1,11 +1,21 @@ export default { common: require('./common').default, + local: require('./screens/local').default, + + public: require('./screens/public').default, + + notifications: require('./screens/notifications').default, + meRoot: require('./screens/meRoot').default, meConversations: require('./screens/meConversations').default, meBookmarks: require('./screens/meBookmarks').default, meFavourites: require('./screens/meFavourites').default, meLists: require('./screens/meLists').default, meListsList: require('./screens/meListsList').default, - meSettings: require('./screens/meSettings').default + meSettings: require('./screens/meSettings').default, + + sharedAccount: require('./screens/sharedAccount').default, + sharedToot: require('./screens/sharedToot').default, + sharedWebview: require('./screens/sharedWebview').default } diff --git a/src/i18n/zh/common.ts b/src/i18n/zh/common.ts index de10b973..8d79fc5a 100644 --- a/src/i18n/zh/common.ts +++ b/src/i18n/zh/common.ts @@ -1,20 +1,5 @@ export default { buttons: { cancel: '取消' - }, - headers: { - local: { - segments: { - left: '我的关注', - right: '本站嘟嘟' - } - }, - public: { - segments: { - left: '跨站关注', - right: '外站嘟嘟' - } - }, - notifications: '我的通知' } } diff --git a/src/i18n/zh/screens/local.ts b/src/i18n/zh/screens/local.ts new file mode 100644 index 00000000..72b0d043 --- /dev/null +++ b/src/i18n/zh/screens/local.ts @@ -0,0 +1,9 @@ +export default { + heading: { + segments: { + left: '我的关注', + right: '本站嘟嘟' + } + }, + content: {} +} diff --git a/src/i18n/zh/screens/meRoot.ts b/src/i18n/zh/screens/meRoot.ts index edb218c4..b085b142 100644 --- a/src/i18n/zh/screens/meRoot.ts +++ b/src/i18n/zh/screens/meRoot.ts @@ -1,7 +1,12 @@ export default { heading: '我的长毛象', content: { - login: {}, + login: { + server: { + placeholder: '请输入服务器' + }, + button: '登录' + }, collections: { conversations: '$t(meConversations:heading)', bookmarks: '$t(meBookmarks:heading)', diff --git a/src/i18n/zh/screens/meSettings.ts b/src/i18n/zh/screens/meSettings.ts index 21a32ad4..9abf7d86 100644 --- a/src/i18n/zh/screens/meSettings.ts +++ b/src/i18n/zh/screens/meSettings.ts @@ -10,7 +10,7 @@ export default { } }, theme: { - heading: '颜色模式', + heading: '应用外观', options: { auto: '跟随系统', light: '浅色模式', diff --git a/src/i18n/zh/screens/notifications.ts b/src/i18n/zh/screens/notifications.ts new file mode 100644 index 00000000..6b35992e --- /dev/null +++ b/src/i18n/zh/screens/notifications.ts @@ -0,0 +1,4 @@ +export default { + heading: '通知', + content: {} +} diff --git a/src/i18n/zh/screens/public.ts b/src/i18n/zh/screens/public.ts new file mode 100644 index 00000000..65071b81 --- /dev/null +++ b/src/i18n/zh/screens/public.ts @@ -0,0 +1,9 @@ +export default { + heading: { + segments: { + left: '跨站关注', + right: '外站嘟嘟' + } + }, + content: {} +} diff --git a/src/i18n/zh/screens/sharedAccount.ts b/src/i18n/zh/screens/sharedAccount.ts new file mode 100644 index 00000000..50a8b129 --- /dev/null +++ b/src/i18n/zh/screens/sharedAccount.ts @@ -0,0 +1,19 @@ +export default { + heading: { + loading: '加载中…', + error: '加载错误' + }, + content: { + created_at: '加入时间:{{date}}', + summary: { + statuses_count: '{{count}} 条嘟文', + followers_count: '关注 {{count}} 人', + following_count: '被 {{count}} 人关注' + }, + segments: { + left: '所有嘟嘟', + middle: '嘟嘟和回复', + right: '所有媒体' + } + } +} diff --git a/src/i18n/zh/screens/sharedToot.ts b/src/i18n/zh/screens/sharedToot.ts new file mode 100644 index 00000000..d7deab73 --- /dev/null +++ b/src/i18n/zh/screens/sharedToot.ts @@ -0,0 +1,4 @@ +export default { + heading: '对话', + content: {} +} diff --git a/src/i18n/zh/screens/sharedWebview.ts b/src/i18n/zh/screens/sharedWebview.ts new file mode 100644 index 00000000..248082df --- /dev/null +++ b/src/i18n/zh/screens/sharedWebview.ts @@ -0,0 +1,7 @@ +export default { + heading: { + loading: '加载中…', + error: '加载错误' + }, + content: {} +} diff --git a/src/screens/Local.tsx b/src/screens/Local.tsx index 53822067..7d7e150c 100644 --- a/src/screens/Local.tsx +++ b/src/screens/Local.tsx @@ -10,8 +10,8 @@ const ScreenLocal: React.FC = () => { ) diff --git a/src/screens/Me/Root/Login.tsx b/src/screens/Me/Root/Login.tsx index d54ca7c4..f3b0b07d 100644 --- a/src/screens/Me/Root/Login.tsx +++ b/src/screens/Me/Root/Login.tsx @@ -11,9 +11,11 @@ import { updateLocal } from 'src/utils/slices/instancesSlice' import { useNavigation } from '@react-navigation/native' import { useTheme } from 'src/utils/styles/ThemeManager' -import constants from 'src/utils/styles/constants' +import { useTranslation } from 'react-i18next' +import { StyleConstants } from 'src/utils/styles/constants' const Login: React.FC = () => { + const { t } = useTranslation('meRoot') const { theme } = useTheme() const navigation = useNavigation() const dispatch = useDispatch() @@ -126,7 +128,7 @@ const Login: React.FC = () => { color: theme.primary, borderColor: theme.border, borderWidth: 1, - padding: constants.SPACING_M + padding: StyleConstants.Spacing.M }} onChangeText={onChangeText} autoCapitalize='none' @@ -138,12 +140,12 @@ const Login: React.FC = () => { onSubmitEditing={async () => isSuccess && data && data.uri && (await createApplication()) } - placeholder='输入服务器' + placeholder={t('content.login.server.placeholder')} placeholderTextColor={theme.secondary} returnKeyType='go' />