From dece03859e73206fe4bfed2cfd905f3ca51cccd9 Mon Sep 17 00:00:00 2001 From: Raphael Luba Date: Tue, 5 Jun 2018 14:44:40 +0200 Subject: [PATCH] Update I18N documentation The section about using `BaseI18N` was outdated: * `TCustomAttribute` already observes language change events and updates itself. * Base18N does not respect `t-params`, causing incorrect translations. See [issue 273 for details](https://github.com/aurelia/i18n/issues/273#issuecomment-394313599) --- doc/article/en-US/i18n-with-aurelia.md | 43 +------------------------- 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/doc/article/en-US/i18n-with-aurelia.md b/doc/article/en-US/i18n-with-aurelia.md index 4ee64dbd..19ca9f81 100644 --- a/doc/article/en-US/i18n-with-aurelia.md +++ b/doc/article/en-US/i18n-with-aurelia.md @@ -485,48 +485,7 @@ Notice in the above example that the key was set to `home.title`. This will make -Use `updateTranslation()` to update all translations within the children of the element that is passed to it. -The following example shows how a view model can be configured to update it's contents when the view is attached and every time a locale is changed. - - - - import {I18N} from 'aurelia-i18n'; - import {EventAggregator} from 'aurelia-event-aggregator'; - - export class MyDemoVM { - static inject = [I18N,Element,EventAggregator]; - constructor(i18n,element,ea) { - this.i18n = i18n; - this.element = element; - - ea.subscribe('i18n:locale:changed', payload => { - this.i18n.updateTranslations(this.element); - }); - } - - attached(){ - this.i18n.updateTranslations(this.element); - } - } - - - -Alternatively you may extend your VM with the provided Base-I18N-VM, which will set that up for you automatically. - - - - import {BaseI18N} from 'aurelia-i18n'; - - export class MyDemoVM extends BaseI18N { - - } - - - -> Info -> Just remember in case you define your own `constructor`, to call `this.super` and pass it the instances of its -dependencies as described in the previous example. Same applies to `attached`, although nothing needs to be passed -in here +Use `i18n.updateTranslation()` to update all translations within the children of the element that is passed to it. #### Specifying attributes