Skip to content

Commit b450a27

Browse files
author
Federico Fissore
committed
Allowing boards/libs types and categories to be translated. Fixes #3646
1 parent 04cfe0c commit b450a27

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

app/src/cc/arduino/contributions/libraries/ui/DropdownLibraryOfCategoryItem.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
import java.util.function.Predicate;
3737

38+
import static processing.app.I18n.tr;
39+
3840
public class DropdownLibraryOfCategoryItem implements DropdownItem<ContributedLibrary> {
3941

4042
private final String category;
@@ -44,7 +46,7 @@ public DropdownLibraryOfCategoryItem(String category) {
4446
}
4547

4648
public String toString() {
47-
return category;
49+
return tr(category);
4850
}
4951

5052
@Override

app/src/cc/arduino/contributions/libraries/ui/DropdownLibraryOfTypeItem.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
import java.util.function.Predicate;
3737

38+
import static processing.app.I18n.tr;
39+
3840
public class DropdownLibraryOfTypeItem implements DropdownItem<ContributedLibrary> {
3941

4042
private final String type;
@@ -44,7 +46,7 @@ public DropdownLibraryOfTypeItem(String type) {
4446
}
4547

4648
public String toString() {
47-
return type;
49+
return tr(type);
4850
}
4951

5052
@Override

app/src/cc/arduino/contributions/packages/ui/DropdownCoreOfCategoryItem.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
import java.util.function.Predicate;
3737

38+
import static processing.app.I18n.tr;
39+
3840
public class DropdownCoreOfCategoryItem implements DropdownItem<ContributedPlatform> {
3941

4042
private final String category;
@@ -44,7 +46,7 @@ public DropdownCoreOfCategoryItem(String category) {
4446
}
4547

4648
public String toString() {
47-
return category;
49+
return tr(category);
4850
}
4951

5052
@Override

arduino-core/src/processing/app/I18n.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@
1919
import java.util.ResourceBundle;
2020

2121
public class I18n {
22+
23+
static {
24+
tr("Arduino");
25+
tr("Partner");
26+
tr("Recommended");
27+
tr("Contributed");
28+
29+
tr("Display");
30+
tr("Communication");
31+
tr("Signal Input/Output");
32+
tr("Sensors");
33+
tr("Device Control");
34+
tr("Timing");
35+
tr("Data Storage");
36+
tr("Data Processing");
37+
tr("Other");
38+
tr("Uncategorized");
39+
}
40+
2241
// start using current locale but still allow using the dropdown list later
2342
private static ResourceBundle i18n;
2443

@@ -87,7 +106,7 @@ public static String format(String fmt, Object... args) {
87106

88107
/**
89108
* Does nothing.
90-
* <p/>
109+
* <p>
91110
* This method is an hack to extract words with gettext tool.
92111
*/
93112
protected static void unusedStrings() {

0 commit comments

Comments
 (0)