Skip to content

Changing Translation Directory On-the-Fly #175

Open
@queejie

Description

@queejie

I am using ionic 2 and have the translations working fine, using the following bootstrap:

ionicBootstrap(CogicApp,
    [
        ROUTER_PROVIDERS,
        HTTP_PROVIDERS,
        new Provider(Window, {useValue: window}),
        new Provider(TranslateLoader, {
            useFactory: (http: Http) => new TranslateStaticLoader(http, '/site/default/translations', '.json'),
            deps: [Http]
        }),
        {provide: PLATFORM_PIPES, useValue: TranslatePipe, multi: true},
        Config,
        MemberData,
        ResourceData,
        UserData,
        TranslateService
    ],
    {
        tabbarPlacement: 'bottom'
    });

Unfortunately, the Config object needs to change the directory of the translations based on parsing the domain name. I can't figure out how to either pass the Config variable name to the TranslateLoader or to tell it to reload using a different directory somehow in the Config service. I realize this is partly due to my not fully understanding I2/A2 yet, but I'm hoping there might be an easy fix for this that other people might find helpful as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions