npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ionic-react-localization

v0.0.1

Published

Implementation for managing localization in Ionic React applications using Capacitor Preferences.

Downloads

3

Readme

ionic-react-localization

Implementation for managing localization in Ionic React applications using Capacitor Preferences.

To install the package, use the following command:

npm install ionic-react-localization

Usage Guide

Step 1: Create a translations.json file in your project root directory with translations in the following format:

{
  "en": {
    "translation": {
      "language": "LANGUAGE"
    }
  },
  "ja": {
    "translation": {
      "language": "言語"
    }
  },
  "ne": {
    "translation": {
      "language": "भाषा"
    }
  }
}

This file contains translations for different languages. Each language should have a "translation" object with keys corresponding to the translations.

Step 2: Import in main.tsx file

In your main.tsx, import necessary modules:

import { I18nextProvider } from 'react-i18next'
import { initI18n } from "ionic-react-localization";
import translations from '../translation.json';

Step 3: Initialize i18n and render application

Initialize i18n before rendering your application and wrap your app in I18nextProvider:

initI18n({ userCustomTranslations: translations }).then((i18n) => {
  root.render(
    <React.StrictMode>
      <I18nextProvider i18n={i18n}>
        <App />
      </I18nextProvider>
    </React.StrictMode>
  );
});

Example Project

An example project demonstrating the usage of this package can be found in the examples/sample directory of this repository. The example includes:

Clone the repository and run below commands:

cd examples/sample
ionic serve

Language code:

af: Afrikaans
am: Amharic
ar: Arabic
az: Azerbaijani
be: Belarusian
bg: Bulgarian
bn: Bengali
bs: Bosnian
ca: Catalan
chr: Cherokee
cs: Czech
cy: Welsh
da: Danish
de: German
dv: Divehi
el: Greek
en: English
eo: Esperanto
es: Spanish
et: Estonian
eu: Basque
fa: Persian
fi: Finnish
fil: Filipino
fo: Faroese
fr: French
ga: Irish
gd: Scottish Gaelic
gl: Galician
gn: Guarani
gu: Gujarati
he: Hebrew
hi: Hindi
hr: Croatian
ht: Haitian Creole
hu: Hungarian
hy: Armenian
id: Indonesian
is: Icelandic
it: Italian
iu: Inuktitut
ja: Japanese
ka: Georgian
kk: Kazakh
km: Khmer
kn: Kannada
ko: Korean
kok: Konkani
ku: Kurdish
ky: Kyrgyz
lb: Luxembourgish
lo: Lao
lt: Lithuanian
lv: Latvian
mi: Maori
mk: Macedonian
ml: Malayalam
mn: Mongolian
mr: Marathi
ms: Malay
mt: Maltese
my: Burmese
nb: Norwegian Bokmål
ne: Nepali
nl: Dutch
nn: Norwegian Nynorsk
no: Norwegian
oc: Occitan
or: Oriya
pa: Punjabi
pl: Polish
ps: Pashto
pt: Portuguese
qu: Quechua
rm: Romansh
ro: Romanian
ru: Russian
sa: Sanskrit
se: Northern Sami
si: Sinhala
sk: Slovak
sl: Slovenian
sq: Albanian
sr: Serbian
sv: Swedish
sw: Swahili
ta: Tamil
te: Telugu
th: Thai
tk: Turkmen
tr: Turkish
tt: Tatar
ug: Uyghur
uk: Ukrainian
ur: Urdu
uz: Uzbek
vi: Vietnamese
wo: Wolof
yo: Yoruba
zh: Chinese
zu: Zulu