Repository navigation
Create localization of strings - #2757
Don Jayamanne (DonJayamanne) merged 4 commits into
Conversation
This doesn't use the vscode-nls and vscode-nls-dev as they interfere with our code coverage. Adding new strings requires adding them to the localize.ts and the localize.nls.<locale>.json files. Future work would be to translate the nls.json files into xlf files for the loc team to own. We'd then write a build time task to turn the xlf files into the output nls.<locale>.json files so that this code works the same.
|
Please could you install the following extension https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig |
There was a problem hiding this comment.
Minor changes.
Oh yes, please could you add a news entry file.
You've indicated one exists in the PR, when there isn't one.
~Has a news entry file (remember to thank yourself!)
As you're a dev on the team, you don't need to thank your self, however we'll need a file that forms the basis for the release notes.
| loadedLocale = parseLocale(); | ||
|
|
||
| // Find the nls file that matches (if there is one) | ||
| const nlsFile = path.join(__dirname, 'i18n', `localize.nls.${loadedLocale}.json`); |
There was a problem hiding this comment.
Instead of using __dirname, please could you use EXTENSION_ROOT_DIR. #WontFix
There was a problem hiding this comment.
Actually I think __dirname is more appropriate. EXTENSION_ROOT_DIR means this file has to know where it is. Meaning if we move it we have to change the code. __dirname actually points to the correct location.
In reply to: 222081853 [](ancestors = 222081853)
There was a problem hiding this comment.
means this file has to know where it is.
Exactly, we must know where resources are located, instead of assuming their relative paths, relative to the source code.
Note: __dirname in this context points to out/client/utils/localize. as a result of which, the localize.nls.<local>.json files (resources) are in out directory.
These localization files are static resources and must be committed into VSC, hence it cannot sit in the ./out/... directory.
The i18n/localize.nls.<locale>.json should be placed in a special directory such as ./resources/i18n/... or ./resources/locales/, or ./localization/.... or other.
There was a problem hiding this comment.
I misunderstood how the output works. Didn't realize we could reference other folders.
I've switched it to all be in the package.nls..json files and for the package.nls.json to be the backup
No need to copy files to output and no need for extra json files
Don Jayamanne (DonJayamanne)
left a comment
There was a problem hiding this comment.
Rejecting just to ensure this doesn't get merged, else its all good.
Creation of a new module - localize.
This doesn't use the vscode-nls and vscode-nls-dev as they
interfere with our code coverage.
Adding new strings requires adding them to the localize.ts and the
localize.nls..json files.
Future work would be to translate the nls.json files into xlf files for
the loc team to own. We'd then write a build time task to turn the
xlf files into the output nls..json files so that this code
works the same.
For #463
package.jsonare pinned (e.g."1.2.3", not"^1.2.3"for the specified version)package-lock.jsonhas been regenerated by runningnpm install(if dependencies have changed)