molsonkiko / JsonToolsNppPlugin

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

Is json tools translatable? #70

Open conky77 opened 1 week ago

conky77 commented 1 week ago

I would like to translate Json tools to Italian: is it possible?

molsonkiko commented 1 week ago

@conky77 , JsonTools is not currently translatable. However, I believe that I could implement translation.

I can't add translation for everything; here is what I envision translating:

Notably, I don't want to try to translate the text in message boxes. This might require calling up a translation API to translate an error message before rendering the message box, whereas what I'm proposing would just involve having some static JSON files with objects mapping a strings to the appropriate translation in another language.

I'll try to come up with an implementation today, add some documentation explaining how to make a pull request adding translation, and then you can add Italian translation if you like.

conky77 commented 1 week ago

@molsonkiko thanks for answering. It should be ok. After the first translation, it would be clearer if it is possible to translate something more. If your work can be the starting for the creation of standard for plugin translation, it would be great.

molsonkiko commented 1 week ago

In my most recent commit, I've added this JSON with comments file as a mockup of what users could edit to provide translation into other languages. The comments in the file should provide all the explanation that you need. Let me know if there's anything that I could make clearer.

I got hung up dealing with other issues today, so I wasn't able to implement the actual logic for translation yet, but I plan to do that tomorrow or the day after.

conky77 commented 1 week ago

@molsonkiko I created the pull request #71 . Please let me know how to test it

molsonkiko commented 1 week ago

I merged PR #71 so that I can use the JSON file for local testing. I'm still in the early stages of getting it to work; right now it seems like non-ASCII characters like ù in the file are causing problems, but I'm sure I will find a workaround.

conky77 commented 1 week ago

Thanks, in Italian the non-standard ASCII are: à, è, é, ì, ò, ù

molsonkiko commented 1 week ago

I figured out an issue, which I will clarify in my next draft of the JSON:

The text for a menu item CANNOT have more than 63 characters (including whitespace) when encoded in UTF-16 (which should just mean 63 letters for your purposes, since all the Italian letters are in the Basic Multilingual Plane). The relevant line of code is here (it says the max length is 64, but that's including the terminating NUL character since it's for a C string), and since it's in the Notepad++ codebase there's nothing I can do (other than request that it be changed, which likely wouldn't work). If a menu item is too long, it could make Notepad++ refuse to start.

As it happens, you can easily check which menu items are too long by opening up the italian.json5 file in Notepad++, opening up the tree view for that file, and entering the query @.menuItems[s_len(@) >= 64], which selects all menuItems with 64 or more UTF-16 characters.

Right now the only menu item that is too long is your translation of Choose schemas to automatically validate &filename patterns. Please come up with a new translation that is short enough. I came up with Convalida i file con schemi basati su modelli di nomi file by playing around with Google Translate; do you think that is clear enough?

EDIT: To be clear; there's no reason for you to make another PR. You can just suggest a different translation here in the comments, and I'll make the change on my computer.

conky77 commented 1 week ago

@molsonkiko for "Choose schemas to automatically validate &filename patterns", I propose this translation "Scegli lo schema per convalidare i &file JSON".

molsonkiko commented 2 days ago

@conky77

I forgot to include the field for the toolbar_icons setting in the settingsDescriptions object. The English description is as follows:

Specify one of these chars for each toolbar icon you want to show, in the order you want:
('t' = tree view, 'c' = compress, 'p' = pretty-print, 'o' = path to current position)
This setting will take effect the next time you start Notepad++.
If you want there to be NO toolbar icons, enter a character that does not represent an icon; do NOT leave this field empty.

What do you think the Italian translation should be?

conky77 commented 2 days ago

@molsonkiko the translation is Per ogni icona della barra degli strumenti, indica una delle seguenti icone nell'ordine desiderato: ('t' = visualizzazione ad albero, 'c' = compressione, 'p' = formatta, 'o' = Percorso della posizione corrente) Questa impostazione avrà effetto al riavvio di Notepad++. Per non visualizzare le icone nella barra degli strumenti, inserisci un carattere diverso dai precedenti; NON lasciare questo campo vuoto.

All translations need to be tested.

conky77 commented 2 days ago

I saw you have already published a new version with the Italian translation: with the latest version of N++. Will this version of the plugin be able to be downloaded from plugin Manager? Since I have yet to test it, I would prefer not to.

I tested the plugin, and the settings appear not translated immagine

conky77 commented 2 days ago

@molsonkiko some of strings not translated (I could not have translated some strings or the program doesn't show the translation):

immagine

immagine

conky77 commented 2 days ago

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

conky77 commented 2 days ago

"Choose folder to find json files" not translatable

immagine

conky77 commented 2 days ago

I created a new pull request

molsonkiko commented 2 days ago

I created a new pull request

You don't need to tell me when you submit a PR; I already get email notifications about that.

I tested the plugin, and the settings appear not translated

Correct. My documentation on translation reflects this.

I knew that Notepad++ 8.6.9 would be released soon, and I had to choose between having this new version of JsonTools appear in the Plugin Manager for that Notepad++ version and trying to fix every little outstanding problem with the plugin, and I chose to release this new version. I'm sorry if you disagree with this decision.

some of strings not translated (I could not have translated some strings or the program doesn't show the translation):

As my documentation notes, I do not plan to translate Error messages and message boxes. Making all of that translatable would be more work than I am willing to put in.

"Choose folder to find json files" not translatable

No, and it won't be. This falls into the category of "message boxes and error messages" as far as I'm concerned, so it won't be translatable.

conky77 commented 2 days ago

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

@molsonkiko in case you didn't see this issue, since it was between other issues...

conky77 commented 2 days ago

In case you changed your mind, the translations of settings would be very useful. (and warning messages as well)

molsonkiko commented 2 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

See my response to #73 (now closed).