Medrecord Translations Middleware
This is a middleware built on a base ngx-translate for internal usage with Medrecord's components and extending their translations if they are not existed.
Installation
Add TranslateModule
from @ngx-translate/core
.
It requires HttpClientModule
.
app.module.ts
@NgModule({
...
imports: [
...
HttpClientModule,
TranslationMiddlewareModule
})
...
],
...
})
export class AppModule { }
Usage
Inject TranslationMiddlewareService
into your component.
Use method: addTranslation
for extending translations list.
Use translationMiddleware
instead of translation
.
API
Method addTranslation
- It is provided by TranslationMiddlewareService
and should be used for adding custom component translations.
setTranslation(language, [translation object])
Troubleshooting
If you have no i18n
folder in your assets or en.json
file you will start getting 404 error in your console. Ignore it or add i18n/en.json
as default file.