Angular translate plugin not firing up
Asked Answered
E

4

5

I have installed the Angular Translator plugin but it doesn't seems to work.

  • I've tried using the default shortcut: "ctrl + alt + T";
  • I've tried changing the shortcut to "alt + t";
  • I've tried using it through the command prompt: enter image description here

But nothing is happening and I don't get any error messages.

I'm using VSCode 1.38.1 and Angular 8.

Any idea why I'm not able to use this plugin? I will also accpet a reliant alternative as an answer to my question.

Many thanks.

Enterogastrone answered 23/9, 2019 at 10:4 Comment(0)
M
7

See the documentation and make sure that your solution has both the folder created and the package installed.

Requirements

There should be an i18n folder inside the src folder with an en.json File.

This extension assumes that Angular Project should has the npm package @ngx-translate/core installed.

Known Issues

The extension will not work if the requirement specified above is not met. It will not create a file automatically in case it is not found.

Montane answered 25/9, 2019 at 14:59 Comment(0)
C
2

Make Sure you have the @ngx-translate/core installed in the project. Go to project folder and install the package library with this command: npm i @ngx-translate/core

Convenient answered 28/9, 2019 at 4:8 Comment(0)
A
2

After looking at the plugin, it doesn't seem like a good way to do your translations. Piping everything could have a negative effect on performance and it is not the official Angular way of doing it.

I would follow the i18n guide that Angular provides and correctly tag your items with the i18n tag and then utilize the angular cli, (e.g. ng xi18n --output-path src/i18n) to generate your translation files. Last I checked, you still had to do a separate build for each language, but pre-compiled performance is way superior to on-the-fly. This is quite a rabbit hole and beyond the scope of this question, but I think you'll have better results in the long term if you step away from the plugin altogether.

Angular guide on i18n: https://angular.io/guide/i18n

Some additional info on i18n: https://medium.com/@feloy/deploying-an-i18n-angular-app-with-angular-cli-fc788f17e358

Adel answered 2/10, 2019 at 0:16 Comment(0)
H
0

https://marketplace.visualstudio.com/items?itemName=RohanAgarwal-Vscode.angular-translator#overview

Makes the corresponding entry of the selected string in en.json file, with a maximum key lenght of 5 words. Duplicate entries are not made. adds translate pipe adds to en.json

Requirements There should be an i18n folder inside the src folder with an en.json File.

This extension assumes that Angular Project should has the npm package @ngx-translate/core installed.

Known Issues The extension will not work if the requirement specified above is not met. It will not create a file automatically in case it is not found.

if it is not resolve uninstall extension and close VS code then re open VScode then install again and reopen IDE

Hinterland answered 1/10, 2019 at 4:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.