Howto get Notapad++ GUI-language on C#?
-
Hello,
how can i detect the GUI-language from an C#-Plugin?
regards
Mario -
Hello,
now i have found a solution, the file [\AppData\Roming\Notepad++\nativeLang.xml] contains the selected GUI-language.
A litle sourcecode arount and its work fine: ;-)The C#-function give back the implement short language id:
private String getLanguage() { String result = ""; StringBuilder sbIniFilePath = new StringBuilder(Win32.MAX_PATH); Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, sbIniFilePath); String iniFilePath = sbIniFilePath.ToString(); if (iniFilePath.EndsWith(@"plugins\Config")) { iniFilePath = iniFilePath.Replace(@"\plugins\Config", @"\nativeLang.xml"); String readline = null; Int16 counter = 0; // <Native-Langue name="English" filename="english.xml" version="6.8.2"> using (System.IO.StreamReader fileReader = System.IO.File.OpenText(iniFilePath)) { while (counter < 30) // check counterMax { readline = fileReader.ReadLine(); counter++; if (readline.ToLowerInvariant().Contains("<native-langue")) { string[] split = Regex.Split(readline, "^(.*)(<Native-Langue)(\\s+)(name=\")(((?!\").)*)(\")(.*)$"); if ((split != null) && (split.Length > 4)) readline = split[5]; else readline = null; counter = 31; // Set counter to => max } else readline = null; } fileReader.Close(); } if (readline != null) { switch (readline.ToLowerInvariant()) { case "deutsch": result = "DE"; break; case "english": result = "EN"; break; default: result = "EN"; break; } } } return result; }regards Mario
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login