@brandingbrand/fsi18n
    TypeScript icon, indicating that this package has built-in type declarations

    11.0.0 • Public • Published

    FSI18n

    Internationalization helper for Flagship. Automatically reads the user's current locale and uses it to format numbers, dates, and strings.

    Uses react-native-i18n/i18n-js for strings, Number.prototype.toLocaleString for numbers, and Date.prototype.toLocaleString under the hood.

    Installation

    yarn add @brandingbrand/fsi18n
    yarn add react-native-i18n

    The react-native-i18n package must be added to your project as a dependency so the native modules will link correctly.

    Example Usage

    Assume the user's language preference is set to French (fr-FR).

    import FSI18n from '@brandingbrand/fsi18n';
    const translations = {
      en: {
        greeting: 'Hello'
      },
      fr: {
        greeting: 'Bonjour'
      },
      es: {
        greeting: 'Hola'
      }
    }
    
    FSI18n.addTranslations(translations);
    FSI18n.string('greeting'); // Bonjour
    import FSI18n from '@brandingbrand/fsi18n';
    FSI18n.number(1234.56); // 1 234,56
    import FSI18n from '@brandingbrand/fsi18n';
    FSI18n.currency(1234.56, 'EUR'); // 1 234,56 €
    FSI18n.currency(1234.56, undefined, {
      currency: 'USD',
      currencyDisplay: 'code'
    }); // 1 234,56 USD
    import FSI18n from '@brandingbrand/fsi18n';
    FSI18n.percent(.123456); // 12 %
    import FSI18n from '@brandingbrand/fsi18n';
    const importantDate = new Date('Nov 1, 2018');
    FSI18n.date(importantDate); // 01/11/2018

    Keywords

    none

    Install

    npm i @brandingbrand/fsi18n

    DownloadsWeekly Downloads

    3,202

    Version

    11.0.0

    License

    MIT

    Unpacked Size

    122 kB

    Total Files

    37

    Last publish

    Collaborators

    • cympak
    • raghunandanp
    • patilsneha2907
    • coughdrop
    • swhite2
    • angelotrif
    • roanblanchard
    • evan.katz
    • chukohsin
    • laineh
    • chrisjlan89branding
    • davidwachlin.bb
    • clapton
    • rosahbruno
    • henry.saintjuste
    • markwissler
    • amandaphail-bb
    • its.hui3
    • ray.wu
    • mjmangus16
    • elad.karni
    • maksymdeminbbc
    • jon.ploucha
    • nathan-sankbeil
    • branderbrett
    • skyeckstrom
    • nickburkhartbb
    • bbtravis
    • deemaabdallah
    • msiauko
    • tuckerbrander
    • jasonmosleybb
    • dshadrick
    • nickbb
    • notajvento
    • andyschwob
    • brad.habenicht
    • xero
    • mike.lux
    • caleb.griffith
    • tim.matyas
    • olksns
    • varzamanbb
    • bb_jenkins
    • crherman7
    • anna.larionova
    • olexandor
    • bodrus
    • cboetto
    • huizhuz
    • danrudolf2
    • celuchnb
    • abhishek_npm
    • lhenze33
    • winterss
    • romaniukua
    • tboetto
    • erichfeinstein
    • sjotterman
    • zrispo
    • omarkoueifi
    • danish.khalid
    • devs9-core
    • alex-black112
    • nasliedkov
    • wsedlacekc
    • john-marcello
    • dman01989
    • bhushan.kini
    • kyleb59
    • vyy7gn8j297flmyqgsmb
    • beaukenny
    • edelgado20
    • brandonacb
    • seanirby
    • sauceknight
    • ckornell
    • jmwr
    • mjweb48
    • winescout
    • southpeter
    • gametack
    • bryan-boeing
    • dmitriy_pchela
    • thepinkhatdev
    • a4heng
    • bbksmith
    • ashleygerst
    • gregwinn
    • clockelliptic
    • nevidomskii
    • jcsison
    • freesco16
    • jamesgraham2595
    • joshblevins
    • manjubillupalli
    • scbb31994
    • andrey_ionel
    • christianlovern