|
@@ -1,21 +1,32 @@
|
|
|
import React from 'react';
|
|
|
import { StyleSheet, View, Text, TouchableOpacity, Button } from 'react-native';
|
|
|
import { useNavigation } from '@react-navigation/native';
|
|
|
-// import { useTranslation } from 'react-i18next';
|
|
|
-// const { t, i18n } = useTranslation();
|
|
|
+import { useTranslation } from 'react-i18next';
|
|
|
+
|
|
|
+import i18n from '../../i18n';
|
|
|
|
|
|
const TeamScreen = () => {
|
|
|
+ const { t } = useTranslation();
|
|
|
const navigation = useNavigation();
|
|
|
const getJump = async (data) => {
|
|
|
navigation.navigate(data);
|
|
|
};
|
|
|
|
|
|
const changeLanguage = async () => {
|
|
|
- // i18n.changeLanguage('en');
|
|
|
+ console.log("i18n", i18n)
|
|
|
+ i18n.changeLanguage(i18n.language === 'en' ? 'zh-CN' : 'en')
|
|
|
+ console.log("i18n", i18n)
|
|
|
};
|
|
|
return (
|
|
|
<View style={styles.main}>
|
|
|
- <Button title="切换语言" onPress={changeLanguage} />
|
|
|
+ <View>
|
|
|
+ <Text>{t('welcome')}</Text>
|
|
|
+ <Text>{t('greeting', { name: 'John' })}</Text>
|
|
|
+ <Button
|
|
|
+ title="Switch Language"
|
|
|
+ onPress={changeLanguage}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
<Text>
|
|
|
球队
|
|
|
</Text>
|
|
@@ -25,6 +36,7 @@ const TeamScreen = () => {
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
main: {
|
|
|
+ paddingTop: 50
|
|
|
},
|
|
|
});
|
|
|
|