Questions tagged [i18n-js]
22 questions
4
votes
0 answers
How do I make my i18n-js text is render properly when imported from json files?
I've developed an app in React Native and Expo managed workflow. I want the app to be available in other languages, so I integrated i18n-js into the app. I followed a tutorial online explaining how to integrate i18n-js into my app, but the way the…

MK_Pierce
- 916
- 2
- 10
- 26
4
votes
0 answers
changing the language of react native app does not change the language for already opened routes
if i change the language from my setting screen inside my app, it does not change the language for already opened routes in my application. the language change is only reflect on unopened routes. i used react-native-localize and i18n-js. Given below…

melaku
- 89
- 2
- 11
3
votes
1 answer
I18n-js - is there a way to check if a translation exists or not?
Is there a way to check if a translation exists or not with the library I18n-js?

Simon
- 6,025
- 7
- 46
- 98
3
votes
1 answer
React native project with expo-localization and i18n-js
i am currently trying to implement localization depending on the system language of the device but something is not working as required.
I followed the exact same code on expo documentation, for eg. for the button i have i keep getting [MISSING…

kd12345
- 689
- 10
- 29
3
votes
1 answer
i18n won't translate correctly when inside array or object in React Native
I'm trying to use i18n-js to translate some strings into other languages. If I have my code in normal code, it works. Ex:
//Displays "Something" (no quotes) where I want it
translate("Something");
But if I put it inside an array or…

Amber Fisher
- 63
- 6
3
votes
1 answer
ReactJS & i18n.js: Translations with links
I have a ReactJS project that's using i18n.js for translations.
In i18n JSON file I have a line like this:
"register": {
"terms": "I have read and accept the Terms of Service"
}
I want only the "Terms of Service" part of the sentence to be a…

SevenNationS
- 109
- 1
- 9
3
votes
2 answers
How to use setLocale within i18n-js?
I am using i18n-js within my expo project to translate my app.
This is how I configure it:
import React from 'react';
import * as Localization from 'expo-localization';
import i18n from 'i18n-js';
export default function…

Dimitri Kopriwa
- 13,139
- 27
- 98
- 204
2
votes
0 answers
i18n-js Property 't' does not exist on type 'typeof import'
I installed the i18n-js library in a react-native project, and I got a problem with typescript.
I use the library this way:
i18n.js
import i18n from 'i18n-js';
import en from './locales/en.json';
import es from…

FabioDev
- 694
- 1
- 12
- 27
2
votes
1 answer
Mock I18n class from i18n-js to test with Jest in React Native with Expo
I'm try to do a testing for a component where I use i18n in React Native with Expo but, I'm getting an error that say Jest encountered an unexpected token.
Jest encountered an unexpected token
This usually means that you are trying to import a…

Fabian Montoya
- 407
- 4
- 19
2
votes
1 answer
How to set i18n.js fallback language?
I am using the i18n-js library.
In order to set its configuration, I am doing the following:
export function setI18nConfig(locale = undefined) {
// Fallback if no available language fits
const fallback = DEFAULT_APP_LANGUAGE;
const…

Raul
- 2,673
- 1
- 15
- 52
2
votes
1 answer
How to render component as a param using i18n-js in react-native?
I am using i18n-js for locales and translations. I am trying to render a react-native component using interpolation.
Following is the code for reference,
// Translate function (exposed using custom hooks)
const translate = useCallback((key, config)…

Abhishek Sharma
- 2,485
- 1
- 21
- 35
2
votes
0 answers
Internacionalization in app.config.js expo file
I use the i18n-js lib to make internacionalization in my apps.
In Expo, there's a file app.json with the app configs.
There is a possibility to create a app.config.js to customize some things in the file.
But I can't use import to do this, to…

André Kunde
- 21
- 4
2
votes
1 answer
How can i restart app when i change language in react native
I tried to create a picker that is used to change language. But some texts remain untranslated even if user selects different language. i tried
import * as RNLocalize from 'react-native-localize';
import I18n from 'i18n-js';
import memoize from…

melaku
- 89
- 2
- 11
2
votes
1 answer
Can I use flat json keys in i18n-js react native
I have a flat json as follows
'action.skip': 'Skip this for now',
'action.start': 'Start'
I want to call it as
{I18n.t('action.start')}
currently it is not working because i18n trying to find "action" key and its child "start" instead of…

Sebin Simon
- 1,596
- 2
- 17
- 28
1
vote
0 answers
Insert format/components between words in i18n-js
I'm using i18n-js in a React Native app, also Expo and expo-localization. Although the library provides interpolation for translated strings, I did not find a way to insert React or React Native components or styles between words to provide better…

jorge
- 23
- 5