23.191.0 • Published 10 months ago
@ng-dot/translate v23.191.0
@ng-dot/translate
Reusable String operations for translation with Dynamic Markup
Concept:
Define
- Short String as like Noun, Verb
- Sync Load
Text
- Long String as like Paragraph
Async Load
Getting Start
language
will Auto-select from HTMLlang Attribute. If it does not set in AppModule
.
import {NgModule} from '@angular/core';
import {TextModule} from '@ng-dot/translate';
@NgModule({
imports: [
TextModule.forRoot({
language: 'en'
})
]
})
export class AppModule {
}
Built-in Data
@NgModule({
imports: [
TextModule.forFeature({
words: {
en: {
FOO: 'foo',
BAR: 'bar'
}
}
})
]
})
export class LibModule {
}
Get define
value
import {DotTranslateService} from '@ng-dot/translate';
@Component({
template: `
FOO: {{'FOO' | ofDefine}}
BAR: {{'BAR' | ofDefine}}
`
})
export class FooComponent {
constructor(_translate: DotTranslateService) {
const foo = _translate.getDefine('FOO');
}
}
Get text
value
import {DotTranslateService} from '@ng-dot/translate';
@Component({
template: `
{{'foo' | ofText}}
{{'bar' | ofText}}
`
})
export class FooComponent {
foo: string;
bar: string;
constructor(_translate: DotTranslateService) {
_translate.text('foo')
.subscribe(foo => {
this.foo = foo;
});
_translate.text('bar')
.subscribe(bar => {
this.bar = bar;
});
}
}
23.191.0
10 months ago
23.181.24
11 months ago
23.131.0
1 year ago
23.173.0
12 months ago
23.61.0
1 year ago
23.40.0
1 year ago
23.3.0
1 year ago
22.294.0
2 years ago
22.306.0
2 years ago
22.222.0
2 years ago
22.217.0
2 years ago
22.173.0
2 years ago
22.171.1
2 years ago
22.171.0
2 years ago
22.167.1
2 years ago
22.167.0
2 years ago