GithubHelp home page GithubHelp logo

Comments (5)

eyaleizenberg avatar eyaleizenberg commented on June 13, 2024 1

Well, in the end I just did this:
I18n.locale = I18n.currentLocale().replace(/_.+/, "")

But I wonder if there is a better way for this?

from react-native-i18n.

AlexanderZaytsev avatar AlexanderZaytsev commented on June 13, 2024

What are you trying to achieve? Do you want to fallback to en for en_US and en_GB? If so, there was a bug which I fixed in 0.0.6. Now you can do the following:

I18n.fallbacks = true

I18n.translations =
  en:
    test: 'test'

Now this translation will work for every en_* locale.

from react-native-i18n.

AlexanderZaytsev avatar AlexanderZaytsev commented on June 13, 2024

I have updated the README: https://github.com/AlexanderZaytsev/react-native-i18n/blob/master/README.md

from react-native-i18n.

eyaleizenberg avatar eyaleizenberg commented on June 13, 2024

I want 'de_DE' and 'de_US' to use 'de'. If the the 'de' translation doesn't exist, use 'en'.

from react-native-i18n.

AlexanderZaytsev avatar AlexanderZaytsev commented on June 13, 2024

You'll be able to achieve this in 0.0.6 with fallbacks enabled. Use de in your I18n.translations, de_DE and de_US will fallback to it. If de doesn't exist, I18n.js by default fallbacks to en.

from react-native-i18n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.