Skip to content

Commit 1e143f7

Browse files
committed
new translation keys
1 parent 7f280bc commit 1e143f7

32 files changed

+874
-274
lines changed

Translating.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# Translating the Pixelitor user interface
22

3-
- The translation files are in the [resources](src/main/resources) directory. They are text files with key=value pairs, where the value is the translated text.
4-
- For each language there has to be a translation file named
5-
texts_<a href="https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">lang-code</a>.properties.
6-
- The files might contain English text if they are not fully translated - feel free to correct them.
7-
- A lot of text is still hard-coded (doesn't come from the translation files), let me know if you want to translate some
8-
of it (open an issue), and I will add it to the translation files
9-
- If you create a new file for a new language, start by making a copy of the English one (the one without a language code).
10-
- The text for the "Tip of the Day" is coming from tips.properties in the same directory, it could be translated
11-
similarly.
12-
- The color chooser's translation files are in [com/bric/swing/resources](src/main/resources/com/bric/swing/resources),
13-
they have the same structure.
14-
- Translating every text in the user interface is a big task. It's OK if you contribute only a few translations.
3+
- The translation files are in the [resources](src/main/resources) directory. These are text files with `key=value` pairs, where the value is the translated text.
4+
- Each language needs a file named texts_<a href="https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">lang-code</a>.properties.
5+
- The existing files still have English text if they’re not fully translated. Feel free to fix or complete them.
6+
- A lot of text is still hard-coded (not loaded from the translation files). If you’d like to translate some of it, open an issue and I’ll add it to the files. Alternatively, if you know Java, you can create a PR that extracts more text into the translation files.
7+
- If you’re adding a new language, start by copying the English file (the one without a language code).
8+
- The text for the "Tip of the Day" comes from `tips.properties` in the same directory and can be translated in the same way.
9+
- The color chooser's translation files are in [com/bric/swing/resources](src/main/resources/com/bric/swing/resources). They also work the same way.
10+
- Translating everything is a big task. It’s totally fine if you just add a few translations.
1511

1612

src/main/java/pixelitor/colors/palette/FullPalette.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
2+
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
33
*
44
* This file is part of Pixelitor. Pixelitor is free software: you
55
* can redistribute it and/or modify it under the terms of the GNU
@@ -29,11 +29,13 @@ public class FullPalette extends Palette {
2929
// are remembered between dialog sessions
3030
private static int lastRowCount = 11;
3131
private static int lastColumnCount = 7;
32+
private final String dialogTitle;
3233

3334
private int hueSteps;
3435

35-
public FullPalette() {
36+
public FullPalette(String dialogTitle) {
3637
super(lastRowCount, lastColumnCount);
38+
this.dialogTitle = dialogTitle;
3739

3840
config = new HueSatPaletteConfig(0, 0.9f); // default saturation is 90%
3941
}
@@ -78,6 +80,6 @@ private float calcHue(int row, float hueOffset) {
7880

7981
@Override
8082
public String getDialogTitle() {
81-
return "Color Palette";
83+
return dialogTitle;
8284
}
8385
}

src/main/java/pixelitor/filters/RepeatLast.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Laszlo Balazs-Csiki and Contributors
2+
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
33
*
44
* This file is part of Pixelitor. Pixelitor is free software: you
55
* can redistribute it and/or modify it under the terms of the GNU
@@ -22,6 +22,7 @@
2222
import pixelitor.filters.util.Filters;
2323
import pixelitor.layers.Drawable;
2424
import pixelitor.menus.DrawableAction;
25+
import pixelitor.utils.Texts;
2526

2627
import java.util.Optional;
2728

@@ -32,12 +33,12 @@
3233
* Currently, only filters can be repeated.
3334
*/
3435
public class RepeatLast extends DrawableAction {
36+
private static final String REPEAT_LAST_DEFAULT_NAME = Texts.i18n("repeat_last_def");
37+
private static final String SHOW_LAST_DEFAULT_NAME = Texts.i18n("show_last_def");
38+
3539
public static final RepeatLast REPEAT_LAST_ACTION = new RepeatLast(false);
3640
public static final RepeatLast SHOW_LAST_ACTION = new RepeatLast(true);
3741

38-
private static final String REPEAT_LAST_DEFAULT_NAME = "Repeat Last";
39-
private static final String SHOW_LAST_DEFAULT_NAME = "Show Last";
40-
4142
private final boolean showDialog;
4243

4344
private RepeatLast(boolean showDialog) {
@@ -80,15 +81,17 @@ public void setEnabled(boolean newValue) {
8081
}
8182

8283
public static void update(Filter lastFilter) {
83-
REPEAT_LAST_ACTION.setText("Repeat " + lastFilter.getName());
84+
Object[] lastFilterNameArgs = {lastFilter.getName()};
85+
86+
REPEAT_LAST_ACTION.setText(Texts.formatI18N("repeat_last", lastFilterNameArgs));
8487
REPEAT_LAST_ACTION.setEnabled(true);
8588

8689
if (lastFilter instanceof FilterWithGUI) {
87-
SHOW_LAST_ACTION.setText("Show " + lastFilter.getName() + "...");
90+
SHOW_LAST_ACTION.setText(Texts.formatI18N("show_last", lastFilterNameArgs) + "...");
8891
SHOW_LAST_ACTION.setEnabled(true);
8992
} else {
9093
// can't show a filter GUI for a filter without a GUI
91-
SHOW_LAST_ACTION.setText(REPEAT_LAST_DEFAULT_NAME);
94+
SHOW_LAST_ACTION.setText(SHOW_LAST_DEFAULT_NAME);
9295
SHOW_LAST_ACTION.setEnabled(false);
9396
}
9497
}

src/main/java/pixelitor/guides/AddGridGuidesPanel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ private int getNumVerDivisions() {
7575
return guidesParam.getValue(1) + 1;
7676
}
7777

78-
public static void showAddGridDialog(View view) {
78+
public static void showAddGridDialog(View view, String dialogTitle) {
7979
Guides.Builder builder = new Guides.Builder(view, true);
8080
AddGridGuidesPanel panel = new AddGridGuidesPanel(builder);
8181
new DialogBuilder()
82-
.title("Add Grid Guides")
82+
.title(dialogTitle)
8383
.content(panel)
8484
.withScrollbars()
8585
.okAction(() -> panel.createGuides(false))

src/main/java/pixelitor/guides/AddSingleGuidePanel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ private void setup(Guides guides) {
7878
}
7979

8080
public static void showDialog(View view,
81-
boolean horizontal) {
81+
boolean horizontal,
82+
String dialogTitle) {
8283
Guides.Builder builder = new Guides.Builder(view, false);
8384
AddSingleGuidePanel panel = new AddSingleGuidePanel(builder, horizontal);
84-
String dialogTitle = horizontal ? "Add Horizontal Guide" : "Add Vertical Guide";
8585
new DialogBuilder()
8686
.title(dialogTitle)
8787
.content(panel)

src/main/java/pixelitor/layers/LayerGUI.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,12 @@ private void maskIconClicked(MouseEvent e) {
536536
MaskViewMode.RUBYLITH.activate(view, layer);
537537
}
538538
} else if (altClick) {
539-
// alt-click switches to SHOW_MASK
540-
// except when it already is in SHOW_MASK
541-
if (view.getMaskViewMode() == MaskViewMode.SHOW_MASK) {
539+
// alt-click switches to VIEW_MASK
540+
// except when it already is in VIEW_MASK
541+
if (view.getMaskViewMode() == MaskViewMode.VIEW_MASK) {
542542
MaskViewMode.EDIT_MASK.activate(view, layer);
543543
} else {
544-
MaskViewMode.SHOW_MASK.activate(view, layer);
544+
MaskViewMode.VIEW_MASK.activate(view, layer);
545545
}
546546
} else if (shiftClick) {
547547
// shift-click toggles the enabled-disabled state

src/main/java/pixelitor/layers/LayerMaskActions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Laszlo Balazs-Csiki and Contributors
2+
* Copyright 2025 Laszlo Balazs-Csiki and Contributors
33
*
44
* This file is part of Pixelitor. Pixelitor is free software: you
55
* can redistribute it and/or modify it under the terms of the GNU
@@ -42,7 +42,7 @@ protected PopupMouseListener(Layer layer) {
4242
JMenu showMenu = new JMenu("Show/Edit");
4343
menu.add(showMenu);
4444
MaskViewMode.NORMAL.addToPopupMenu(showMenu, layer);
45-
MaskViewMode.SHOW_MASK.addToPopupMenu(showMenu, layer);
45+
MaskViewMode.VIEW_MASK.addToPopupMenu(showMenu, layer);
4646
MaskViewMode.EDIT_MASK.addToPopupMenu(showMenu, layer);
4747
MaskViewMode.RUBYLITH.addToPopupMenu(showMenu, layer);
4848

src/main/java/pixelitor/layers/MaskFromColorRangePanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import pixelitor.filters.gui.RangeParam;
2424
import pixelitor.gui.utils.*;
2525
import pixelitor.utils.Cursors;
26+
import pixelitor.utils.Texts;
2627

2728
import javax.swing.*;
2829
import javax.swing.event.ChangeListener;
@@ -56,7 +57,7 @@
5657
* GUI panel for creating layer masks based on color similarity.
5758
*/
5859
public class MaskFromColorRangePanel extends JPanel {
59-
public static final String NAME = "Mask from Color Range";
60+
public static final String NAME = Texts.i18n("lm_add_from_range");
6061
private static final int DEFAULT_THUMB_SIZE = 512;
6162
private static final String HELP_TEXT = "Select a color by clicking or dragging on the image";
6263

src/main/java/pixelitor/layers/MaskViewMode.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import pixelitor.menus.PMenu;
2929
import pixelitor.menus.edit.FadeAction;
3030
import pixelitor.tools.Tools;
31+
import pixelitor.utils.Texts;
3132
import pixelitor.utils.test.Events;
3233

3334
import javax.swing.*;
@@ -42,13 +43,13 @@
4243
* and whether the mask editing is done in "rubylith" mode.
4344
*/
4445
public enum MaskViewMode {
45-
NORMAL("Show and Edit Layer", false, false, false,
46+
NORMAL("lm_edit_layer", false, false, false,
4647
LayerRestriction.ALLOW_ALL, CTRL_1) {
47-
}, SHOW_MASK("Show and Edit Mask", true, true, false,
48+
}, VIEW_MASK("lm_view_mask", true, true, false,
4849
LayerRestriction.HAS_LAYER_MASK, CTRL_2) {
49-
}, EDIT_MASK("Show Layer, but Edit Mask", false, true, false,
50+
}, EDIT_MASK("lm_edit_mask", false, true, false,
5051
LayerRestriction.HAS_LAYER_MASK, CTRL_3) {
51-
}, RUBYLITH("Show Mask as Rubylith, Edit Mask", false, true, true,
52+
}, RUBYLITH("lm_ruby", false, true, true,
5253
LayerRestriction.HAS_LAYER_MASK, CTRL_4) {
5354
};
5455

@@ -59,9 +60,9 @@ public enum MaskViewMode {
5960
private final boolean showMask;
6061
private final boolean editMask;
6162

62-
MaskViewMode(String displayName, boolean showMask, boolean editMask, boolean showRuby,
63+
MaskViewMode(String displayKey, boolean showMask, boolean editMask, boolean showRuby,
6364
LayerRestriction layerRestriction, KeyStroke keyStroke) {
64-
this.displayName = displayName;
65+
this.displayName = Texts.i18n(displayKey);
6566
this.showMask = showMask;
6667
this.editMask = editMask;
6768
this.showRuby = showRuby;

0 commit comments

Comments
 (0)