How to use the i18next.dir function in i18next

To help you get started, we’ve selected a few i18next examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github i18next / i18next / test / typescript / i18next-tests.ts View on Github external
// reload languages
i18next.reloadResources(['de', 'fr'])

// reload namespaces for all languages
i18next.reloadResources(null, ['ns1', 'ns2'])

// reload namespaces in languages
i18next.reloadResources(['de', 'fr'], ['ns1', 'ns2'])

// for current language
i18next.dir()

// for another language
i18next.dir('en-US') // -> "ltr";
i18next.dir('ar') // -> "rtl";

// key = 'hello {{what}}'
i18next.t('key', { what: i18next.format('world', 'uppercase') }) // -> hello WORLD

const newInstance = i18next.createInstance(
  {
    fallbackLng: 'en',
    ns: ['file1', 'file2'],
    defaultNS: 'file1',
    debug: true,
  },
  (err: any, t: i18next.TranslationFunction) => {
    if (err) {
      console.log('something went wrong loading', err)
      return
    }
github i18next / i18next / test / typescript / i18next-tests.ts View on Github external
i18next.reloadResources()

// reload languages
i18next.reloadResources(['de', 'fr'])

// reload namespaces for all languages
i18next.reloadResources(null, ['ns1', 'ns2'])

// reload namespaces in languages
i18next.reloadResources(['de', 'fr'], ['ns1', 'ns2'])

// for current language
i18next.dir()

// for another language
i18next.dir('en-US') // -> "ltr";
i18next.dir('ar') // -> "rtl";

// key = 'hello {{what}}'
i18next.t('key', { what: i18next.format('world', 'uppercase') }) // -> hello WORLD

const newInstance = i18next.createInstance(
  {
    fallbackLng: 'en',
    ns: ['file1', 'file2'],
    defaultNS: 'file1',
    debug: true,
  },
  (err: any, t: i18next.TranslationFunction) => {
    if (err) {
      console.log('something went wrong loading', err)
      return
github i18next / i18next / test / typescript / i18next-tests.ts View on Github external
})

// reload all
i18next.reloadResources()

// reload languages
i18next.reloadResources(['de', 'fr'])

// reload namespaces for all languages
i18next.reloadResources(null, ['ns1', 'ns2'])

// reload namespaces in languages
i18next.reloadResources(['de', 'fr'], ['ns1', 'ns2'])

// for current language
i18next.dir()

// for another language
i18next.dir('en-US') // -> "ltr";
i18next.dir('ar') // -> "rtl";

// key = 'hello {{what}}'
i18next.t('key', { what: i18next.format('world', 'uppercase') }) // -> hello WORLD

const newInstance = i18next.createInstance(
  {
    fallbackLng: 'en',
    ns: ['file1', 'file2'],
    defaultNS: 'file1',
    debug: true,
  },
  (err: any, t: i18next.TranslationFunction) => {
github berty / berty / client / react-native / common / i18n / index.web.js View on Github external
i18n.on('languageChanged', language => {
  if (!languages.hasOwnProperty(language)) {
    return
  }

  console.log(i18n.language)
  console.log(i18n.dir(i18n.language))
  I18nManager.forceRTL(isRTL())
})
github berty / berty / client / react-native / app / common / locale / index.web.js View on Github external
i18n.on('languageChanged', language => {
  if (!languages.hasOwnProperty(language)) {
    return
  }

  console.log(i18n.language)
  console.log(i18n.dir(i18n.language))
  I18nManager.forceRTL(isRTL())
})
github kobotoolbox / enketo-express / config / express.js View on Github external
res.locals.dir = function( lng ) {
        return i18next.dir( lng );
    };
    res.locals.basePath = req.app.get( 'base path' );
github berty / berty / client / react-native / common / i18n / index.js View on Github external
const isRTL = () => i18n.dir(i18n.language) === 'rtl'