1.0.0 • Published 7 years ago
tangy-translate v1.0.0
tangy-translate
A window.t function for translating strings. t('translate this string') 
installation
Install into your project:
npm install tangy-translateImport into your JS:
import `tangy-translate`Provide a translation:
fetch('translation.json')
  .then(response => response.json())
  .then(json => {
    window.translation = json
  })Provide translations to strings by attaching a window.translations object where the keys are the string to translate and the value is the translation.
Example:
{
  "foo": "foo",
  "bar": "bar"
}1.0.0
7 years ago