added flags
@@ -125,11 +125,29 @@ public class TranslateUtil {
|
|||||||
return missing;
|
return missing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getAvailableLanguages() {
|
public static Map<String, Map<String, String>> getAvailableLanguages() {
|
||||||
try (Stream<Path> walk = Files.walk(Paths.get(LANG_DIR))) {
|
try (Stream<Path> walk = Files.walk(Paths.get(LANG_DIR))) {
|
||||||
|
Map<String, Map<String, String>> res = new HashMap<String, Map<String, String>>();
|
||||||
return walk.filter(Files::isRegularFile).map(x -> x.getFileName().toString().replaceFirst("[.][^.]+$", ""))
|
List<String> files = walk.filter(Files::isRegularFile).map(x -> x.getFileName().toString())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
for (String file : files) {
|
||||||
|
String key = file.replaceFirst("[.][^.]+$", "");
|
||||||
|
Map<String, String> details = new HashMap<String, String>();
|
||||||
|
try (Stream<String> stream = Files.lines(
|
||||||
|
Paths.get(LANG_DIR + File.separator + file), StandardCharsets.UTF_8)) {
|
||||||
|
stream.forEach(s -> {
|
||||||
|
if (s.contains("=")) {
|
||||||
|
String[] parts = s.split("=");
|
||||||
|
if (parts.length == 2)
|
||||||
|
details.put(parts[0].toLowerCase().trim(), parts[1].trim());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.error("Error loading language file", e);
|
||||||
|
}
|
||||||
|
res.put(key, details);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error("Error fetching available languages");
|
LOG.error("Error fetching available languages");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ G-D-S JFET
|
|||||||
G-D-S MOSFET
|
G-D-S MOSFET
|
||||||
G-S-D JFET
|
G-S-D JFET
|
||||||
G-S-D MOSFET
|
G-S-D MOSFET
|
||||||
Idioma
|
|
||||||
Italiano
|
Italiano
|
||||||
NPN
|
NPN
|
||||||
Nederlands
|
Nederlands
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#start-internal
|
||||||
|
icon=germany
|
||||||
|
#end-internal
|
||||||
(Building Blocks)|(Bausteine)
|
(Building Blocks)|(Bausteine)
|
||||||
(Favorites)|(Favoriten)
|
(Favorites)|(Favoriten)
|
||||||
(Recently Used)|(Kürzlich verwendet)
|
(Recently Used)|(Kürzlich verwendet)
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#start-internal
|
||||||
|
icon=usa
|
||||||
|
#end-internal
|
||||||
(Building Blocks)
|
(Building Blocks)
|
||||||
(Favorites)
|
(Favorites)
|
||||||
(Recently Used)
|
(Recently Used)
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#start-internal
|
||||||
|
icon=spain
|
||||||
|
#end-internal
|
||||||
(Building Blocks)|(Bloques de construcción)
|
(Building Blocks)|(Bloques de construcción)
|
||||||
(Favorites)|(Favoritos)
|
(Favorites)|(Favoritos)
|
||||||
(Recently Used)|(Recientemente usado)
|
(Recently Used)|(Recientemente usado)
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#start-internal
|
||||||
|
icon=france
|
||||||
|
#end-internal
|
||||||
(Building Blocks)|(Blocs de construction)
|
(Building Blocks)|(Blocs de construction)
|
||||||
(Favorites)|(Favoris)
|
(Favorites)|(Favoris)
|
||||||
(Recently Used)|(Récemment utilisé)
|
(Recently Used)|(Récemment utilisé)
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#start-internal
|
||||||
|
icon=italy
|
||||||
|
#end-internal
|
||||||
(Building Blocks)|(Building Blocks)
|
(Building Blocks)|(Building Blocks)
|
||||||
(Favorites)|(Preferiti)
|
(Favorites)|(Preferiti)
|
||||||
(Recently Used)|(Usato di recente)
|
(Recently Used)|(Usato di recente)
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#start-internal
|
||||||
|
icon=netherlands
|
||||||
|
#end-internal
|
||||||
(Building Blocks)|(Bouwstenen)
|
(Building Blocks)|(Bouwstenen)
|
||||||
(Favorites)|(Favorieten)
|
(Favorites)|(Favorieten)
|
||||||
(Recently Used)|(Onlangs gebruikt)
|
(Recently Used)|(Onlangs gebruikt)
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
DIY Layout Creator (DIYLC).
|
||||||
|
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
|
||||||
|
This file is part of DIYLC.
|
||||||
|
|
||||||
|
DIYLC is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
DIYLC is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package org.diylc.flags;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads image resources as Icons.
|
||||||
|
*
|
||||||
|
* @author Branislav Stojkovic
|
||||||
|
*/
|
||||||
|
public class FlagLoader {
|
||||||
|
|
||||||
|
public static Icon getIcon(String name) {
|
||||||
|
java.net.URL imgURL = FlagLoader.class.getResource("flag_" + name + ".png");
|
||||||
|
if (imgURL != null) {
|
||||||
|
return new ImageIcon(imgURL, name);
|
||||||
|
} else {
|
||||||
|
System.err.println("Couldn't find file: " + name);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 710 B |
|
After Width: | Height: | Size: 686 B |
|
After Width: | Height: | Size: 708 B |
|
After Width: | Height: | Size: 758 B |
|
After Width: | Height: | Size: 664 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 755 B |
|
After Width: | Height: | Size: 773 B |
|
After Width: | Height: | Size: 703 B |
|
After Width: | Height: | Size: 618 B |
|
After Width: | Height: | Size: 697 B |
|
After Width: | Height: | Size: 760 B |
|
After Width: | Height: | Size: 590 B |
|
After Width: | Height: | Size: 692 B |
|
After Width: | Height: | Size: 707 B |
|
After Width: | Height: | Size: 685 B |
|
After Width: | Height: | Size: 676 B |
|
After Width: | Height: | Size: 698 B |
|
After Width: | Height: | Size: 667 B |
|
After Width: | Height: | Size: 622 B |
|
After Width: | Height: | Size: 747 B |
|
After Width: | Height: | Size: 633 B |
|
After Width: | Height: | Size: 805 B |
|
After Width: | Height: | Size: 728 B |
|
After Width: | Height: | Size: 693 B |
|
After Width: | Height: | Size: 664 B |
|
After Width: | Height: | Size: 664 B |
|
After Width: | Height: | Size: 772 B |
|
After Width: | Height: | Size: 898 B |
|
After Width: | Height: | Size: 750 B |
|
After Width: | Height: | Size: 760 B |
|
After Width: | Height: | Size: 594 B |
|
After Width: | Height: | Size: 657 B |
|
After Width: | Height: | Size: 672 B |
|
After Width: | Height: | Size: 867 B |
|
After Width: | Height: | Size: 717 B |
|
After Width: | Height: | Size: 651 B |
|
After Width: | Height: | Size: 729 B |
|
After Width: | Height: | Size: 695 B |
|
After Width: | Height: | Size: 769 B |
|
After Width: | Height: | Size: 780 B |
|
After Width: | Height: | Size: 577 B |
|
After Width: | Height: | Size: 633 B |
|
After Width: | Height: | Size: 605 B |
|
After Width: | Height: | Size: 576 B |
|
After Width: | Height: | Size: 731 B |
|
After Width: | Height: | Size: 718 B |
|
After Width: | Height: | Size: 720 B |
|
After Width: | Height: | Size: 746 B |
|
After Width: | Height: | Size: 698 B |
|
After Width: | Height: | Size: 638 B |
|
After Width: | Height: | Size: 745 B |
|
After Width: | Height: | Size: 706 B |
|
After Width: | Height: | Size: 658 B |
|
After Width: | Height: | Size: 664 B |
|
After Width: | Height: | Size: 707 B |
|
After Width: | Height: | Size: 738 B |
|
After Width: | Height: | Size: 857 B |
|
After Width: | Height: | Size: 738 B |
|
After Width: | Height: | Size: 715 B |
|
After Width: | Height: | Size: 639 B |
|
After Width: | Height: | Size: 668 B |
|
After Width: | Height: | Size: 696 B |
|
After Width: | Height: | Size: 685 B |
|
After Width: | Height: | Size: 734 B |
|
After Width: | Height: | Size: 777 B |
|
After Width: | Height: | Size: 632 B |
|
After Width: | Height: | Size: 644 B |
|
After Width: | Height: | Size: 697 B |
|
After Width: | Height: | Size: 746 B |
|
After Width: | Height: | Size: 741 B |
|
After Width: | Height: | Size: 815 B |
|
After Width: | Height: | Size: 669 B |
|
After Width: | Height: | Size: 623 B |
|
After Width: | Height: | Size: 744 B |
|
After Width: | Height: | Size: 628 B |
|
After Width: | Height: | Size: 682 B |
|
After Width: | Height: | Size: 639 B |
|
After Width: | Height: | Size: 791 B |
|
After Width: | Height: | Size: 651 B |
|
After Width: | Height: | Size: 698 B |
|
After Width: | Height: | Size: 730 B |
|
After Width: | Height: | Size: 840 B |
|
After Width: | Height: | Size: 755 B |
|
After Width: | Height: | Size: 707 B |
|
After Width: | Height: | Size: 758 B |
|
After Width: | Height: | Size: 671 B |
|
After Width: | Height: | Size: 730 B |
|
After Width: | Height: | Size: 739 B |
|
After Width: | Height: | Size: 626 B |
|
After Width: | Height: | Size: 665 B |