Skip to content

Commit

Permalink
Do not translate labels of boards submenus
Browse files Browse the repository at this point in the history
Otherwise it may happen some weird sorting when untraslated and
translated labels are sorted together:

    Arduino megaAVR Boards
    Arduino nRF52 Board
    ESP32 Arduino
    ESP8266 Modules
    Schede Arduino AVR   <-- the localized string falls to the bottom

Also there is no way for 3rd party boards developers to actually provide
a translation, so let's just remove them.
  • Loading branch information
cmaglie committed Mar 25, 2020
1 parent 55fa3f5 commit 9ffe1e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
19 changes: 11 additions & 8 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -1481,19 +1481,22 @@ public void actionPerformed(ActionEvent actionevent) {
ButtonGroup boardsButtonGroup = new ButtonGroup();
Map<String, ButtonGroup> buttonGroupsMap = new HashMap<>();

List<JMenu> platformMenus = new ArrayList<JMenu>();
class PlatformJMenu extends JMenu {
public PlatformJMenu(TargetPlatform pl) {
String text = pl.getPreferences().get("name");
if (text == null) {
text = pl.getContainerPackage().getId() + "-" + pl.getId();
}
setText(text);
}
}
List<PlatformJMenu> platformMenus = new ArrayList<>();

// Cycle through all packages
for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
// For every package cycle through all platform
for (TargetPlatform targetPlatform : targetPackage.platforms()) {

// Add a title for each platform
String platformLabel = targetPlatform.getPreferences().get("name");
if (platformLabel == null)
platformLabel = targetPackage.getId() + "-" + targetPlatform.getId();

JMenu platformBoardsMenu = new JMenu(tr(platformLabel));
PlatformJMenu platformBoardsMenu = new PlatformJMenu(targetPlatform);
MenuScroller.setScrollerFor(platformBoardsMenu);
platformMenus.add(platformBoardsMenu);

Expand Down
4 changes: 0 additions & 4 deletions arduino-core/src/processing/app/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ public static String format(String fmt, Object... args) {
* This method is an hack to extract words with gettext tool.
*/
protected static void unusedStrings() {
// These phrases are defined in the "platform.txt".
tr("Arduino AVR Boards");
tr("Arduino ARM (32-bits) Boards");

// This word is defined in the "boards.txt".
tr("Processor");
}
Expand Down

0 comments on commit 9ffe1e2

Please sign in to comment.