Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is json tools translatable? #70

Closed
conky77 opened this issue Jun 23, 2024 · 44 comments
Closed

Is json tools translatable? #70

conky77 opened this issue Jun 23, 2024 · 44 comments
Labels
enhancement New feature or request probably fixed? the issue/feature appears to be fixed/implemented, but there still may be issues

Comments

@conky77
Copy link
Contributor

conky77 commented Jun 23, 2024

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

@molsonkiko
Copy link
Owner

@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:

  • menu items (for example, Pretty-print current JSON file becomes Abbellisci il file JSON corrente based on Google Translate)
  • buttons on forms (for example, Submit query becomes Inviare interrogativo)
  • Descriptions of settings, but not names of settings (for example, sort_keys would not change, but the description would change from Sort the keys of objects alphabetically when pretty-printing or compressing to Ordina le chiavi degli oggetti in ordine alfabetico durante l'abbellimento o la compressione

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
Copy link
Contributor Author

conky77 commented Jun 23, 2024

@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
Copy link
Owner

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.

@molsonkiko molsonkiko added the enhancement New feature or request label Jun 24, 2024
@conky77
Copy link
Contributor Author

conky77 commented Jun 24, 2024

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

@molsonkiko
Copy link
Owner

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
Copy link
Contributor Author

conky77 commented Jun 25, 2024

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

@molsonkiko
Copy link
Owner

molsonkiko commented Jun 25, 2024

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
Copy link
Contributor Author

conky77 commented Jun 25, 2024

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

@molsonkiko
Copy link
Owner

@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?

@molsonkiko molsonkiko added the probably fixed? the issue/feature appears to be fixed/implemented, but there still may be issues label Jun 29, 2024
@conky77
Copy link
Contributor Author

conky77 commented Jun 30, 2024

@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
Copy link
Contributor Author

conky77 commented Jun 30, 2024

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
Copy link
Contributor Author

conky77 commented Jun 30, 2024

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

immagine

immagine

@conky77
Copy link
Contributor Author

conky77 commented Jun 30, 2024

@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
Copy link
Contributor Author

conky77 commented Jun 30, 2024

"Choose folder to find json files" not translatable

immagine

@conky77
Copy link
Contributor Author

conky77 commented Jun 30, 2024

I created a new pull request

@molsonkiko
Copy link
Owner

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
Copy link
Contributor Author

conky77 commented Jun 30, 2024

@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
Copy link
Contributor Author

conky77 commented Jun 30, 2024

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

@molsonkiko
Copy link
Owner

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).

@molsonkiko
Copy link
Owner

I've added translation of the settings form as you requested.

I also realized that I was missing the correct translation of the sort_keys setting. The correct English is:

Sort the keys of objects alphabetically when pretty-printing or compressing

Currently my Italian translation is as follows:

Ordina le chiavi degli oggetti in ordine alfabetico durante la formattazione o la compressione

@conky77
Does that look like a good Italian translation to you?

@conky77
Copy link
Contributor Author

conky77 commented Jul 3, 2024

thanks for setting form: are there new items to translate?
The translation is understandable, ok.
Let me know when there is a new version I can test.

@molsonkiko
Copy link
Owner

@conky77

Let me know when there is a new version I can test.

These instructions provide a guide on how to download unreleased versions of JsonTools or the translation files.

If you find those instructions confusing, I'll try to make them clearer.

@conky77
Copy link
Contributor Author

conky77 commented Jul 3, 2024

Much better with translation of setting
the title of the window setting should "Impostazioni" and not "settings"

This week I don't have much time, but the setting translation need to be reviewed.
What I saw at first seigth

In Italian (I suppose the original one has the same problem) the description of setting doesn't respect the order of value of the combobox
image

I should write the translation of properties in the description.
Since the values of comboBoxes are not translatable, a legend is needed (for some settings, there is a legend)

the following setting is not translated
image

Next week, I'll test it better

@molsonkiko
Copy link
Owner

molsonkiko commented Jul 4, 2024

@conky77
In my most recent commit, I've done all the things you requested in your last comment. I added my own translation into Italian; while I don't speak the language, I always try to reverse the translation back from Italian to English to make sure it seems reasonable, and I try to be careful with the exact wording.

I also renamed the plugin command Choose schemas to automatically validate filename patterns to Validate files with JSON schema if name matches pattern, because it seemed like people were getting confused about what the command was supposed to do. My current Italian translation is Convalida file con schema JSON se &nome corrisponde a modello (I know it's supposed to be se __il__ &nome, but including the il would make the translation longer than 63 characters).

Finally, I tweaked the translation of Parse JSON Li&nes document to Analizza il &documento di righe JSON, because that ensures that JSON Lines is consistently referred to as righe JSON. It's possible that the best option is to leave it as JSON lines because it's a formal specification, and the names of formal specifications are never translated.

I'll just make a list of tasks related to this issue (the last one is something I just thought of).

  • add translation of forms
  • add translation of settings descriptions
  • add translation of settings form
  • use Notepad++ localization to decide how to translate
  • add a plugin command that download the most up-to-date version of your preferred translation file from GitHub (if such a file exists)

@molsonkiko
Copy link
Owner

molsonkiko commented Jul 7, 2024

@conky77

I've just added support for translation of syntax error messages and JSON schema validation error messages, so if you'd like to translate all the syntax errors under the jsonLint field, your help would certainly be appreciated!

@molsonkiko
Copy link
Owner

I used Google Translate to translate all the syntax error messages and JSON schema validation error messages myself. You can see the results here. When I translated the Italian translations back into English, the results looked pretty reasonable, so I'm pretty confident you won't need to make many changes to the existing translations.

@conky77
Copy link
Contributor Author

conky77 commented Jul 17, 2024

Thanks, I'll compare them with the draft I made.

Is it possible to keep the same structure of the phrase and the same verb in the error messages?
be part, be valid, be supported, be only allowed, not allowed except could always become "be only allowed"

Since it is not an essay and you receive the messages at different moments, the same structure would help the understanding (and the translation would be easier)

for example

"JSON5_SINGLEQUOTED_STRING": "Singlequoted strings are only allowed in JSON5",
"JSON5_ESCAPED_NEWLINE": "Escaped newline characters are only allowed in JSON5",
"JSON5_X_ESCAPE": "\\x escapes are only allowed in JSON5",
"JSON5_ESCAPED_CHAR": "Escaped char '{0}' is only valid in JSON5",
"JSON5_UNQUOTED_KEY": "Unquoted keys are only supported in JSON5",
"JSON5_NUM_LEADING_PLUS": "Leading + signs in numbers are not allowed except in JSON5",
"JSON5_HEX_NUM": "Hexadecimal numbers are only part of JSON5",
"JSON5_NUM_LEADING_DECIMAL_POINT": "Numbers with a leading decimal point are only part of JSON5",

could be transformed in something like:

"JSON5_SINGLEQUOTED_STRING": "Singlequoted strings are only allowed in JSON5",
"JSON5_ESCAPED_NEWLINE": "Escaped newline characters are only allowed in JSON5",
"JSON5_X_ESCAPE": "\\x escapes are only allowed in JSON5",
"JSON5_ESCAPED_CHAR": "Escaped char '{0}' is only allowed in JSON5",
"JSON5_UNQUOTED_KEY": "Unquoted keys are only allowed in JSON5",
"JSON5_NUM_LEADING_PLUS": "Leading + signs in numbers are only allowed in JSON5",
"JSON5_HEX_NUM": "Hexadecimal numbers are only allowed in JSON5",
"JSON5_NUM_LEADING_DECIMAL_POINT": "Numbers with a leading decimal point are only allowed in JSON5",

@molsonkiko
Copy link
Owner

@conky77

Is it possible to keep the same structure of the phrase and the same verb in the error messages?

This is a good idea; I was doing some of that earlier, but I got a little lazy I guess.

Once you're done reviewing the error messages, you're welcome to include any proposed changes in english.json5

@molsonkiko
Copy link
Owner

@conky77
I made the wording of syntax error messages more consistent, as you requested.

You can view the changes in wording by looking at the changes to english.json5 in this commit.

@conky77
Copy link
Contributor Author

conky77 commented Jul 18, 2024

@molsonkiko
much better, thanks.
Are
\"contains\" and \"required\"
placeholders or can I translate them?
Can I use " instead of \" ? (apparently the manual doesn't say anything about that).
In the English file, there are 2 different couple of symbol to quote: can I use the same symbol for all? I like better (") (for example I found `false`

@conky77
Copy link
Contributor Author

conky77 commented Jul 18, 2024

@molsonkiko
what does "BAD_ARRAY_ENDSWITH_CURLYBRACE": "Tried to terminate an array with '}'", mean?
Is the following correct?
Character "}" found at the end of an Array when "]" expected

(Google Translate translated something like "I tried to terminate the array with "}" that sounds like "I tried to fix the error but I was not able to do it)

It helps if the following had the same structure
"BAD_OBJECT_ENDSWITH_SQUAREBRACE": "Tried to terminate object with ']'",
"BAD_COLON_BETWEEN_OBJECT_PAIRS": "':' found instead of comma after key-value pair",
"BAD_CHAR_WHERE_COLON_EXPECTED": "Found '{0}' after key {1} when colon expected",

@molsonkiko
Copy link
Owner

Are
\"contains\" and \"required\"
placeholders or can I translate them?

Yes, they are keywords in JSON Schema.

Can I use " instead of "

No, " is the way you escape " in XML. In JSON it's \"

In the English file, there are 2 different couple of symbol to quote: can I use the same symbol for all? I like better (") (for example I found false

That was a deliberate choice on my part. I wrote `false` and not "false" because in JSON, false is a boolean and "false" is a string literal.

Character "}" found at the end of an Array when "]" expected

That's actually a great idea; I'm going to change the original English to make that clearer.

"BAD_OBJECT_ENDSWITH_SQUAREBRACE": "Tried to terminate object with ']'",
"BAD_COLON_BETWEEN_OBJECT_PAIRS": "':' found instead of comma after key-value pair",
"BAD_CHAR_WHERE_COLON_EXPECTED": "Found '{0}' after key {1} when colon expected",

I may change those. I'll think about it.

@conky77
Copy link
Contributor Author

conky77 commented Jul 19, 2024

there is another symbol ( ' )
"BAD_PYTHON_COMMENT": "Python-style '#' comments are not part of any well-accepted JSON specification
"tab_indent_pretty_print": "Use one horizontal tab ('\\t') instead of spaces between levels of JSON when pretty-printing"
"minimal_whitespace_compression": "If true, using the 'Compress JSON' plugin command will remove ALL unnecessary whitespace from the JSON. Otherwise, it will leave after the colon in objects and after the comma in both objects and arrays",

"toolbar_icons": "Specify one of these chars for each toolbar icon you want to show, in the order you want:\r\n('t' = tree view, 'c' = compress, 'p' = pretty-print, 'o' = path to current position)\r\nThis setting will take effect the next time you start Notepad++.\r\nIf you want there to be NO toolbar icons, enter a character that does not represent an icon; do NOT leave this field empty.",
"BAD_NO_COLON_BETWEEN_OBJECT_KEY_VALUE": "Nessun ':' tra la chiave {0} e il valore {0} dell'oggetto",
There are other cases where there aren't no symbols nor a rule for capital letters for keywords like:
inf, Infinity, nan, Not a Number, undefined, true, JavaScript, None

Some message errors start with a capital letter: do I have to respect this rule (because that is not the beginning of the phrase), or can I convert all messages with capital letters for the first letter of the messages

@molsonkiko
Copy link
Owner

molsonkiko commented Jul 19, 2024

Here are my new rules for translating, which I will put at the start of the english.json5 and italian.json5 files. This should answer your questions.

Pay attention to the indented sublist (items start with i. through v. after item 3.

// If you want to translate JsonTools into another language, follow these steps (in the example below, we are translating into the "fooish" language):
// 1. Create a copy of this file at the path "translation/fooish.json5" relative to the JsonTools plugin directory (the directory where the JsonTools.dll binary is installed, *not* the plugin config directory).
// 2. If you are not 100% certain you understand all the rules of JSON syntax, read https://www.json.org/json-en.html
// 3. Edit the values associated with the various keys in this document. Here are some rules that you must follow.
//     i. DO NOT CHANGE THE KEYS OF ANY OBJECT, OR ADD OR REMOVE KEYS! ONLY CHANGE THE VALUES.
//     ii. Some of these values will have "{integer}" in their text,
//         like the "{0}" and "{1}" in "Found '{0}' after key {1} when colon expected".
//         When you see "{1}" in a value, this means "insert the 2nd piece of extra information required to render this message".
//         When translating these values, it is VERY IMPORTANT that your translation includes all the "{integer}" occurrences.
//         EXAMPLES OF TRANSLATING "Found '{0}' after key {1} when colon expected" TO ITALIAN:
//         GOOD: "Trovato '{0}' dopo la chiave {1} quando erano previsti i due punti"
//         BAD (missing "{0}"): "Trovato '' dopo la chiave {1} quando erano previsti i due punti"
//         BAD (missing "{1}"): "Trovato '{0}' dopo la chiave {} quando erano previsti i due punti"
//         BAD (has "{0.}" instead of "{0}"): "Trovato '{0.}' dopo la chiave {1} quando erano previsti i due punti"
//     iii. The following words are keywords and MUST BE PRESERVED EXACTLY (including case).
//         - null
//         - true
//         - false
//         - NaN
//         - Infinity
//         - None
//         - True
//         - False
//         - nan
//         - inf
//         - undefined
//     iv. The ', ", and ` characters have specific meanings, and CANNOT BE USED INTERCHANGABLY.
//         If you see 'x' in one place, `x` in another place, and "x" in a third place, assume that this was an intentional choice by molsonkiko, and leave it unchanged.
//     v. If you see a word surrounded in \" or ' or ` inside a value, it is a keyword, so don't change it.
// 4a. Go to the settings and change the `logger_level` setting to JSON5.
// 4b. Use the "Check JSON syntax now" command to make sure that this document has no syntax errors with a severity of BAD or FATAL.
// 5. Close Notepad++ and reopen it, then look at the various JsonTools forms and menu items to see if the translation is satisfactory.

@molsonkiko
Copy link
Owner

I've added the ability to translate message boxes. See this field of the translation files.

I eventually want to add translation of error messages too.

@conky77
Copy link
Contributor Author

conky77 commented Jul 21, 2024

@molsonkiko
Sometimes the messages start with a capital letter, and sometimes they do not. Do I have to respect that? (for example, because the phrase continues.

In my opinion, in a caption message of a message box is not very common to see punctuation like exclamation marks ( ? ), exclamation marks ( ! ) or ellipses (...).
In general, not only for captions,
the question mark should be used only if the user has to answer (for example, YES or NO).
It is not common to use the question mark in messages
Use ( ...) only in a menu item or button caption if it opens a dialog box or a window, program with a user interface, before launching a command
Apostrophe ( ' ) has a grammatical meaning both in English (isn't, it's, can't, I've, ecc) and in Italian (to join articles, pronouns, and prepositions with the following words and to truncate words at the end). Using it for other purposes could generate confusion
Notepad++ uses ( ' ) only for grammar use. However, if you decide to keep using apostrophes, I'll find a turnaround in case of confusion.
In case you need some examples, let me know.

@molsonkiko
Copy link
Owner

molsonkiko commented Jul 21, 2024

Sometimes the messages start with a capital letter, and sometimes they do not. Do I have to respect that? (for example, because the phrase continues.

If the message starts with a keyword (like False or True), you must respect the case, as I explained in sub-point iii of point 3 of the instructions. Otherwise, it doesn't matter.

Apostrophe ( ' ) has a grammatical meaning both in English (isn't, it's, can't, I've, ecc) and in Italian (to join articles, pronouns, and prepositions with the following words and to truncate words at the end). Using it for other purposes could generate confusion

Yes, obviously I'm aware of this. In C#, Java, C, and many other languages, 'x' represents a single character, and "x" represents a string of length 1. These are two different things. I'm sorry if this doesn't make sense to you, but do not change any instances of " or ' or `. Your objections are overruled.

In my opinion, in a caption message of a message box is not very common to see punctuation like exclamation marks ( ? ), exclamation marks ( ! ) or ellipses (...).
In general, not only for captions,
the question mark should be used only if the user has to answer (for example, YES or NO).
It is not common to use the question mark in messages
Use ( ...) only in a menu item or button caption if it opens a dialog box or a window, program with a user interface, before launching a command

Your objection is overruled.

@conky77
Copy link
Contributor Author

conky77 commented Jul 21, 2024

It is not a OBJECTION , but a suggestion.
In Italian translation, do I have to keep exlamation and question mark, even if in Italian, it is not common?

@molsonkiko
Copy link
Owner

In Italian translation, do I have to keep exlamation and question mark, even if in Italian, it is not common?

No, you can omit those if you think it makes sense to do so.

You can also omit ... wherever you think it is appropriate.

@molsonkiko
Copy link
Owner

I've added translation of the tree view title and the new progress bar for the JSON from files and APIs form.

I spent quite a while in Google Translate trying to make sure that the translations captured the exact meaning I was looking for, but you're welcome to provide feedback.

@molsonkiko
Copy link
Owner

I finally translated all the message boxes using Google Translate.

As always, I tried to be very careful to ensure that the translations were both readable and consistent with your earlier translations, but you're more than welcome to change anything you think isn't quite right.

@conky77
Copy link
Contributor Author

conky77 commented Aug 17, 2024

Hi @molsonkiko in september, I will review everything. If you had any test file to reproduce errors and messages you would welcome. So I can test everything. Especially since I don't know all the standards mentioned in the messages. In case once I come back from holidays, I'll give you the details of messages that are not clear to me.

@molsonkiko
Copy link
Owner

@conky77

If you had any test file to reproduce errors and messages you would welcome. So I can test everything.

Unfortunately it is not feasible to provide test files for the messageBoxes field, which is all I need help with right now. If you don't feel confident translating something without an example, don't feel obliged to try translating it.

Honestly, at this point it is probably fine to just wait and see if any other Italian-speaking users complain about the translation, and save you some trouble.

@molsonkiko
Copy link
Owner

Rather than continuing to lengthen this issue's discussion with discussion that's specific to the Italian translation, I will close this issue.

@conky77
If you're dissatisfied with the Italian translation, you can create a new issue, or just submit a new PR, and explain in your initial comment of the PR why you think the translation should be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request probably fixed? the issue/feature appears to be fixed/implemented, but there still may be issues
Projects
None yet
Development

No branches or pull requests

2 participants