https://github.com/toonvanstrijp/i18n-demo
https://github.com/toonvanstrijp/i18n-demo
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/toonvanstrijp/i18n-demo
- Owner: toonvanstrijp
- Created: 2020-11-04T15:13:36.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-04T15:13:54.000Z (almost 5 years ago)
- Last Synced: 2024-12-31T16:25:29.004Z (10 months ago)
- Language: TypeScript
- Size: 85.9 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## nest-i18n demo
This project makes use of the `nest-i18n` library. It shows you how to implement `i18n` functionallity in your project.
## Start
To start the project run```
npm run start:dev
```For the purpose of this demo I implemented 3 routes.
- `http://localhost:3000/hello`
- `http://localhost:3000/goodbye`
- `http://localhost:3000/:lang/path`This demo implements 3 different types over resolvers.
- `PathResolver` (custom) this resolves the language based on the url. `http://localhost:3000/nl/path` or `http://localhost:3000/en/path`
- `QueryResolver` This resolver tries to collect the data based on the query parameters. This is usefull so that you can easily override the language of the response you want. `http://localhost:3000/hello?lang=en` or `http://localhost:3000/hello?lang=nl`
- `AcceptLanguageResolver` This resolver grabs the language based on the `accept-language` header. (language of you browser)