Is there an existing issue for this?
Description of the Issue
See this community forum post for a description of the issue.
In brief, it is currently possible for plugins to learn whether the user has changed their localization preference, but it is cumbersome and unintuitive to do so. There have been many requests (in various places) over the years to make plugins translatable, and adding an NPPN_* notification would definitely help plugin maintainers add translation to their plugins.
Describe the solution you'd like.
It seems to me that relatively little code would be required to send an NPPN_* notification to all the plugins after Notepad++ has finished changing all of its own UI elements. I would probably recommend continuing to use the old NPPM_INTERNAL_RELOADNATIVELANG notification internally, and just create a new notification, maybe called NPPN_RELOADNATIVELANG, to notify plugins.
Based on my own experience implementing a response to NPPN_INTERNAL_RELOADNATIVELANG in my own plugin, I believe that this notification should probably also have the following payload:
// Assume that const char * nativeLangName is the filename associated with the nativeLang.xml file (minus the .xml extension)
// for example, if the current language is English, nativeLangName = "english", if the current language is Italian, nativeLangName = "italian", and so on
// Also assume that HMENU pluginMenuHandle is the HMENU to the Plugins submenu of the Notepad++ main menu.
// We want to send this to plugin too, so that they can always find the submenu associated with their plugin, and then re-translate all their menu items.
// You might be thinking "Wait, can't the plugins menu be found by using GetSubMenu(hNotepadPlusMainMenu, MENUINDEX_PLUGINS)?"
// No! This is not possible, because some plugins like Columns++ can add their plugin's submenu to the Notepad++ main menu, and that means that the Plugins submenu is no longer at index MENUINDEX_PLUGINS of the main menu.
SCNotification scnN{};
scnN.nmhdr.code = NPPN_RELOADNATIVELANG
scnN.text = nativeLangName;
scnN.length = strlen(nativeLangName);
scnN.lParam = pluginMenuHandle;
By telling the plugin what the user's new native language preference is, and where the Plugins submenu of the Notepad++ main menu is located, you supply every plugin with enough information to re-translate their plugin into the current UI language of Notepad++, and you eliminate the need for every plugin to re-read the nativeLang.xml file every time the notification is fired.
Debug Information
Notepad++ v8.6.9 (64-bit)
Build time : Jul 12 2024 - 05:09:25
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:\Users\mjols\AppData\Roaming\Notepad++\nativeLang.xml"
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
OS Name : Windows 10 Home (64-bit)
OS Version : 22H2
OS Build : 19045.4651
Current ANSI codepage : 1252
Plugins :
ColumnsPlusPlus (1.1.1)
ComparePlus (1.1)
CSharpPluginPack (0.0.3.11)
CSVLint (0.4.6.6)
EnhanceAnyLexer (1.1.3)
HTMLTag (1.4.3.1)
HugeFiles (0.4.1)
JsonTools (8.0.0.17)
mimeTools (3.1)
NavigateTo (2.7)
NppConverter (4.6)
NppExport (0.4)
NppLspClient (0.0.21)
PythonScript (3.0.16)
XMLTools (3.1.1.13)
Anything else?
No response
Is there an existing issue for this?
Description of the Issue
See this community forum post for a description of the issue.
In brief, it is currently possible for plugins to learn whether the user has changed their localization preference, but it is cumbersome and unintuitive to do so. There have been many requests (in various places) over the years to make plugins translatable, and adding an
NPPN_*notification would definitely help plugin maintainers add translation to their plugins.Describe the solution you'd like.
It seems to me that relatively little code would be required to send an
NPPN_*notification to all the plugins after Notepad++ has finished changing all of its own UI elements. I would probably recommend continuing to use the oldNPPM_INTERNAL_RELOADNATIVELANGnotification internally, and just create a new notification, maybe calledNPPN_RELOADNATIVELANG, to notify plugins.Based on my own experience implementing a response to
NPPN_INTERNAL_RELOADNATIVELANGin my own plugin, I believe that this notification should probably also have the following payload:By telling the plugin what the user's new native language preference is, and where the Plugins submenu of the Notepad++ main menu is located, you supply every plugin with enough information to re-translate their plugin into the current UI language of Notepad++, and you eliminate the need for every plugin to re-read the
nativeLang.xmlfile every time the notification is fired.Debug Information
Anything else?
No response