1.0.2 • Published 2 years ago

i18n-vanilla v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

i18n-vanilla

Create a folder and put it language files in json format, then import the package into your vanilla project and create a instance. Now call the load method

Attention: In the load method, you must use a parameter whose value is the same as the name of your language file.

NameTypeStatusDescription
languagesstring[]requiredRegister languages you want to use
localesPathstringnullableLanguage files folder. If not specified, it will be in 'src/i18n' by default;
import Translate from 'i18n-vanilla';


const translate = new Translate({
  languages: ["en", "fr"],
  localesPath: 'src/i18n'
});

translate.load("en")
//src/i18n/en.json
{
    "HELLO": "Hello"
}

//src/i18n/fr.json
{
    "HELLO": "Bonjour"
}
  <div i18n="HELLO"></div>
  <input type="text" i18n="HELLO" i18n-attr="placeholder" >
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.0

2 years ago