0.1.14 • Published 7 years ago

@slicky/extension-translator v0.1.14

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Slicky/ExtensionTranslator

Slicky extension for localization.

Installation

$ npm install --add-prod @slicky/extension-translator

Now add it into your application.ts file:

import {TranslatorExtension} from '@slicky/extension-translator';

// ... create app

app.addExtension(new TranslatorExtension('en'));

You need to provide default language.

Documentation

Complete documentation for translator could be found here.

After registering the TranslatorExtension you'll be able to use translator in templates or in components:

import {Component} from '@slicky/core';
import {ComponentTranslator} from '@slicky/extension-translator';

@Component({
	selector: 'home',
	template: '{{ "home.headline" | translate }}',
	translations: {
		en: {
			home: {
				headline: 'Home headline',
			},
		},
	},
})
class HomeComponent
{
	
	
	constructor(translator: ComponentTranslator)
	{
		console.log(translator.translate('home.headline'));		// "Home headline"
	}
	
}

It's a good idea to put translations for components into their own files.

0.1.14

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago