Skip to content

Commit

Permalink
docs: add more info to localization doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Jul 11, 2024
1 parent 90fe8bb commit 0fca28d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/localization/localization-translate-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ You can create your own Translate Service, for example installing the `whatwg-fe

##### Install NPM package

You can install `whatwg-fetch` or any other library that you wish to use to load your JSON translation files.

```ts
npm install whatwg-fetch
```

##### Main.ts

You must make sure to implement all functions of the `TranslaterService` interface.

> for a full implementation demo with `whatwg-fetch`, take a look at [translate.service.ts](https://github.com/ghiscoding/slickgrid-universal/blob/master/examples/vite-demo-vanilla-bundle/src/translate.service.ts).
Create a Custom Translate Service and make sure to implement all functions that the `TranslaterService` interface requires.

```ts
export class TranslateService implements TranslaterService {
Expand All @@ -29,6 +29,7 @@ export class TranslateService implements TranslaterService {
use(language: string): Promise<any> | any {}
}
```
> for a full translater service implementation demo with `whatwg-fetch`, take a look at [translate.service.ts](https://github.com/ghiscoding/slickgrid-universal/blob/master/examples/vite-demo-vanilla-bundle/src/translate.service.ts).
#### Class sample
You need to add a translation key via the property `headerKey` to each column definition, for example: `headerKey: 'TITLE'`
Expand Down

0 comments on commit 0fca28d

Please sign in to comment.