Community
    • Login

    Detecting N++ UI Language

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    5 Posts 3 Posters 444 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.
    • Thomas KnoefelT
      Thomas Knoefel
      last edited by

      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?

      PeterJonesP rdipardoR 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Thomas Knoefel
        last edited by

        @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.

        Thomas KnoefelT 1 Reply Last reply Reply Quote 3
        • Thomas KnoefelT
          Thomas Knoefel @PeterJones
          last edited by

          @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
          • rdipardoR
            rdipardo @Thomas Knoefel
            last edited by rdipardo

            @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.

            Thomas KnoefelT 1 Reply Last reply Reply Quote 4
            • Thomas KnoefelT
              Thomas Knoefel @rdipardo
              last edited by

              @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
              • rdipardoR rdipardo referenced this topic on
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors