Community
    • 登入

    Changing context menu text in a language.xml

    已排程 已置頂 已鎖定 已移動 General Discussion
    15 貼文 4 Posters 1.8k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Peter GreistorferP
      Peter Greistorfer
      最後由 編輯

      Dear all!
      In contextMenu.xml I changed a context-menu-entry to <Item folderName="BLUE " id=“43022”/> to clearly indicate that the 1st style is blue. This results in generating a subfolder “BLUE” containing a command “Using 1st style”. This is not really comfortable.

      (1) May I have direct access to “Using 1st style”, i.e. without the subfolder “BLUE”?
      (2) How to change the Text in “Using 1st style” (to guess what^^), I’ve tried to edit english.xml and nativeLang.xml, i.e. the text in <Item id=“43022” name=“Using 1st style”/>, but no chance: the xml(s) were saved with the change, but no way, it didn’t work. (Note, edited the correct files at the right location …)

      Thanks a lot for any help!

      PeterJonesP 1 條回覆 最後回覆 回覆 引用 0
      • PeterJonesP
        PeterJones @Peter Greistorfer
        最後由 PeterJones 編輯

        @Peter-Greistorfer ,

        The documentation for the contextMenu.xml is at https://npp-user-manual.org/docs/config-files/#the-context-menu-contextmenu-xml

        The reason why <Item folderName="BLUE " id=“43022”/> puts it in a subfolder named BLUE is because you entry said folderName="BLUE", which defines the name of the folder to put it in as BLUE.

        If you used ItemNameAs="BLUE" instead of FolderName="BLUE", then the entry name in the context menu will call itself BLUE. This is documented in the Overriding a menu item name section of the docs.

        You can combine those features. The default contextMenu already puts those style commands in the Style token folder of the context menu, so if you add in the ItemNameAs, you can change their name:

        c471484e-34e8-4200-92b8-801f6ad5822e-image.png

        Also remember, as with all Notepad++ config files: when you edit and save the file, you then have to exit Notepad++ and restart Notepad++ before the changes will take effect. (Notepad++ only reads config files when the executable first runs.)

        –
        PS: I have given myself issue#180 to clarify the docs somewhat with regard to how to use ID vs MenuEntryName or PluginEntryName.

        Alan KilbornA PeterJonesP 2 條回覆 最後回覆 回覆 引用 2
        • Alan KilbornA
          Alan Kilborn @PeterJones
          最後由 編輯

          @Peter-Greistorfer

          Unless you’re using an older version, do you really need it to say “blue” or more-accurately, “cyan”?

          Because in Peter’s screenshot, you can actually see the color sample, which is much better than any text.

          PeterJonesP 1 條回覆 最後回覆 回覆 引用 2
          • PeterJonesP
            PeterJones @Alan Kilborn
            最後由 編輯

            @Alan-Kilborn said in Changing context menu text in a language.xml:

            you can actually see the color sample, which is much better than any text.

            Interestingly, if you have more than one instance of that style entry in the contextMenu, only the first instance will have the color box:

            aaf779fe-06f6-488d-9a36-478b8eb299ac-image.png

            Maybe @Peter-Greistorfer was adding another instance of the style token entry somewhere below the Style token folder (either because of not liking it in a separate folder, or not knowing it already existed in the default contextMenu), and it thus the second copy didn’t have the color box next to it.

            Alan KilbornA 1 條回覆 最後回覆 回覆 引用 2
            • guy038G
              guy038
              最後由 guy038 編輯

              Hello, @peter-greistorfer, @Alan-kilborn, @peterjones and All,

              In addition to the coloured boxes, with the new versions, it also follows any change of colour, just done in Settings > Style Configurator... > Global Styles > Style Mark Style 1 to 5, even without restarting N++. Whaoou ;-))

              BR

              guy038

              1 條回覆 最後回覆 回覆 引用 2
              • Alan KilbornA
                Alan Kilborn @PeterJones
                最後由 編輯

                @PeterJones said in Changing context menu text in a language.xml:

                Interestingly, if you have more than one instance of that style entry in the contextMenu, only the first instance will have the color box:

                It begs the question: If, when doing a pointless thing, if a harmless inconsistency occurs, is it called a bug?
                Or is it merely an “interestingly…”

                Peter GreistorferP 1 條回覆 最後回覆 回覆 引用 1
                • Peter GreistorferP
                  Peter Greistorfer @Alan Kilborn
                  最後由 Peter Greistorfer 編輯

                  You guys are great, thanks a lot for your fast help!

                  Finally, I’m just using <Item ItemNameAs="CYAN " id=“43022”/> (of course, it’s not BLUE!), which gives me direct access to that colour. Unfortunately, the best, those coloured boxes, doesn’t appear … Does it depend on npp’s version, I’m not running the latest build …

                  And, if it’s allowed (<=>my problems are already solved), what’s the reason I couldn’t edit that “Using 1st style”-entry in the language-files?

                  PeterJonesP 1 條回覆 最後回覆 回覆 引用 0
                  • PeterJonesP
                    PeterJones @Peter Greistorfer
                    最後由 編輯

                    @Peter-Greistorfer said in Changing context menu text in a language.xml:

                    You guys are great, thanks a lot for your fast help!

                    Glad it helped.

                    Unfortunately, the best, those coloured boxes, doesn’t appear … Does it depend on npp’s version, I’m not running the latest build …

                    Interesting. It’s in the v7.9.2 changelog: I had forgotten that was so recent. Probably because I rarely look at the styling commands.

                    what’s the reason I couldn’t edit that “Using 1st style”-entry in the language-files?

                    I don’t know. It works for me (I still had v7.9.2 open, so that’s the version I changed).

                    1. Set Preferences > General > Localization to English (customizable) – this copies english_customizable.xml to nativeLang.xml
                    2. Edit nativeLang.xml, change from
                      <Item id="43022" name="Using 1st Style"/>
                      to
                      <Item id="43022" name="Using 1st Style [CYAN]"/>
                      and save
                    3. Exit Notepad++. Re-run Notepad++
                    4. Right-click context menu: 0211e221-1a8b-422e-85b1-d679b53467c8-image.png
                      (also used that edited name in Search > Mark All)

                    It worked for me.

                    1 條回覆 最後回覆 回覆 引用 2
                    • Peter GreistorferP
                      Peter Greistorfer
                      最後由 編輯

                      I see, it works for you, Peter. Strange. Will re-check that issue after having installed the newest npp. But my main problem is successfully solved and that’s great!

                      Thanks again and have a nice day,

                      another Peter

                      Peter GreistorferP 1 條回覆 最後回覆 回覆 引用 1
                      • Peter GreistorferP
                        Peter Greistorfer @Peter Greistorfer
                        最後由 編輯

                        Wait, please, just one question:

                        If I style, e.g., MyWord with CYAN, then all occurrences of MyWord are coloured CYAN … is there any way to style/colour only a single MyWord, I mean a type of colour formatting (I should add, I set up a python-macro, found in the net, which loads and saves styles. It works fine, but as sketched, not in the “single-mode”).

                        Alan KilbornA 2 條回覆 最後回覆 回覆 引用 0
                        • Alan KilbornA
                          Alan Kilborn @Peter Greistorfer
                          最後由 編輯

                          @Peter-Greistorfer said in Changing context menu text in a language.xml:

                          If I style, e.g., MyWord with CYAN, then all occurrences of MyWord are coloured CYAN …

                          is there any way to style/colour only a single MyWord

                          Nope. Currently that just isn’t how the feature works. You get ALL occurrences.

                          1 條回覆 最後回覆 回覆 引用 2
                          • Alan KilbornA
                            Alan Kilborn @Peter Greistorfer
                            最後由 編輯

                            @Peter-Greistorfer

                            is there any way to style/colour only a single MyWord

                            Nope. Currently that just isn’t how the feature works. You get ALL occurrences.

                            But I did just locate this:
                            https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9263

                            So maybe there is hope for your desire in the future!

                            Peter GreistorferP 1 條回覆 最後回覆 回覆 引用 3
                            • Peter GreistorferP
                              Peter Greistorfer @Alan Kilborn
                              最後由 編輯

                              @Alan-Kilborn Exactly, thank you for the link!

                              1 條回覆 最後回覆 回覆 引用 0
                              • PeterJonesP
                                PeterJones @PeterJones
                                最後由 編輯

                                @PeterJones said in Changing context menu text in a language.xml:

                                PS: I have given myself issue#180 to clarify the docs somewhat with regard to how to use ID vs MenuEntryName or PluginEntryName.

                                FYI: PR#181 should clarify this usage.

                                Peter GreistorferP 1 條回覆 最後回覆 回覆 引用 1
                                • Peter GreistorferP
                                  Peter Greistorfer @PeterJones
                                  最後由 編輯

                                  @PeterJones I see - and understand, thank you!

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • 第一個貼文
                                    最後的貼文
                                  The Community of users of the Notepad++ text editor.
                                  Powered by NodeBB | Contributors