Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing Translation Directory On-the-Fly #175

Open
queejie opened this issue Jul 25, 2016 · 2 comments
Open

Changing Translation Directory On-the-Fly #175

queejie opened this issue Jul 25, 2016 · 2 comments

Comments

@queejie
Copy link

queejie commented Jul 25, 2016

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.

@ocombe
Copy link
Member

ocombe commented Aug 13, 2016

Hello, for now it isn't possible to change the prefix/suffix of the loader after bootstrap, but you could make a PR to change this :)

@red-0ne
Copy link

red-0ne commented Aug 21, 2016

This should be possible by using a custom TranslateLoader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants