Skip to content

feat(provideTranslateService): langs #1581

@rbalet

Description

@rbalet

Current behavior

Actually, to add multiple lang inside the store, we need to do something similar to this

export const appConfig: ApplicationConfig = {
    providers: [
        provideTranslateService({
            fallbackLang: "en",
            loader: provideTranslateHttpLoader({
                prefix: "./i18n/",
                suffix: ".json",
                enforceLoading: true,
            }),
        }),
        provideAppInitializer(() => {
            const translate = inject(TranslateService);
            translate.addLangs(["de", "en"]); // Here
            translate.use("en");
        }),
    ],
};

Expected behavior

Being able to declare it directly inside the provideTranslateService

        provideTranslateService({
            langs: ['de', 'en'] // Here instead
            fallbackLang: "en",
            loader: provideTranslateHttpLoader({
                prefix: "./i18n/",
                suffix: ".json",
                enforceLoading: true,
            }),
        }),

What is the motivation / use case for changing the behavior?

It does reduce the complexity to use the library

Note: not adding lang, then calling use was (from my memory) creating a bug.
This may/will fix this issue also

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions