Community
    • Login

    Translation plugin

    Scheduled Pinned Locked Moved Translation
    13 Posts 4 Posters 3.8k 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.
    • conky77C
      conky77 @PeterJones
      last edited by

      @PeterJones
      Probably my request wasn’t very clear. I wanted to ask if other plugins are translatable, not ask if someone can translate the plugin for me.
      I usually translate italian.xml of N++, and it wouldn’t be very difficult to translate some plugins.
      I wanted to understand if there was a list of plugins translatable in order to decide which one to translate first .
      Since the plugins that I use the most (xml tool, json tool, json viewer, compare) don’t seem to be translatable, I wanted to understand if there is a “standard” way for plugin translation.
      If each author of a plugin has to invent his own way of translating them, not so many authors will implement it

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @conky77
        last edited by

        @conky77 ,

        The ability to translate is not built into the various plugin templates, as far as I know, so each plugin author is responsible for implementing translatability on their own. As far as I know, there is no standardization for translations on plugins.

        1 Reply Last reply Reply Quote 3
        • conky77C
          conky77
          last edited by conky77

          At the moment the translatable plugins are:

          • Hex editor available in German
            • https://github.com/chcg/NPP_HexEdit/tree/master/HexEditor/lang
            • https://github.com/chcg/NPP_HexEdit/tree/master/NativeLang/src/lang
          • Multireplace available in German and Russian
          • json tool , available in Italian (it gets the Windows languages/cultures, not all Notepad++ languages can be supported)

          If I understood well, there is also a proposal for making a standard for translations here

          Mark OlsonM conky77C 2 Replies Last reply Reply Quote 1
          • Mark OlsonM
            Mark Olson @conky77
            last edited by Mark Olson

            @conky77 said in Translation plugin:

            If I understood well, there is also a proposal for making a standard for translations here

            You partially understood. Unfortunately, my code can’t really be a general “standard for translations” because plugin authors can’t adopt it unless:

            • their plugin is written in C# (most plugins are written in C++)
            • they are willing to include the code necessary to parse JSON with comments (JsonTools naturally has that code for obvious reasons).
            • they are using Windows Forms to make forms (WPF is more popular IIRC, although this isn’t too big of an issue)
            1 Reply Last reply Reply Quote 2
            • Mark OlsonM
              Mark Olson
              last edited by

              Here’s a description of my translation framework for C# plugins.

              Although the code largely speaks for itself, I will try to provide an outline of how I think daddel80’s framework for translating to other languages works, since his approach is most relevant to C++ plugin developers, who certainly outnumber C# plugin developers.

              1. The actual mapping from the native language to other languages is done in the languages.ini file and the language_mapping.cpp source file. Every message in your plugin needs to have a short descriptive name, which is mapped to the English message in language_mapping.cpp and to other languages in languages.ini.
              2. All the remaining code for translation seems to be in this region of MultiReplacePanel.cpp. Here are some search results that show how the translation code is referenced elsewhere.
              1 Reply Last reply Reply Quote 3
              • Mark OlsonM
                Mark Olson
                last edited by Mark Olson

                New translation feature

                I finally figured out how to make it so that the UI language of a C# plugin automatically changes to follow Notepad++ when the user changes their preferences, rather than requiring the user to close and reopen Notepad++ to see their new preference reflected in the plugin UI. This was implemented in this commit to NppCSharpPluginPack.

                The downside

                However, this change would cause a quite noticeable reduction in Notepad++ performance (possibly up to 10% more CPU usage than before) even when the user is not actively using the plugin. For example, this change would make editing and opening files slightly slower, not just using the plugin’s commands.

                Given that the user will probably not be changing their UI language very often, and this change would only improve their experience between when they change their UI language and when they close Notepad++, I am not really convinced that it is worth actually implementing this change in any plugins. That said, I’m open to changing my mind.

                @conky77
                What do you think? Do you think that it is really important that translatable plugins immediately change their language to the Notepad++ UI language?

                Thoughts on how the downside could be eliminated

                As far as I can see, the whole reason that you have to degrade performance to allow plugins to automatically follow the Notepad++ UI language is that Notepad++ uses an internal message (not broadcast to plugins) to notify that it’s changing its UI language. As a result, my plugin has to create a new NativeWindow that is notified of every single message that Notepad++ receives (not just plugin messages), which is both hacky and leads to the aforementioned performance degradation. By the way, kudos to Peter Frentrup for figuring out how to do this.

                It seems to me like the obvious solution is for Notepad++ to broadcast to plugins when it changes its UI language, so that plugins can be notified of this in the normal fashion. I’m thinking about opening a new issue in the NPP Github repo, and I’ll link the issue below if and when I do.

                1 Reply Last reply Reply Quote 2
                • Mark OlsonM
                  Mark Olson
                  last edited by

                  I’ve created a new issue in the GitHub repo asking for plugins to be notified when localization is changed.

                  Mark OlsonM 1 Reply Last reply Reply Quote 3
                  • Mark OlsonM
                    Mark Olson @Mark Olson
                    last edited by Mark Olson

                    Earlier I said:

                    I’ve created a new issue in the GitHub repo asking for plugins to be notified when localization is changed.

                    The necessary messages and notifications for plugin translation to match NPP has been implemented in this commit, as I requested in that issue.

                    @PeterJones
                    I would recommend adding some documentation of this new feature in the user manual.

                    For what it’s worth, NppCSharpPluginPack now has a working example of how to respond to this new notification, although the code may be a little bit difficult to understand if you’re not a C# programmer.

                    1 Reply Last reply Reply Quote 3
                    • conky77C
                      conky77 @conky77
                      last edited by conky77

                      I update the list of translatable plugins
                      At the moment the translatable plugins are:

                      • Hex editor available in German
                        • https://github.com/chcg/NPP_HexEdit/tree/master/HexEditor/lang
                        • https://github.com/chcg/NPP_HexEdit/tree/master/NativeLang/src/lang
                      • Multireplace available in German, Hungarian, Italian, Russian, Spanish
                      • json tool, available in Italian (now it is possible to translate it to all Notepad+'s supported languages)

                      the list of plugin that are working on it:

                      • https://github.com/NPP-JSONViewer/JSON-Viewer/issues/190
                      conky77C 1 Reply Last reply Reply Quote 2
                      • conky77C
                        conky77 @conky77
                        last edited by

                        I update the list of translatable plugins (NPP menuSearch is also translatable);
                        At the moment the translatable plugins are:

                        • Hex editor available in German
                          • https://github.com/chcg/NPP_HexEdit/tree/master/HexEditor/lang
                          • https://github.com/chcg/NPP_HexEdit/tree/master/NativeLang/src/lang
                        • Multireplace available in Danish, French, German, Hungarian, Italian, Portuguese, Russian, Spanish, Ukrainian
                        • json tool available in Italian, Arabic, Chinese,French, German, Italian, Japanese, Korean, Twaiwanist
                        • NppMenuSearch available in German, Italian
                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors