olivier-m / minislate

A wysiwyg experiment
http://olivier-m.github.io/minislate/
MIT License
73 stars 9 forks source link

Add basic i18n support #6

Open yohanboniface opened 9 years ago

yohanboniface commented 9 years ago

Very simple translation management system.

Use tr('yourstring') when you deal with a string that needs to be translatable.

If you have dynamic variables, you can use tr('Title level {level}', {level: yourvar}).

Use tr.register({string: translation}) to populate the locale.

A new editor option is added, i18n, which, when present, will be used to register new localized strings.

So to add localized strings, one would do something like:

new Minilslate.simpleEditor(element, {
    i18n: {
        'Paragraph': 'Paragraphe',
        'Title level {level}': 'Titre niveau {level}',
        …
    }
}
yohanboniface commented 8 years ago

Piiing ;)

yohanboniface commented 8 years ago

hey @olivier-m any chance to get that merged on trunk (or reviewed) ? :)