question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I18n. Fallback doesn't work when using translations outside of Components

See original GitHub issue

Helloo,

I have a config like this for image picker:

import I18n from 'react-native-i18n'

const PICKER_OPTIONS = {
    title: I18n.t('avatar_title'),
    cancelButtonTitle: I18n.t('avatar_cancel'),
    takePhotoButtonTitle: I18n.t('avatar_takePicture'),
    chooseFromLibraryButtonTitle: I18n.t('avatar_takeFromLibrary'),
}
export default PICKER_OPTIONS

and I receive missing en-US translation with fallback activated. When I use the same I18n.t(‘avatar_title’) in React Components it gets translated.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
GantMancommented, Sep 27, 2016

@ruskid - I didn’t have time to really create an example of the issue, so I just moved the order of imports like you suggested. That way if what you said works, then we’re good.

Please reopen if the issue persists.

0reactions
GantMancommented, Sep 22, 2016

wow… will do

Read more comments on GitHub >

github_iconTop Results From Across the Web

i18next translation outside component - Stack Overflow
You are using a backend service to fetch translations asynchronously in the browser. When importing i18n you probably expected translation ...
Read more >
Fallback - i18next documentation
i18next by default loads its translations from one file named translation . However, you can configure it to load from multiple files, called...
Read more >
The Ultimate Vue Localization Guide | Phrase
Dive into Vue localization and learn how to plug the Vue I18n library into your app, so you can make it accessible to...
Read more >
Rails Internationalization (I18n) API - Ruby on Rails Guides
The I18n library will use English as a default locale, i.e. if a different locale is not set, :en will be used for...
Read more >
next-translate - npm
Tiny and powerful i18n tools (Next plugin + API) to translate your Next.js pages.. Latest version: 1.6.0, last published: 3 months ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found