• Login
Community
  • Login

Detecting N++ UI Language

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
5 Posts 3 Posters 633 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.
  • T
    Thomas Knoefel
    last edited by Dec 30, 2023, 2:50 PM

    I’m considering adding multi-language support to the MultiReplace Plugin.

    Initially, I was surprised to find that there’s no API to retrieve the current localization language. I discovered that the nativeLang.xml file in %APPDATA%\Notepad++\ stores the current language used. Currently, I’m thinking of locating this file to determine the language, but is there a better way to do this? It seems somewhat like an unsupported hack to me. But i don’t want uncouple this setting from Notepad++ Settings.

    Are there any ideas of other Plugins supporting different languages?

    P R 2 Replies Last reply Dec 30, 2023, 3:57 PM Reply Quote 0
    • P
      PeterJones @Thomas Knoefel
      last edited by Dec 30, 2023, 3:57 PM

      @Thomas-Knoefel said in Detecting N++ UI Language:

      seems somewhat like an unsupported hack to me

      The developer did not anticipate plugin authors wanting to know about or influence the current NPP configuration.

      To help with your hack, NPPM_GETPLUGINSCPNFIGDIR gets you ...\plugins\config in the appropriate appdata/portable/settingsDir location, so doing ..\.. from there will get you to the right directory for NPP config files, regardless of install/config mode.

      T 1 Reply Last reply Dec 30, 2023, 4:14 PM Reply Quote 3
      • T
        Thomas Knoefel @PeterJones
        last edited by Dec 30, 2023, 4:14 PM

        @PeterJones
        Thank you, Peter, for confirming that my findings are correct. In any case, I will provide a fallback in English language if anything changes within the N++ config files or their names in further N++ versions.

        1 Reply Last reply Reply Quote 1
        • R
          rdipardo @Thomas Knoefel
          last edited by rdipardo Dec 30, 2023, 5:25 PM Dec 30, 2023, 5:16 PM

          @Thomas-Knoefel said in Detecting N++ UI Language:

          Are there any ideas of other Plugins supporting different languages?

          See https://github.com/rdipardo/nppHTMLTag/issues/5

          In case Delphi is all Greek to you (😉), what this does is look for nativeLang.xml, parse the attribute value of /NotepadPlus/Native-Langue[@filename] (sic), strip off the *.xml extension, then use the value to index a dictionary of localized menu titles.

          Very much a work in progress that I won’t be getting around to anytime soon.

          T 1 Reply Last reply Dec 30, 2023, 7:14 PM Reply Quote 4
          • T
            Thomas Knoefel @rdipardo
            last edited by Dec 30, 2023, 7:14 PM

            @rdipardo
            Delphi is one of my favorites 😉 it reminds me of my first big project from the early 90s. I’ve even managed to save the code on my GitHub.

            Your MultiLanguage implementation indicates that keeping the language snippets in a flat structure should suffice. I also don’t see any additional value in complicating it with XML.

            Thanks for sharing!

            1 Reply Last reply Reply Quote 2
            • R rdipardo referenced this topic on May 20, 2025, 5:59 PM
            1 out of 5
            • First post
              1/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors