title: How to get current locale with i18next / react-i18next?
body: <p>I'm new to react-native and I'm trying to get current locale from the device of the user. For now, I have 2 versions of my app : french and english. It works fine when I change the fallback language I do have the two versions of the app. But I can't manage to change the language directly from the device.</p>
  <p>We can change manually, but if we have set french language on device then we can't get french language directly.</p>
  <p><a href="https://i.stack.imgur.com/sfya9.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sfya9.gif" alt="enter image description here" /></a></p>
  <pre><code>import i18next from 'i18next';
  import {initReactI18next} from 'react-i18next';
  
  const languageDetector = {
    type: 'languageDetector',
    async: true,
    detect: cb =&gt; cb('en'),
    init: () =&gt; {},
    cacheUserLanguage: () =&gt; {},
  };
  
  i18next
    .use(languageDetector)
    .use(initReactI18next)
    .init({
      fallbackLng: 'en',
      debug: true,
      resources: {
        en: {
          translation: {
            hello: 'Hello world',
            change: 'Change language',
          },
        },
        sv: {
          translation: {
            hello: 'Hallo!',
            change: 'Goedemorgen',
          },
        },
      },
    });
  
  export default i18next;
  </code></pre>
  <p>App.js</p>
  <pre><code>import React from 'react';
  import { Text, View, TouchableOpacity } from 'react-native';
  import { useTranslation } from 'react-i18next';
  import './src/Traslations'
  
  
  export default function App() {
    const { t, i18n } = useTranslation();
    return (
      &lt;View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}&gt;
        &lt;Text style={{ fontSize: 20, marginBottom: 20 }}&gt;{t('hello')}&lt;/Text&gt;
        &lt;Text style={{ fontSize: 20, marginBottom: 20 }}&gt;{t('change')}&lt;/Text&gt;
  
        &lt;TouchableOpacity style={{backgroundColor: 'pink'}} onPress={() =&gt; i18n.changeLanguage(i18n.language === 'nl' ? 'en' : 'nl')}&gt;
          &lt;Text&gt;{t('change')}&lt;/Text&gt;
        &lt;/TouchableOpacity&gt;
      &lt;/View&gt;
    );
    }
  </code></pre>