Skip to content

Commit

Permalink
readme, change log
Browse files Browse the repository at this point in the history
  • Loading branch information
un33k committed Sep 12, 2018
1 parent d714e6b commit 4796940
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## 1.0.6

Enhancements:

- Simplify shared usage (I18nSharedModule)

## 1.0.5

Enhancements:
Expand Down
30 changes: 28 additions & 2 deletions README.md
Expand Up @@ -64,10 +64,11 @@ export const environment: AppCfg = {
```

```typescript
// In your app.component.ts
// In your app.module.ts

import { CfgModule } from '@nwx/cfg';
import { LoggerModule } from '@nwx/logger';
import { I18nModule } from '@nwx/i18n';

import { environment } from '../environments/environment';

Expand All @@ -77,7 +78,7 @@ import { environment } from '../environments/environment';
BrowserModule,
CfgModule.forRoot(environment), // make the environment injectable
LoggerModule,
I18nModule.forRoot() // use forChild() for lazy loaded modules
I18nModule.forRoot()
],
bootstrap: [AppComponent]
})
Expand All @@ -99,6 +100,7 @@ export class AppComponent {
title = 'Neekware';
constructor(public cfg: CfgService, public log: LogService, public i18n: I18nService) {
this.title = this.cfg.options.appName;
this.i18n.setCurrentLanguage('fr'); // set language to French
this.log.info('AppComponent loaded ...');
}
}
Expand Down Expand Up @@ -171,6 +173,30 @@ export class AppComponent {
}
```

```typescript
// In your shared.module.ts

import { I18nSharedModule } from '@nwx/i18n';

@NgModule({
declarations: [SharedComponent],
imports: [CommonModule, I18nSharedModule)],
})
export class SharedModule {}
```

```typescript
// In your lazy.module.ts

import { SharedModule } from './shared';

@NgModule({
declarations: [LazyComponent],
imports: [CommonModule, SharedModule]
})
export class LazyModule {}
```

# Note:

1. `@nwx/i18n` uses the great `@ngx-translate` package under the hood.
Expand Down

0 comments on commit 4796940

Please sign in to comment.