Skip to content

Commit 0110e93

Browse files
committed
make translations actually work!
1 parent ba92b51 commit 0110e93

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

.storybook/bootstrap.module.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { NgModule } from "@angular/core";
2+
import { TranslateModule, TranslateService } from "@ngx-translate/core";
3+
const en = require("./../src/i18n/en.json");
4+
5+
@NgModule({
6+
imports: [
7+
TranslateModule.forRoot()
8+
]
9+
})
10+
export class BootstrapModule {
11+
constructor(private translateService: TranslateService) {
12+
this.translateService.setDefaultLang("en");
13+
this.translateService.use("en");
14+
this.translateService.setTranslation("en", en);
15+
}
16+
}

src/dropdown/dropdown.stories.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ import { withNotes } from "@storybook/addon-notes";
33
import { action } from "@storybook/addon-actions";
44
import { withKnobs, boolean, object } from "@storybook/addon-knobs/angular";
55

6-
import { TranslateModule } from "@ngx-translate/core";
7-
86
import { DropdownModule } from "../";
97

8+
// needed to init ngx translate and load the translations
9+
import { BootstrapModule } from "../../.storybook/bootstrap.module";
10+
1011
storiesOf("Dropdown", module)
1112
.addDecorator(
1213
moduleMetadata({
1314
imports: [
1415
DropdownModule,
15-
TranslateModule.forRoot()
16+
BootstrapModule
1617
],
1718
})
1819
)

0 commit comments

Comments
 (0)