Giter VIP home page Giter VIP logo

Comments (16)

bpasero avatar bpasero commented on June 10, 2024 1

@SounD120 I just released 1.1.27

from vscode-extension-vscode.

bpasero avatar bpasero commented on June 10, 2024

Adding @dbaeumer, I think the --locale switch should work even in extension tests if I am not mistaken.

from vscode-extension-vscode.

dbaeumer avatar dbaeumer commented on June 10, 2024

The --locale switch will work for VS Code and if a Russian language pack is installed it should respect this. It might be different for your extension. The JS code needs to be compiled for production (the JS rewriting needs to have taken place). Otherwise the JS code you are executing during test will not respect the locale setting.

from vscode-extension-vscode.

SounD120 avatar SounD120 commented on June 10, 2024

@bpasero , @dbaeumer Let me describe our full workflow in Azure DevOps for better understanding from both sides.

  1. We have build pipeline in Azure DevOps CI that transpiles our source TypeScript code with PROD preprocessor context, and after build we test our JS code with node ./node_modules/vscode/bin/test script, and if the tests are passed, we are packing JS code onto vsix. There are no processes that we are executing after build sequence to make any rewrites in the JS code. @dbaeumer could you please clarify what JS rewriting do you mean in this context?
  2. test script doesn't provide locale switching neither as startup argument nor as environment variable for this moment, so we cannot run tests with different locale in CI. Also, we tried to workaround it by replacing ./node_modules/vscode/bin/test with modified version which is explicitly set --locale: code and even after that our tests failed due to locale hasn't been switched.
    Let me know if need any additional information.

from vscode-extension-vscode.

dbaeumer avatar dbaeumer commented on June 10, 2024

The JS rewriting happens via the gulp tasks provided from vscode-nls-dev. I looked at your reprository and the build gulp tasks seems to do this. So all necessary translation files will be created.

When you start VS Code in the tests with a --locale param and an installed language pack for that locale will it come up in that locale?

from vscode-extension-vscode.

SounD120 avatar SounD120 commented on June 10, 2024

@bpasero , @dbaeumer As we understand the VS Code localization mechanism, it doesn't matter if we have installed language pack for the extensions localized with vscode-nls or not. Localization works if we run code --locale=ru locally, but if we try to apply --locale parameter in CI it is not, so we actually don't know how to switch VS Code language with test script. Also, test script doesn't provide extra parameter for running it with another locale and we had to switch it with our patched version during CI builds. With respect to JS rewriting, at the moment of testing all the localization bundles are already built, and the localize calls are rewrited, so it should not affect the language switching.

from vscode-extension-vscode.

bpasero avatar bpasero commented on June 10, 2024

@SounD120 how about a PR to fix the issue for everyone if it works for you?

from vscode-extension-vscode.

SounD120 avatar SounD120 commented on June 10, 2024

@bpasero The problem is that it is not work for us.

from vscode-extension-vscode.

bpasero avatar bpasero commented on June 10, 2024

Oh ok, your wording made it sound as if it was working.

from vscode-extension-vscode.

ruslan-bikkinin avatar ruslan-bikkinin commented on June 10, 2024

@bpasero summarizing all things:

  • test script doesn't provide an option to run extension tests under the VS Code instance with another locale
  • possible fix for it doesn't work for us for some reason

So we are asking for help to get it work for us.

from vscode-extension-vscode.

bpasero avatar bpasero commented on June 10, 2024

@ruslan-bikkinin I still think the change to the test file would be valuable so that the --locale is passed to the instance. For example with the following steps I am able to bring up a test instance in german locale (for VSCode at least):

  • install the german language pack in the instance of VSCode that the test script is downloading
  • add --locale=de to the arguments in the test file
  • run npm run test from the command line

Now, I am not the right person to help you with how translations are installed for extensions. Waiting for @dbaeumer to comment on what you need to do to install localizations for an extension.

from vscode-extension-vscode.

dbaeumer avatar dbaeumer commented on June 10, 2024

In @SounD120 case the localization are bundled with the extension since the are not part of the core VS drop and therefore not part of the language packs. So IMO if the test instance starts in German locale and the extension is compiled for productions (produces localization files) and has a German translation the strings should show up in German.

from vscode-extension-vscode.

bpasero avatar bpasero commented on June 10, 2024

@SounD120 is that true?

from vscode-extension-vscode.

SounD120 avatar SounD120 commented on June 10, 2024

@bpasero , @dbaeumer I sent you a direct email with the details.

from vscode-extension-vscode.

SounD120 avatar SounD120 commented on June 10, 2024

@bpasero , @dbaeumer Thanks a lot for your help, guys. We found the way to solve our issue, so I proposed a PR that adds locale switching functionality to test script

from vscode-extension-vscode.

SounD120 avatar SounD120 commented on June 10, 2024

@bpasero Could you please clarify when the new version of the package will be released?

from vscode-extension-vscode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.