Inline Loaders
When working on a feature module or a library (which is common in a monorepo environment), we may want to have the translation files inside the module folder and ship them together with it.
To enable this feature, Transloco supports scope
with inline loaders. We can pass the scope name and an inline loader that leverages Webpack import function to lazy load the local translation files.
Let's say we have the following Angular CLI project:
- Standalone
- NgModule
📦projects
┗ 📂feature
┃ ┣ 📂src
┃ ┃ ┣ 📂lib
┃ ┃ ┃ ┣ 📂i18n
┃ ┃ ┃ ┃ ┣ 📜en.json
┃ ┃ ┃ ┃ ┗ 📜es.json
┃ ┃ ┃ ┣ 📜feature.component.ts
┃ ┃ ┃ ┣ 📜feature.routes.ts
┃ ┃ ┃ ┗ 📜feature.service.ts