Cov txheej txheem:

Dab tsi yog i18n nyob rau hauv kev xav?
Dab tsi yog i18n nyob rau hauv kev xav?
Anonim

ib 18n - teb . Teb (JS) text Internationalization thiab externalizing. Markdown-ish syntax nrog kev txhawb nqa sib txawv (nrog rau teb yam hom).

Tom qab ntawd, i18n txhais li cas?

Internationalization (qee zaum luv rau " I18 N , lub ntsiab lus "Kuv - kaum yim tsab ntawv -N") yog cov txheej txheem ntawm kev npaj thiab siv cov khoom thiab cov kev pabcuam kom lawv tuaj yeem hloov tau yooj yim rau cov lus thiab kab lis kev cai hauv zos, txheej txheem hu ua localization.

Tsis tas li ntawd, kuv yuav siv i18 tom ntej no tshwm sim li cas? Txhim kho qhov kev xav tau

  1. Nruab ob lub react-i18next thiab i18next pob:
  2. I18next yog lub hauv paus ntawm i18n functionality thaum react-i18 tom ntej txuas ntxiv thiab nplaum nws kom hnov mob.
  3. Tsim cov ntaub ntawv tshiab i18n.js ib sab ntawm koj qhov index.js uas muaj cov ntsiab lus hauv qab no:
  4. Qhov nthuav ntawm no yog los ntawm i18n.
  5. Tom qab ntawd import qhov ntawd hauv index.js:

Qhov thib ob, koj ua li cas los ua kev lag luam thoob ntiaj teb hauv kev xav?

Luv luv, peb yuav ua tiav cov kauj ruam hauv qab no:

  1. Tsim ib daim ntawv thov yooj yim nrog React Create App tsev qiv ntawv.
  2. Nruab ib lub tsev qiv ntawv thoob ntiaj teb.
  3. Sau cov ntaub ntawv txhais lus.
  4. Configure peb lub tsev qiv ntawv thoob ntiaj teb raws li peb xav tau.
  5. Configure React Provider rau cov khoom kom muaj kev sib raug zoo thoob ntiaj teb.

Yuav ua li cas kuv localize react haiv neeg app?

Yog li cia kuv piav qhia yuav ua li cas teeb tsa react-native-localization pob hauv ob qho tib si hauv thiab ios ua tiav

  1. Kauj ruam 1: Qhib koj qhov project react-native.
  2. Kauj ruam 2: Nruab react-native-localization pob hauv qhov project.
  3. Kauj ruam 3: Txuas react-native-localization pob hauv qhov project.
  4. Kauj ruam 4: Tsim thiab Archive lub App.

Pom zoo: