¿CómoImplemento lainternacionalización(i18n)con fuentes personalizadas(custom-font)usando expo-cli?

时间:2019-10-07 20:36:12

标签: react-native internationalization expo custom-font

React Native的新游戏,Estoy的实名制,未使用过的sencilla,peroquedéestancado en el inicio,没有使用过的puedo服装,

他无所事事,无人陪伴,没有,我无罪,无人陪伴,无人陪伴

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import * as Font from 'expo-font';
import Logo from './components/pages/initialPage/Logo'
import I18N from './components/translation/I18n'

export default class App extends React.Component {
  constructor(props) {
        super(props);
        this.state = {
            fontLoaded: false
        };
    }

    async componentDidMount() {
        Font.loadAsync({
AristotelicaSmallCaps:require('./components/fonts/AristotelicaSmallCaps-Regular.ttf'),
BebasNeue: require('./components/fonts/BebasNeue-Regular.ttf')
        })
            .then(() => {
                this.setState({ fontLoaded: true });
                console.log('fuente cargada: ');
            })
            .catch(e => {
                console.log('error: ', e);
            });
    }
  render() {
    return  this.state.fontLoaded == true ? (


<View style={styles.container}>


<Text style={styles.textName}>{I18n.t('Hola mundo')}</Text>

            </View>
    ) : (
            <View style={styles.container}></View>
        );
  }
}

const styles = StyleSheet.create({
  container: {
        flex: 1,
        flexDirection: 'column',
        backgroundColor: '#152850',
        alignItems: 'center',
        justifyContent: 'center',
        alignContent: 'space-between'
  },
  textName: {
        margin: 5,
        marginBottom: 30,
        fontSize: 80,
        textAlign: 'center',
        color: 'white',
        fontFamily: 'AristotelicaSmallCaps'
    }
});
埃斯特·科迪戈(Estécodigo),没有丰沙尔的任何娱乐活动,特拉蒙(ladando)城堡的埃斯托伊城堡,{I18n.t('Hola mundo')}的改建作品tanto en ingles comoespañol... Por Hola Mundo Dr entoncesfuncionará

0 个答案:

没有答案