Comments (11)
You can apply some configuration before I18n is loaded:
I18n.defaultLocale = 'pt-BR'
More infos here https://github.com/fnando/i18n-js#setting-up
from react-native-i18n.
thanks dude =)
from react-native-i18n.
Hi, I'm having some problem configuration with this plugin...
My device is on English, and I would like that Spanish Language was the default language, if for example, an Italian Device install the app the language default must be Spanish. But my device is ignoring my language device (en output of I18n.currentLocale() function)
This is my current configuration and code:
// Import
import I18n from 'react-native-i18n';
.. stuff code ...
// Configuration I18n
I18n.defaultLocale = 'es-ES';
I18n.fallbacks = true;
I18n.translations = {
en: {
greeting: 'Hi!'
},
es: {
greeting: 'Hola!'
}
};
.. stuff code ...
// Component Class and StyleSheet code...
export default class MyScreen extends Component {
render() {
return (
<View>
<Text style={styles.signupLinkText}>{I18n.t('greeting')}</Text>
</View>
)
}
}
Output desired:
Italian Device -> locale (it) -> greeting message -> Hola!
Spanish Device -> locale (es) -> greeting message -> Hola!
USA Device -> locale (en-US) -> greeting message -> Hi!
UK Device -> locale (en-UK) -> greeting message -> Hi!
Thank you so much!! Excellent work!!
from react-native-i18n.
Hi, I solved adding this to my configuration:
I18n.locale = I18n.currentLocale();
I think that this is a bug, check this: #43
from react-native-i18n.
But we can not get the devices default locale. It always returns 'en'
from react-native-i18n.
@isener Ok, you are right... always return 'en', I don't know why in one moment, it was returning other language, sorry for the mistake...
from react-native-i18n.
@chemitaxis mate I couldn't resolved why it happened. If I would, also notice to you. Thanks
from react-native-i18n.
from react-native-i18n.
Somebody solved it?
from react-native-i18n.
This is dont work:
I18n.defaultLocale = 'pt-BR'
from react-native-i18n.
When my app doesn't have the translations, I put I18n.locale = 'pt-BR';
rather than I18n.defaultLocale = 'pt-BR'
and works.
from react-native-i18n.
Related Issues (20)
- Rerender Text change
- v2.0.15 broke android release build HOT 1
- Not working on IOS xcode12.4/12.5 HOT 1
- Android native code issue
- Not compile() HOT 2
- for latest RN
- missing en-US "" translation
- compile() on react-native-i18n package is not found; build always failing when package is used HOT 1
- android can not build with error compile HOT 2
- Android Could not find method compile() for arguments [project ':react-native-i18n'] HOT 2
- Android cannot build with minSdkVersion in AndroidManifest
- patch gradle android issue
- please upgrade gradle file.
- Compile keyword does not exist in the new versions of Gradle HOT 1
- react-native-i18n not working on React Native 0.70+
- Could not find method compile() for arguments
- react-native-locale-detector oldies problem
- not working on RN 072
- A problem occurred evaluating project ':react-native-i18n'. > Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
- compile issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-i18n.