Replies: 7 comments 7 replies
-
Hi, Thank you for your translations! The 3 pull requests are merged now. Not everything can be translated by simply editing a translation file. Some of the text is "hard-coded". "Hard-coded" text is basically text that's directly written into the program's source code, rather than being pulled from separate translation files. If there are specific parts of the UI you would like to translate next, just let me know! We can work on adding keys to the translation files for those bits, making it way easier for you to help out without diving into the Java source code. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
OK, let's do it! As a first step, you need to synchronize your repository with the latest version. Currently https://github.com/PatLabGit/Pixelitor is saying that "This branch is 3 commits ahead of, 2 commits behind lbalazscs/Pixelitor:master.". This happened because you started one of the pull requests from your master branch. It's better to create a separate branch for each pull request, but don't worry, it can be fixed. Go to the "Sync fork" dropdown menu and choose the RED option, the one which discards local commits. (Normally this would be bad, but in this case we know that your changes are already merged). After this your master branch on github should be up to date. Now you need to also synchronize your local copy. Normally you would run the command "git pull" to do that, but in this case "git pull" would show an error, so you need to run "git pull --rebase" instead. Now, let's see those hardcoded strings and let's start with the Move Tool. The source code is in https://github.com/lbalazscs/Pixelitor/blob/master/src/main/java/pixelitor/tools/move/MoveTool.java The tooltip of the tool button (the hover description) is "Move Tool (V)", but this string isn't in the source code, because it's created from 3 parts: the short name "Move", the string "Tool", which is added to each short name (the "long name" is "Move Tool"), and the shortcut. This is a bit complicated, so let's do it later, and start with something simpler. If you search for "Auto Select Layer:" in the same file, you will find this code: settingsPanel.addWithLabel("Auto Select Layer:",
autoSelectCheckBox, "autoSelectCheckBox"); We need to change this code so that the "Auto Select Layer:" string comes from the translation file. For this, new key-value pairs also have to be added to at least two files: texts.properties and texts_fr.properties. Let me know if you managed to synchronize your repository and understood it so far, and if yes, I will explain it further from here tomorrow. You can also create a PR for the tip of the day improvements. Don't forget to create a new branch for it (after you synchronized your repo). |
Beta Was this translation helpful? Give feedback.
-
Yes I think I understood so far. Surprisingly, the code looks like JavaScript which make me feel a lot more comfortable. Two things, though:
In the end, if I understood correctly, I should transpose this code
in a way to match the formatting of texts.properties like below, am I right? What about this code below? (about the html tags have no worries I know them well, and I suppose that the + between 2 double quotes is to concatenate the strings inside the double quotes? )
Last but not least,
How do I create a new branch? |
Beta Was this translation helpful? Give feedback.
-
Yes, Java and JavaScript both use a similar syntax.
You should do a "git clone" instead of downloading. And you should clone your own repository (your fork), because then you will be able to push changes to it. After you pushed your changes to your fork, you can create a pull request using the web interface. Note that there are many tutorials on the web, such as this one: https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project
There are many online tutorials, such as this one https://git-scm.com/book/en/v2/Getting-Started-The-Command-Line
Yes, in the .properties files there are key-value pairs, the key is on the left, and the value on the right. You have to add new key-value pairs to the default file texts.properties and the French translation file texts_fr.properties. The key can be anything, the value in the default file texts.properties is the English text, and the value in the French translation file texts_fr.properties is the French text.
Let's deal with these texts later, and concentrate first on the simplest part (the texts on the top part)
You already created two new branches (patch-1 and patch-2 with the web ui). On the command line you first go to the master branch (git checkout master), and then from there you do a In the newest commit, I added the key for the "Move:" text in the Move tool. Note how it looks now: String moveText = resources.getString("mt_move");
settingsPanel.addComboBox(moveText, modeSelector, "modeSelector"); Previously it looked like this: settingsPanel.addComboBox("Move:", modeSelector, "modeSelector"); In the new version, the "Move:" text isn't "hardcoded" in the Java file. Instead, the Java file looks up the language-dependent string by using the "mt_move" key (the key can be anything, I used the "mt" abbreviation to mean "move tool").
and in texts_fr.properties you see the French translation:
Well, it's not actually a French translation, because I don't know the French for it, but if you use the French language, then you should see "French Move:" in the UI, and in all other languages you should see the original "Move:" As the next step, I propose that you correct the French for mt_move, and also add a translation key for the text "Auto Select Layer:". The key can be anything, I suggest "mt_auto_sel_layer". Let me know if you have any questions! If you get this working, please create a new PR (PR=pull request). Don't forget to synchronize your repository on GitHub first (you will have to do this whenever there is a new commit in my repository.) Your branch is 2 commits behind (because today I added two new commits), and there should be no RED option now when synchronizing (because you are only behind, not also ahead) |
Beta Was this translation helpful? Give feedback.
-
Hi @PatLabGit, I'm targeting this internationalization changes too. So, how can we work together? |
Beta Was this translation helpful? Give feedback.
-
If the text was used once, it can be used over again in some point in the future. With all the text inside GUIText we have a single point of maintenance (Single Responsability Principle). That's the advantage, I think. But I can start with the simpler messages. In the future, if we agree with that strategy, or other, we can change. No problem. |
Beta Was this translation helpful? Give feedback.
-
I would like to do the full French translation even the tip of the day when opening Pixelitor, but there is not much help outside going to this one https://github.com/lbalazscs/Pixelitor/blob/master/Translating.md which barely gives 2 files to translate.
Thus my question is... where are the files to translate the full UI?
;)
Beta Was this translation helpful? Give feedback.
All reactions