blob: 429072701cb323e1369a95e600ea85169ed3e5fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.less']
})
export class AppComponent {
constructor(private translate:TranslateService){
translate.addLangs(['en', 'zh']);
translate.setDefaultLang('en');
// translate.use('en');
}
// 多语言
Language:String[] = ["zh","en"];
selectLanguage = "en";
changeLanguage(item){
this.selectLanguage = item;
this.translate.use(item);
}
}
|