Closed dpfavand closed 5 years ago
A colleague let me know this might be caused by our webpack/typescript build process not compiling the language .ts files down to .js. If that's the case the issue might be how the plugin acts in a webpack environment (vs. how it worked in the previous Nativescript build process). Unfortunately I don't fully understand how the Webpack and Nativescript build process works.
Language files are loaded in the hooks using NodeJS. It does not work with .ts
files, you have to compile them first. Usually it works because nativescript-dev-typescript
does the job for you.
Ah, this is making more sense now. Using Webpack, my understanding is that TS files are compiled and bundled, but individual JS files are not saved in the file system. (Similarly, individual CSS files are not generated from SCSS.) Because JS files are not being generated, nativescript-localize isn't picking them up.
If that's correct, then it seems there are a couple options:
Indeed, the easiest way is to save localization file as JS. I just changed that in the demo-angular too.
38 broke translation updates for us because we stored translations in
.ts
files instead of.js
.I'm not sure if there's a good reason for us to use .ts files except that everything else in our project is also TypeScript.
Is there a reason to allow .js but not .ts? If not, I'll submit a PR to add .ts to the list of allowed extensions.