none
Cannot localize VSIX Menu Command RRS feed

  • Question

  • Hello, I'm trying to create a small and useful visual studio extension, using visx project.
    (My Visual Studio Version is 2019 Enterprise 2019 Preview Version 16.2.0 Preview 1.0 and Visual Studio Professional 2017 Version 15.9.12)
    What I really suffer from is that I cannot localize the menu text of this vsix package.
    The guidance which I referred to and followed was the MSDocument site, below.
    --------
    Prerequisites
    --------
    To focus the problem, I made a very simple Vsix project named "VsixLocalizeTrial", 
    and added a CustomCommand named "TestCommand01" which shows Information alert message
    when the menu is clicked. (I localized the first line of message, using .resx file, and it works fine.)

    I'm trying to localize just the button text of this MenuItem.

    To do so, I copied the "VsixLocalizeTrialPackage.vsct" file and pasted it to it's English, Spanish, Japanese corresponding vsct files (VsixLocalizeTrialPackage.en-US.vsct, VsixLocalizeTrialPackage.es-ES.vsct, VsixLocalizeTrialPackage.ja-JP.vsct) . I changed the button text of TestCommand01Id to the native expression for their corresponding language.

    Then I closed the project in Visual Studio, opned the csproj file by other editor, and adjusted the  VSCTCompile element, add a ResourceName element that points to Menus.ctmenu, as follows.
    <ItemGroup>
      <VSCTCompile Include="VsixLocalizeTrialPackage.vsct">
        <ResourceName>Menus.ctmenu</ResourceName>
      </VSCTCompile>
      <VSCTCompile Include="VsixLocalizeTrialPackage.en-US.vsct">
        <ResourceName>Menus.ctmenu</ResourceName>
      </VSCTCompile>
      <VSCTCompile Include="VsixLocalizeTrialPackage.es-ES.vsct">
        <ResourceName>Menus.ctmenu</ResourceName>
      </VSCTCompile>
      <VSCTCompile Include="VsixLocalizeTrialPackage.ja-JP.vsct">
        <ResourceName>Menus.ctmenu</ResourceName>
      </VSCTCompile>
    </ItemGroup>

    What I expect is that I can see localized " Invoke TestCommand01" command menu
    just below the "Tool" menu, in the experimental Visual Studio instance,
    when Debbug begins.

    --------
    Symptoms
    --------

    I can see "Invoke TestCommand01"menu which is not localized.
    So, in accordance with the advice in the MSDocs, I've added the entry at the bottom of the AssemblyInfo fie of the vsix as follows.
    [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
    →[assembly: NeutralResourcesLanguage("es-ES", UltimateResourceFallbackLocation.Satellite)]
    →[assembly: NeutralResourcesLanguage("ja-JP", UltimateResourceFallbackLocation.Satellite)]

    I tried it to set the packages default language.

    When I set this, to my surprise, menu "Invoke TestCommand01" did not appears at all.

    --------
    What I'd like to know
    --------

    I'm wondering if I can really localize vsix custom menucommand in with this process.
    I'm afraid I miss some very important procedure.

    I have uploaded above simple program to the github.
    https://github.com/TrailRunner-MF/Experimental

    It's a very simple program just focus on the localization of vsct files.

    I'll appreciate any advice or hint or example relating to this complicated problem.

    Thank you.



    Thursday, May 30, 2019 8:51 AM

All replies

  • Hi friend,

    Welcome to MSDN forum.

    >>What I expect is that I can see localized " Invoke TestCommand01" command menu

    Have you checked this document? Maybe you can get some help from it.

    And do you mean the language the command shows is always the English? Have you installed corresponding language packs?

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 3, 2019 8:45 AM
  • Hello Lance, Thank you for your reply.

    Unfortunately, the problem is not solved yet.

    In accordance with your advice I added extension.vsixlangpack to my target language.

    I didn't know it is required for localizing menu command beside vsix itself. Thanks for it, I could localize vsix it self. I can see the localized description in extensions dialog window.

    >And do you mean the language the command shows is always the English? 
    The answer is YES.

    >Have you installed corresponding language packs?
    My Visual Studio is Japanese edition, so it's provided with Japanese language pack.
    Thus, I can only confirm the menu command localization if it is displayed in Japanse as I stipulated in VsixLocalizeTrialPackage.ja-JP.vsct.

    Unlike the vsix package, this doesn't work well.It shows the ButtonText set in 'VsixLocalizeTrialPackage.vsct' file, not in that of 'VsixLocalizeTrialPackage.ja-JP.vsct'.

    I have updated the source codes in git-hub as below.
    https://github.com/TrailRunner-MF/Experimental/tree/add_extension.vsixlangpack
    (I only added the extension.vsixlangpack files)
    Of cource it ends up with the none-localized command menu problem. You can refer to it if you're kind enought to investigate the cause of this problem.

    Or, it will be greate help if you introduce any sample programs which demonstraits the successful menu command localization.

    Thank you.



    Wednesday, June 5, 2019 9:30 AM
  • Hi friend,

    Thanks for sharing your sample. 

    >>I didn't know it is required for localizing menu command beside vsix itself. Thanks for it, I could localize vsix it self. I can see the localized description in extensions dialog window.

    If you want the extension show Spanish language? Have you tried to installed the extra Spanish language by VS installer:

    The menu command is still English? 

    BTW, I will research how to make it work with your sample. Thanks for sharing it!


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 5, 2019 10:13 AM
  • Hello Lance, Thank you for your advice.

    I gave up installing Spanish language-pack, because it requires nearly 1.2GB of my NotePC disc resource.(I'm planning to install it in my Desk-top PC later)

    Actually, my development circumstance's language is Japanese, so it's appropriate for me if menu-commands can be localized to Japanese. 

    (I made Spanish samples because I thought Spanish language is more familiar to the members of this forum.)

    Anyway I still haven't found the solution
    In the meantime, I was creating Vsix features using Roslyn, and it's working well so far.
    I hope to publish it and to be used by many people.

    I'm not rushing so much as I'm planning to publish with English Command-text first.

    But if you see my program on Git-Hub, and find out the cause of this problem, it will be the most pleasing result of this topics. I'll localize it immediately.

    And as far as I know, it will be the world first example to demonstrate Vsix package-localization.

    Thank you.




    Tuesday, June 11, 2019 9:50 AM
  • Hi friend,

    Thanks for your reply and your example in github. I am following the localize document to do the check. Any update I will share it to you. I think it has something to do with the installation process, I'm trying to locate the cause. And I will try to give the reply recently. 

    Thanks for your understanding.

    Sincerely

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 12, 2019 10:33 AM
  • Hi Lance, Thank you so much for your attempt.

    As far as I know, there are no localized Vsix products from English to Japanese or vice versa. I feel that this localization difficulty causes the fact.

    I hope the solution for this problem will be the break through for expanding vsix development.

    Thank you.
    Wednesday, June 19, 2019 10:13 AM
  • Hi friend,

    Sorry but I haven't figured it out how to make it work for VS2019.

    And here is some my discoveries:

    1. Language pack is necessary if you want to check if the localization takes effect.

    e.g: Assuming we have developed a successful Localized project, two users download this extension, one use VS English Language pack, and the other use VS Japanese Language pack. After they install the extension, the command will display English in English-language VS and display Japanese in Japanese-language VS.

    So when you debug to check the effect, you can't see the effect of Localize until you have different language packs in your VS. That's why I suggest you to install corresponding language packs

    2. I've done many tests today but haven't found the workaround to make it work for VS2019. Strangely one of them works!!! I developed it in VS2017, and the extension works well in another VS2017 in my remote server.  I have post this whole project by one-drive(Github link), you can download and check it. Hope it makes some help.

    I believe there is some little difference I made in that project which makes it work, but too many test projects I have made. I can't locate it. And for the reason why it can't work in VS2019, please check this document , when we create new vsix project, there are no more VSPackage.resx now. 

    Hope it makes some help.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 20, 2019 9:53 AM