Community
    • Login

    TranslateID (FolderName) in UserDefinedCommands (shortcuts.xml)

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 238 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • João MacJ
      João Mac
      last edited by

      I’m using Notepad++ 8.8.1 (Portuguese GUI).

      In the file [notepad++ path]\localization\english.xml, there’s a section called “MiscStrings”, which has the following IDs:

      <common-ok value="OK"/>
      <common-cancel value="Cancel"/>
      <summary value="Summary"/>
      

      I’d like to test the TranslateID attribute for submenus (FolderName) in the file [notepad++ path]\shortcuts.xml, section “UserDefinedCommands”:

      <UserDefinedCommands>
          <Command name="Open CMD" FolderName="Terminal" TranslateID="common-ok" Ctrl="no" Alt="no" Shift="no" Key="0">cmd /k</Command>
          <Command name="CMD in current path" FolderName="Terminal" TranslateID="common-ok" Ctrl="no" Alt="no" Shift="no" Key="0">cmd /k cd /d "$(CURRENT_DIRECTORY)"</Command>
          <Command name="File info" FolderName="X1" TranslateID="summary" Ctrl="no" Alt="no" Shift="no" Key="0">cmd /k echo "Arquivo: $(FILE_NAME)" &amp;&amp; pause</Command>
          <Command name="Full path" FolderName="X1" TranslateID="summary" Ctrl="no" Alt="no" Shift="no" Key="0">cmd /k echo "Caminho: $(FULL_CURRENT_PATH)" &amp;&amp; pause</Command>
          <Command name="Open folder" FolderName="" TranslateID="common-cancel" Ctrl="no" Alt="no" Shift="no" Key="0">cmd /k cd /d "$(CURRENT_DIRECTORY)" &amp;&amp; dir</Command>
          <Command name="Show files" FolderName="" TranslateID="common-cancel" Ctrl="no" Alt="no" Shift="no" Key="0">cmd /k dir "$(CURRENT_DIRECTORY)\*.*" /b</Command>
      </UserDefinedCommands>
      

      After restarting Notepad++, the submenus still appear with the names “Terminal” and “X1” instead of the expected translations “OK” and “Summary”. What should I correct?

      Reference: https://npp-user-manual.org/docs/config-files/

      FolderName attribute: Used for grouping items into sub-menus in the context menu.

      TranslateID attribute: Used for auto-translating your sub-menu names. If the attribute’s value matches one of the nodes in the <MiscStrings> section of english.xml or similar translation files, the menu will use your active translation’s value for the displayed FolderName.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @João Mac
        last edited by

        @João-Mac,

        After restarting Notepad++, the submenus still appear with the names “Terminal” and “X1” instead of the expected translations “OK” and “Summary”. What should I correct?

        Reference: https://npp-user-manual.org/docs/config-files/

        FolderName attribute: Used for grouping items into sub-menus in the context menu.

        TranslateID attribute: Used for auto-translating your sub-menu names. If the attribute’s value matches one of the nodes in the <MiscStrings> section of english.xml or similar translation files, the menu will use your active translation’s value for the displayed FolderName.

        If you look again at the reference you linked, the TranslateID attribute is defined for the contextMenu.xml; however, the <Command> tags in the shortcuts.xml do not have that attribute listed as being available.

        Thus, I do not believe what you are looking for is currently possible. Thus, I think you would have to follow the instructions in our FAQ to put in a feature request to ask the developer to add TranslateID to the shortcuts.xml <Command> tag.

        João MacJ 1 Reply Last reply Reply Quote 1
        • João MacJ
          João Mac @PeterJones
          last edited by

          @PeterJones said in TranslateID (FolderName) in UserDefinedCommands (shortcuts.xml):

          If you look again at the reference you linked, the TranslateID attribute is defined for the contextMenu.xml; however, the <Command> tags in the shortcuts.xml do not have that attribute listed as being available.

          Thus, I do not believe what you are looking for is currently possible. Thus, I think you would have to follow the instructions in our FAQ to put in a feature request to ask the developer to add TranslateID to the shortcuts.xml <Command> tag.

          Hello, @PeterJones.

          I truly appreciate your quick response and such a clear explanation!

          Indeed, upon rereading the documentation I referenced, I realized I misunderstood the use of the TranslateID attribute. It applies to contextMenu.xml, not shortcuts.xml, as I had mistakenly assumed. That was an oversight on my part, and I appreciate you pointing it out so objectively.

          In my case, this was just curiosity based on that mistaken understanding. It’s not something essential for daily use of the application. I’m glad to have learned the actual scope of this functionality.

          Thanks again for your kindness and clarification.

          1 Reply Last reply Reply Quote 2
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors