angular-tiny-translate

small library to translate with current language without any implicit loading and other unused trash. you load only library and attach into your app translations and that is it.

Usage no npm install needed!

<script type="module">
  import angularTinyTranslate from 'https://cdn.skypack.dev/angular-tiny-translate';
</script>

README

npm npm Dependency Status devDependency Status

angular-tiny-translate

install

npm install angular-tiny-translate -S

Small modular library for translations without unused dust

angular
  .module('my.app', [
    'angular-tiny-translate'
  ])

  /*@ngInject*/
  .config((TinyTranslate) => {
    TinyTranslate.translates({
      'some_prefix1': {
        'some_key1': 'some_translation1'
      },
      'some_prefix2': {
        'some_key2': 'some_translation2',
        '*': '{*} times'
      }
    })  
  })
  <!-- someVar = 'some_key2' -->
  <h1>{{ someVar | tr: 'some_prefix2' }}</h1>
  <!-- result -->
  <h1>some_translation2</h1>
  <!-- someVar = '5' -->
  <h1>{{ someVar | tr: 'some_prefix2' }}</h1>
  <!-- result -->
  <h1>5 times</h1>