Detecting N++ UI Language
-
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?
-
@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. -
@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. -
@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.
-
@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!