1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 18:53:29 +00:00

[SM-108] Refactor Reports - Add storybook stories (#3204)

This commit is contained in:
Oscar Hinton
2022-08-03 21:40:04 +02:00
committed by GitHub
parent 4398467368
commit 6b1652e34c
57 changed files with 512 additions and 223 deletions

View File

@@ -0,0 +1,38 @@
import { APP_INITIALIZER, NgModule } from "@angular/core";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { I18nService as BaseI18nService } from "@bitwarden/common/services/i18n.service";
import * as eng from "../../locales/en/messages.json";
class PreloadedEnglishI18nService extends BaseI18nService {
constructor() {
super("en", "", () => {
return Promise.resolve(eng);
});
}
}
function i18nInitializer(i18nService: I18nService): () => Promise<void> {
return async () => {
await (i18nService as any).init();
};
}
// This is a helper I18nService implementation that loads the english `message.json` eliminating
// the need for fetching them dynamically. It should only be used within storybook.
@NgModule({
providers: [
{
provide: I18nService,
useClass: PreloadedEnglishI18nService,
},
{
provide: APP_INITIALIZER,
useFactory: i18nInitializer,
deps: [I18nService],
multi: true,
},
],
})
export class PreloadedEnglishI18nModule {}