molsonkiko / JsonToolsNppPlugin

A Notepad++ plugin providing tools for JSON like linting, querying, a tree view, and CSV conversion.
Apache License 2.0
70 stars 9 forks source link

JsonTools uses OS culture to determine translation, and ignores Notepad++ localization preferences #73

Open conky77 opened 4 days ago

conky77 commented 4 days ago

If I change the language of N++ from Italian to English, I still see the menu in Italian. Nothing changes after Notepad++ restarting

immagine

Notepad++ v8.6.8 (64-bit) Build time : Jun 4 2024 - 00:30:00 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : "C:\Program Files\Notepad++\functionList\asm.xml" Admin mode : OFF Local Conf mode : OFF Cloud Config : OFF Periodic Backup : ON OS Name : Windows 11 Home (64-bit) OS Version : 23H2 OS Build : 22631.3810 Current ANSI codepage : 1252 Plugins : ComparePlugin (2.0.2) DSpellCheck (1.5) ERPHelper (1.1.2) HexEditor (0.9.12) JsonTools (8) mimeTools (3.1) MultiReplace (3.0.2.14) NppConverter (4.6) NppExport (0.4) NPPJSONViewer (2.0.7) NppMenuSearch (0.9.6) PoorMansTSqlFormatterNppPlugin (1.6.13.31508) SQLinFormNpp64 (6.24.4.1) XMLTools (3.1.1.13)

molsonkiko commented 4 days ago

As this documentation explains, the language is determined by determining the user's current culture. I have no intention of changing this.

Notepad++ does not provide any interface to plugins for determining what localization is being used AFAIK, nor does it notify plugins when the localization is changed.

Please make sure you read and understand the documentation before submitting more issues. If the documentation is confusing, then let me know.

conky77 commented 4 days ago

@molsonkiko Here https://github.com/peter-frentrup/NppMenuSearch/issues/43 the API you are looking for.

Notepad++ can be translated to languages not supported by Microsoft (I sometimes translate to Venetian and the translators of Corsican and Galician are very active). If the API doesn't work, and you may change your mind, let me know so that I can get more information. The author of N++ is quite sensitive about minor languages, so I could try to ask.

About the documentation, I can only give the point of view of a non-mother tongue. Probably, "may eventually be translated" may not be understood by non-mother tongue at the first reading (it is not available, but it will be a next feature). Underlining that the plugin doesn't get the "Notepad L10N" would be better clear.

molsonkiko commented 4 days ago

@conky77

The API that you described doesn't help at all, because while it tells plugins when the native language preference was changed, it doesn't tell plugins what the language preference is. I've spent about 15 minutes combing the Notepad++ source code looking for any way to get the user's native language preference, and the only way I can think of to get this information is to parse the XML of whichever Notepad++ config file has this information, which I might be willing to do as soon as I figure out all the steps I need to take. I will reopen this issue to signal my interest, but no promises that I will change this.

I think a reasonable compromise would be to make language preference a configurable JsonTools setting. For example, I could add a setting called nativeLang, and use that to determine which translation file to use. I recognize that this is the most work for the user, but it is a lot easier for me to test and implement, and it opens up the possibility of changing the translation language without closing and re-opening Notepad++.

One question: I could try a combination approach, where I try to find the user's Notepad++ localization, and then I try to find their culture (the current approach), and then finally default to English. Do you think that approach has merit?