robisim74 / angular-l10n

Angular library to translate texts, dates and numbers
MIT License
380 stars 59 forks source link

split big files #331

Closed Penelope7482 closed 1 year ago

Penelope7482 commented 2 years ago

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

robisim74 commented 2 years ago

@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 commented 1 year ago

Closed due to inactivity