如何使用ngx translateservice翻译typescript中的方法
在这个问题中,我试图用所有这些示例来解决我的任务,但我不知道如何将TranslateService连接到我的方法 瑞典语翻译文件如何使用ngx translateservice翻译typescript中的方法,typescript,ngx-translate,Typescript,Ngx Translate,在这个问题中,我试图用所有这些示例来解决我的任务,但我不知道如何将TranslateService连接到我的方法 瑞典语翻译文件se.json(无键) 英文翻译文件en.json(无键) 打字稿: 从“@ngx translate/core”导入{TranslateService}” 我要转换的方法: setColumns(): void { this.loggedInUserType = Meteor.user().profile.user_type; if (this.type ==
se.json
(无键)
英文翻译文件en.json
(无键)
打字稿:
从“@ngx translate/core”导入{TranslateService}”
我要转换的方法:
setColumns(): void {
this.loggedInUserType = Meteor.user().profile.user_type;
if (this.type === "history") {
this.columns = [
{ header: "NAME" },
{ header: "TOTALSUM" },
{ header: "VAT" },
{ header: "INVOICES" },
];
} else if (this.type === "clients") {
this.columns = [
{ header: "NAME" },
{ header: "ORGANIZATIONNUMBER" },
{ header: "CITY" },
{ header: "COUNTRY" },
{ header: "ACTIONS" },
];
this.getClients();
}
}
{
NAME: Name
}
constructor {
private translate: TranslateService
} {
this.translate.use(localStorage.getItem("language")); // Get selected language
}
setColumns(): void {
this.loggedInUserType = Meteor.user().profile.user_type;
if (this.type === "history") {
this.columns = [
{ header: "NAME" },
{ header: "TOTALSUM" },
{ header: "VAT" },
{ header: "INVOICES" },
];
} else if (this.type === "clients") {
this.columns = [
{ header: "NAME" },
{ header: "ORGANIZATIONNUMBER" },
{ header: "CITY" },
{ header: "COUNTRY" },
{ header: "ACTIONS" },
];
this.getClients();
}
}