DEV Community

ILshat Khamitov
ILshat Khamitov

Posted on

Add new dictionaries with translations to NestJS application using poedit.net

Links

https://poedit.net/ - desktop editor for po dictionaries

https://telegram.me/DevelopKaufmanBot - current bot in telegram

https://github.com/EndyKaufman/kaufman-bot -source code

Prepare

Add required libraries if they were not previously installed

npm i --save-dev rucken
npm i --save class-validator-multi-lang

Update scripts in package.json if not changed before

  "scripts": {
    ...
    "rucken": "rucken",
    "generate": "npm run rucken -- prepare --locales=en,ru && npm run lint:fix"
    ...
  },
Enter fullscreen mode Exit fullscreen mode

Using Poedit to create dictionaries with translations

Start preparing and generating the necessary files

npm run generate

Install the translation software for your operating room from https://poedit.net/

I installed for Ubuntu operating system

Run the program and select catalog manager
Run the program and select catalog manager

Add folder with project
Add folder with project

Set name of project
Set name of project

Add libs and apps folders
Add libs and apps folders

We see all possible translations
We see all possible translations

Click on the line with a red circle where not everything is translated
Click on the line with a red circle where not everything is translated

Select suggestion or enter you version of translate
Select suggestion or enter you version of translate

Update all dictionaries
Update all dictionaries<br>

Run preparing and generating the necessary files

npm run generate

Run preparing and generating the necessary files

Test from telegram
Test from telegram

Switch language in telegram
Switch language in telegram

In the next post I will use nestjs-custom-injector...

Top comments (0)