@becklyn/translator
The JS implementation of Symfony's Translator.
Last updated 2 months ago by apfelbox .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @becklyn/translator 
SYNC missed versions from official npm registry.

Symfony JavaScript Translator

This is a modern implementation of the JS translator to translate Symfony's translation messages. Best to be used with the translation bundle.

Initialization

For example like this (using mojave):

import {initFromGlobalData} from "mojave/init"; 
import {Translator} from "@becklyn/translator";

let translator = initFromGlobalData("TranslatorInit", new Translator());

A manual way to wire it up to global data is like this:

function loadGlobalData (key, handler)
{
    if (undefined === window[key])
    {
        return;
    }

    // replace global callback
    window[key].init = (data) => handler.init(data);
    // handle current data
    handler.init(window[key].data);
}

let translator = new Translator();
loadGlobalData("TranslatorInit", translator);

Current Tags

  • 1.3.0                                ...           latest (2 months ago)

7 Versions

  • 1.3.0                                ...           2 months ago
  • 1.2.0                                ...           4 months ago
  • 1.1.2                                ...           7 months ago
  • 1.1.1                                ...           7 months ago
  • 1.1.0                                ...           10 months ago
  • 1.0.1                                ...           10 months ago
  • 1.0.0                                ...           10 months ago
Maintainers (2)
Downloads
Today 0
This Week 7
This Month 15
Last Day 7
Last Week 7
Last Month 0
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |