https://github.com/dvsa/rsp-translation-service
Translation service to translate JSON into given languages using Azure Translation API.
https://github.com/dvsa/rsp-translation-service
Last synced: about 1 year ago
JSON representation
Translation service to translate JSON into given languages using Azure Translation API.
- Host: GitHub
- URL: https://github.com/dvsa/rsp-translation-service
- Owner: dvsa
- License: mit
- Created: 2023-01-31T13:35:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-10T17:34:57.000Z (over 3 years ago)
- Last Synced: 2025-02-08T22:28:34.541Z (over 1 year ago)
- Language: TypeScript
- Size: 188 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DVSA Translation Service
### Script that takes a JSON file and translates it to the given languages and outputs translated JSON files
## To Run
Clone or download the project
Create and set your credentials in a `.env` file.
In the `.env` file, add all the languages you want to translate as a comma separated list. Languages must be two-letter codes - anything that does not follow this format will be removed from the list of languages prior to translation. The Microsoft list of supported languages [can be found here](https://learn.microsoft.com/en-GB/azure/cognitive-services/translator/language-support). For example:
```
LANGUAGES=en,bg,fr,es,cy
```
Also in the `.env` file, add all the keys you want to translate as a comma separated list. If there are no keys set in the allow list, everything will be translated. For example:
```
ALLOW_LIST=site_title,feedback_banner,cookies,terms_conditions
```
Put the JSON file you want to translate into the `to-translate` directory. Ensure it is titled `lang.json`.
Set the Node version:
```shell
nvm use
```
If you don't have TypeScript installed:
```shell
npm install typescript ts-node --global --save-dev
```
Install all dependencies:
```shell
npm i
```
To run:
```shell
npm run translate
```