angular-l10n icon indicating copy to clipboard operation
angular-l10n copied to clipboard

split big files

Open Penelope7482 opened this issue 4 years ago • 1 comments

Is there a way to split one big file into multiples files? I mean i have more than 4000 lines in my french translation file and i'd like to split it into multiples files to help to maintain it in an angular app.

Thanks

Penelope7482 avatar Nov 09 '21 17:11 Penelope7482

@Penelope7482 please, next time follow issue template.

Yes, you should split big files into multiple files, because files are loading asynchronously, and even better according to the topic or modules they belong to (especially if lazy loaded). Just add the assets to the list of providers in the configuration, for example:

export const l10nConfig: L10nConfig = {
    ...
    providers: [
        { name: 'global', asset: './assets/i18n/global' },
        { name: 'home', asset: './assets/i18n/home' },
        { name: 'about', asset: './assets/i18n/about' },
        ...
    ],
    ...
};

In the sample above, should have in assets/i18n folder global-fr.json, home-fr.json, about-fr.json, and obviously one for each language.

About lazy modules, please see the docs.

Greetings

robisim74 avatar Nov 09 '21 20:11 robisim74

Closed due to inactivity

robisim74 avatar May 14 '23 07:05 robisim74