Compare commits

..

3 commits

Author SHA1 Message Date
Dmitry Isaenko
ceb6949667 Add Czech Translation by @spenaat #67 and Traditional Chinese translation by @qazrfv1234 #68
Update readme
Add new settings screenshot
2020-07-28 02:21:32 +03:00
Dmitry Isaenko
62a0b514b4 Simplify core related to languages selection in settings tab. 2020-07-28 02:09:10 +03:00
Dmitry Isaenko
f332083e27 Rewrite i18n implementation 2020-07-27 19:58:23 +03:00
22 changed files with 500 additions and 128 deletions

View file

@ -46,6 +46,8 @@ Sometimes I add new posts about this project [on my home page](https://developer
* Chinese by [Huang YunKun (htynkn)](https://github.com/htynkn) * Chinese by [Huang YunKun (htynkn)](https://github.com/htynkn)
* German by [Swarsele](https://github.com/Swarsele) * German by [Swarsele](https://github.com/Swarsele)
* Vietnamese by [Hai Phan Nguyen (pnghai)](https://github.com/pnghai) * Vietnamese by [Hai Phan Nguyen (pnghai)](https://github.com/pnghai)
* Czech by [Spenaat](https://github.com/spenaat)
* Chinese (Traditional) by [qazrfv1234](https://github.com/qazrfv1234)
### System requirements ### System requirements

View file

@ -8,7 +8,7 @@
<name>NS-USBloader</name> <name>NS-USBloader</name>
<artifactId>ns-usbloader</artifactId> <artifactId>ns-usbloader</artifactId>
<version>4.1-SNAPSHOT</version> <version>4.2-SNAPSHOT</version>
<url>https://github.com/developersu/ns-usbloader/</url> <url>https://github.com/developersu/ns-usbloader/</url>
<description> <description>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -27,9 +27,14 @@ public class AppPreferences {
private static final AppPreferences INSTANCE = new AppPreferences(); private static final AppPreferences INSTANCE = new AppPreferences();
public static AppPreferences getInstance() { return INSTANCE; } public static AppPreferences getInstance() { return INSTANCE; }
private Preferences preferences; private final Preferences preferences;
private final Locale locale;
private AppPreferences(){ preferences = Preferences.userRoot().node("NS-USBloader"); } private AppPreferences(){
this.preferences = Preferences.userRoot().node("NS-USBloader");
String localeCode = preferences.get("locale", Locale.getDefault().toString());
this.locale = new Locale(localeCode.substring(0, 2), localeCode.substring(3, 5));
}
public String getTheme(){ public String getTheme(){
String theme = preferences.get("THEME", "/res/app_dark.css"); // Don't let user to change settings manually String theme = preferences.get("THEME", "/res/app_dark.css"); // Don't let user to change settings manually
@ -59,6 +64,10 @@ public class AppPreferences {
public String getRecent(){ return preferences.get("RECENT", System.getProperty("user.home")); } public String getRecent(){ return preferences.get("RECENT", System.getProperty("user.home")); }
public void setRecent(String path){ preferences.put("RECENT", path); } public void setRecent(String path){ preferences.put("RECENT", path); }
//------------ SETTINGS ------------------// //------------ SETTINGS ------------------//
public Locale getLocale(){ return this.locale; }
public void setLocale(String langStr){ preferences.put("locale", langStr); }
public boolean getNsIpValidationNeeded() {return preferences.getBoolean("NSIPVALIDATION", true);} public boolean getNsIpValidationNeeded() {return preferences.getBoolean("NSIPVALIDATION", true);}
public void setNsIpValidationNeeded(boolean need){preferences.putBoolean("NSIPVALIDATION", need);} public void setNsIpValidationNeeded(boolean need){preferences.putBoolean("NSIPVALIDATION", need);}
@ -96,9 +105,6 @@ public class AppPreferences {
public boolean getTfXCI(){return preferences.getBoolean("TF_XCI", true);} public boolean getTfXCI(){return preferences.getBoolean("TF_XCI", true);}
public void setTfXCI(boolean prop){ preferences.putBoolean("TF_XCI", prop); } public void setTfXCI(boolean prop){ preferences.putBoolean("TF_XCI", prop); }
public String getLanguage(){return preferences.get("USR_LANG", Locale.getDefault().getISO3Language());}
public void setLanguage(String langStr){preferences.put("USR_LANG", langStr);}
public boolean getNspFileFilterGL(){return preferences.getBoolean("GL_NSP_FILTER", false); } public boolean getNspFileFilterGL(){return preferences.getBoolean("GL_NSP_FILTER", false); }
public void setNspFileFilterGL(boolean prop){preferences.putBoolean("GL_NSP_FILTER", prop);} public void setNspFileFilterGL(boolean prop){preferences.putBoolean("GL_NSP_FILTER", prop);}

View file

@ -19,8 +19,6 @@
package nsusbloader.Controllers; package nsusbloader.Controllers;
import javafx.application.HostServices; import javafx.application.HostServices;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
@ -30,16 +28,12 @@ import javafx.scene.layout.VBox;
import nsusbloader.AppPreferences; import nsusbloader.AppPreferences;
import nsusbloader.ServiceWindow; import nsusbloader.ServiceWindow;
import nsusbloader.ModelControllers.UpdatesChecker; import nsusbloader.ModelControllers.UpdatesChecker;
import nsusbloader.UI.LocaleHolder;
import nsusbloader.UI.SettingsLanguagesSetup;
import nsusbloader.Utilities.WindowsDrivers.DriversInstall; import nsusbloader.Utilities.WindowsDrivers.DriversInstall;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder;
import java.util.*; import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
public class SettingsController implements Initializable { public class SettingsController implements Initializable {
@FXML @FXML
@ -47,69 +41,66 @@ public class SettingsController implements Initializable {
validateNSHostNameCb, validateNSHostNameCb,
expertModeCb, expertModeCb,
autoDetectIpCb, autoDetectIpCb,
randPortCb; randPortCb,
dontServeCb,
autoCheckUpdCb,
tfXciSpprtCb;
@FXML @FXML
private TextField pcIpTextField, private TextField pcIpTextField,
pcPortTextField, pcPortTextField,
pcExtraTextField; pcExtraTextField;
@FXML
private CheckBox dontServeCb;
@FXML @FXML
private VBox expertSettingsVBox; private VBox expertSettingsVBox;
@FXML
private CheckBox autoCheckUpdCb;
@FXML @FXML
private Hyperlink newVersionLink; private Hyperlink newVersionLink;
@FXML
private CheckBox tfXciSpprtCb;
@FXML @FXML
private Button langBtn, private Button langBtn,
checkForUpdBtn, checkForUpdBtn,
drvInstBtn; drvInstBtn;
@FXML @FXML
private ChoiceBox<String> langCB; private ChoiceBox<LocaleHolder> langCB;
@FXML @FXML
private ChoiceBox<String> glVersionChoiceBox; private ChoiceBox<String> glVersionChoiceBox;
private HostServices hs; private HostServices hostServices;
public static final String[] glSupportedVersions = {"v0.5", "v0.7.x", "v0.8"}; public static final String[] glSupportedVersions = {"v0.5", "v0.7.x", "v0.8"};
private ResourceBundle resourceBundle;
@Override @Override
public void initialize(URL url, ResourceBundle resourceBundle) { public void initialize(URL url, ResourceBundle resourceBundle) {
nspFilesFilterForGLCB.setSelected(AppPreferences.getInstance().getNspFileFilterGL()); this.resourceBundle = resourceBundle;
final AppPreferences preferences = AppPreferences.getInstance();
validateNSHostNameCb.setSelected(AppPreferences.getInstance().getNsIpValidationNeeded()); nspFilesFilterForGLCB.setSelected(preferences.getNspFileFilterGL());
validateNSHostNameCb.setSelected(preferences.getNsIpValidationNeeded());
expertSettingsVBox.setDisable(! preferences.getExpertMode());
expertModeCb.setSelected(preferences.getExpertMode());
expertModeCb.setOnAction(e-> expertSettingsVBox.setDisable(! expertModeCb.isSelected()));
expertSettingsVBox.setDisable(!AppPreferences.getInstance().getExpertMode()); autoDetectIpCb.setSelected(preferences.getAutoDetectIp());
pcIpTextField.setDisable(preferences.getAutoDetectIp());
expertModeCb.setSelected(AppPreferences.getInstance().getExpertMode());
expertModeCb.setOnAction(e-> expertSettingsVBox.setDisable(!expertModeCb.isSelected()));
autoDetectIpCb.setSelected(AppPreferences.getInstance().getAutoDetectIp());
pcIpTextField.setDisable(AppPreferences.getInstance().getAutoDetectIp());
autoDetectIpCb.setOnAction(e->{ autoDetectIpCb.setOnAction(e->{
pcIpTextField.setDisable(autoDetectIpCb.isSelected()); pcIpTextField.setDisable(autoDetectIpCb.isSelected());
if (!autoDetectIpCb.isSelected()) if (! autoDetectIpCb.isSelected())
pcIpTextField.requestFocus(); pcIpTextField.requestFocus();
}); });
randPortCb.setSelected(AppPreferences.getInstance().getRandPort()); randPortCb.setSelected(preferences.getRandPort());
pcPortTextField.setDisable(AppPreferences.getInstance().getRandPort()); pcPortTextField.setDisable(preferences.getRandPort());
randPortCb.setOnAction(e->{ randPortCb.setOnAction(e->{
pcPortTextField.setDisable(randPortCb.isSelected()); pcPortTextField.setDisable(randPortCb.isSelected());
if (!randPortCb.isSelected()) if (! randPortCb.isSelected())
pcPortTextField.requestFocus(); pcPortTextField.requestFocus();
}); });
if (AppPreferences.getInstance().getNotServeRequests()){ if (preferences.getNotServeRequests()){
dontServeCb.setSelected(true); dontServeCb.setSelected(true);
autoDetectIpCb.setSelected(false); autoDetectIpCb.setSelected(false);
@ -120,7 +111,7 @@ public class SettingsController implements Initializable {
randPortCb.setDisable(true); randPortCb.setDisable(true);
pcPortTextField.setDisable(false); pcPortTextField.setDisable(false);
} }
pcExtraTextField.setDisable(!AppPreferences.getInstance().getNotServeRequests()); pcExtraTextField.setDisable(! preferences.getNotServeRequests());
dontServeCb.setOnAction(e->{ dontServeCb.setOnAction(e->{
if (dontServeCb.isSelected()){ if (dontServeCb.isSelected()){
@ -148,9 +139,9 @@ public class SettingsController implements Initializable {
} }
}); });
pcIpTextField.setText(AppPreferences.getInstance().getHostIp()); pcIpTextField.setText(preferences.getHostIp());
pcPortTextField.setText(AppPreferences.getInstance().getHostPort()); pcPortTextField.setText(preferences.getHostPort());
pcExtraTextField.setText(AppPreferences.getInstance().getHostExtra()); pcExtraTextField.setText(preferences.getHostExtra());
pcIpTextField.setTextFormatter(new TextFormatter<>(change -> { pcIpTextField.setTextFormatter(new TextFormatter<>(change -> {
if (change.getControlNewText().contains(" ") | change.getControlNewText().contains("\t")) if (change.getControlNewText().contains(" ") | change.getControlNewText().contains("\t"))
@ -179,36 +170,59 @@ public class SettingsController implements Initializable {
})); }));
newVersionLink.setVisible(false); newVersionLink.setVisible(false);
newVersionLink.setOnAction(e-> hs.showDocument(newVersionLink.getText())); newVersionLink.setOnAction(e-> hostServices.showDocument(newVersionLink.getText()));
autoCheckUpdCb.setSelected(AppPreferences.getInstance().getAutoCheckUpdates()); autoCheckUpdCb.setSelected(preferences.getAutoCheckUpdates());
Region btnSwitchImage = new Region(); Region btnSwitchImage = new Region();
btnSwitchImage.getStyleClass().add("regionUpdatesCheck"); btnSwitchImage.getStyleClass().add("regionUpdatesCheck");
checkForUpdBtn.setGraphic(btnSwitchImage); checkForUpdBtn.setGraphic(btnSwitchImage);
checkForUpdBtn.setOnAction(e->{ checkForUpdBtn.setOnAction(e->checkForUpdatesAction());
setDriversInstallFeature();
tfXciSpprtCb.setSelected(preferences.getTfXCI());
SettingsLanguagesSetup settingsLanguagesSetup = new SettingsLanguagesSetup();
langCB.setItems(settingsLanguagesSetup.getLanguages());
langCB.getSelectionModel().select(settingsLanguagesSetup.getRecentLanguage());
configureLanguageButton();
// Set supported old versions
glVersionChoiceBox.getItems().addAll(glSupportedVersions);
String oldVer = preferences.getGlVersion(); // Overhead; Too much validation of consistency
glVersionChoiceBox.getSelectionModel().select(oldVer);
}
private void checkForUpdatesAction(){
Task<List<String>> updTask = new UpdatesChecker(); Task<List<String>> updTask = new UpdatesChecker();
updTask.setOnSucceeded(event->{ updTask.setOnSucceeded(event->{
List<String> result = updTask.getValue(); List<String> result = updTask.getValue();
if (result != null){
if (result == null){
ServiceWindow.getInfoNotification(resourceBundle.getString("windowTitleNewVersionUnknown"),
resourceBundle.getString("windowBodyNewVersionUnknown"));
return;
}
if (result.get(0).isEmpty()){ if (result.get(0).isEmpty()){
ServiceWindow.getInfoNotification(resourceBundle.getString("windowTitleNewVersionNOTAval"), resourceBundle.getString("windowBodyNewVersionNOTAval")); ServiceWindow.getInfoNotification(resourceBundle.getString("windowTitleNewVersionNOTAval"),
resourceBundle.getString("windowBodyNewVersionNOTAval"));
return;
} }
else {
setNewVersionLink(result.get(0)); setNewVersionLink(result.get(0));
ServiceWindow.getInfoNotification(resourceBundle.getString("windowTitleNewVersionAval"), resourceBundle.getString("windowTitleNewVersionAval")+": "+result.get(0) + "\n\n" + result.get(1)); ServiceWindow.getInfoNotification(resourceBundle.getString("windowTitleNewVersionAval"),
} resourceBundle.getString("windowTitleNewVersionAval")+": "+result.get(0) + "\n\n" + result.get(1));
}
else {
ServiceWindow.getInfoNotification(resourceBundle.getString("windowTitleNewVersionUnknown"), resourceBundle.getString("windowBodyNewVersionUnknown"));
}
}); });
Thread updates = new Thread(updTask); Thread updates = new Thread(updTask);
updates.setDaemon(true); updates.setDaemon(true);
updates.start(); updates.start();
}); }
private void setDriversInstallFeature(){
if (isWindows()){ if (isWindows()){
Region btnDrvImage = new Region(); Region btnDrvImage = new Region();
btnDrvImage.getStyleClass().add("regionWindows"); btnDrvImage.getStyleClass().add("regionWindows");
@ -216,69 +230,22 @@ public class SettingsController implements Initializable {
drvInstBtn.setVisible(true); drvInstBtn.setVisible(true);
drvInstBtn.setOnAction(actionEvent -> new DriversInstall(resourceBundle)); drvInstBtn.setOnAction(actionEvent -> new DriversInstall(resourceBundle));
} }
tfXciSpprtCb.setSelected(AppPreferences.getInstance().getTfXCI());
// Language settings area
ObservableList<String> langCBObsList = FXCollections.observableArrayList();
langCBObsList.add("eng");
File jarFile;
try{
String encodedJarLocation = getClass().getProtectionDomain().getCodeSource().getLocation().getPath().replace("+", "%2B");
jarFile = new File(URLDecoder.decode(encodedJarLocation, "UTF-8"));
} }
catch (UnsupportedEncodingException uee){
uee.printStackTrace();
jarFile = null;
}
if(jarFile != null && jarFile.isFile()) { // Run with JAR file
try {
JarFile jar = new JarFile(jarFile);
Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
while (entries.hasMoreElements()) {
String name = entries.nextElement().getName();
if (name.startsWith("locale_"))
langCBObsList.add(name.substring(7, 10));
}
jar.close();
}
catch (IOException ioe){
ioe.printStackTrace(); // TODO: think about better solution?
}
}
else { // Run within IDE
URL resourceURL = this.getClass().getResource("/");
String[] filesList = new File(resourceURL.getFile()).list(); // Screw it. This WON'T produce NullPointerException
for (String jarFileName : filesList)
if (jarFileName.startsWith("locale_"))
langCBObsList.add(jarFileName.substring(7, 10));
}
langCB.setItems(langCBObsList);
if (langCBObsList.contains(AppPreferences.getInstance().getLanguage()))
langCB.getSelectionModel().select(AppPreferences.getInstance().getLanguage());
else
langCB.getSelectionModel().select("eng");
langBtn.setOnAction(e->{
AppPreferences.getInstance().setLanguage(langCB.getSelectionModel().getSelectedItem());
ServiceWindow.getInfoNotification("",
ResourceBundle.getBundle("locale", new Locale(langCB.getSelectionModel().getSelectedItem()))
.getString("windowBodyRestartToApplyLang"));
});
// Set supported old versions
glVersionChoiceBox.getItems().addAll(glSupportedVersions);
String oldVer = AppPreferences.getInstance().getGlVersion(); // Overhead; Too much validation of consistency
glVersionChoiceBox.getSelectionModel().select(oldVer);
}
private boolean isWindows(){ private boolean isWindows(){
return System.getProperty("os.name").toLowerCase().replace(" ", "").contains("windows"); return System.getProperty("os.name").toLowerCase().replace(" ", "").contains("windows");
} }
private void configureLanguageButton(){
langBtn.setOnAction(e->languageButtonAction());
}
private void languageButtonAction(){
LocaleHolder localeHolder = langCB.getSelectionModel().getSelectedItem();
AppPreferences.getInstance().setLocale(localeHolder.getLocaleCode());
Locale newLocale = localeHolder.getLocale();
ServiceWindow.getInfoNotification("",
ResourceBundle.getBundle("locale", newLocale).getString("windowBodyRestartToApplyLang"));
}
public boolean getNSPFileFilterForGL(){return nspFilesFilterForGLCB.isSelected(); } public boolean getNSPFileFilterForGL(){return nspFilesFilterForGLCB.isSelected(); }
public boolean getExpertModeSelected(){ return expertModeCb.isSelected(); } public boolean getExpertModeSelected(){ return expertModeCb.isSelected(); }
public boolean getAutoIpSelected(){ return autoDetectIpCb.isSelected(); } public boolean getAutoIpSelected(){ return autoDetectIpCb.isSelected(); }
@ -293,7 +260,7 @@ public class SettingsController implements Initializable {
public boolean getAutoCheckForUpdates(){ return autoCheckUpdCb.isSelected(); } public boolean getAutoCheckForUpdates(){ return autoCheckUpdCb.isSelected(); }
public boolean getTfXciNszXczSupport(){ return tfXciSpprtCb.isSelected(); } // Used also for NSZ/XCZ public boolean getTfXciNszXczSupport(){ return tfXciSpprtCb.isSelected(); } // Used also for NSZ/XCZ
public void registerHostServices(HostServices hostServices){this.hs = hostServices;} public void registerHostServices(HostServices hostServices){this.hostServices = hostServices;}
public void setNewVersionLink(String newVer){ public void setNewVersionLink(String newVer){
newVersionLink.setVisible(true); newVersionLink.setVisible(true);

View file

@ -32,14 +32,14 @@ import java.util.ResourceBundle;
public class NSLMain extends Application { public class NSLMain extends Application {
public static final String appVersion = "v4.1"; public static final String appVersion = "v4.2";
public static boolean isCli; public static boolean isCli;
@Override @Override
public void start(Stage primaryStage) throws Exception{ public void start(Stage primaryStage) throws Exception{
FXMLLoader loader = new FXMLLoader(getClass().getResource("/NSLMain.fxml")); FXMLLoader loader = new FXMLLoader(getClass().getResource("/NSLMain.fxml"));
Locale userLocale = new Locale(AppPreferences.getInstance().getLanguage()); // NOTE: user locale based on ISO3 Language codes Locale userLocale = AppPreferences.getInstance().getLocale();
ResourceBundle rb = ResourceBundle.getBundle("locale", userLocale); ResourceBundle rb = ResourceBundle.getBundle("locale", userLocale);
loader.setResources(rb); loader.setResources(rb);

View file

@ -0,0 +1,55 @@
/*
Copyright 2019-2020 Dmitry Isaenko
This file is part of NS-USBloader.
NS-USBloader 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.
NS-USBloader 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 NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
*/
package nsusbloader.UI;
import java.util.Locale;
public class LocaleHolder {
private final Locale locale;
private final String localeCode;
private final String languageName;
public LocaleHolder(Locale locale){
this.locale = locale;
this.localeCode = locale.toString();
this.languageName = locale.getDisplayLanguage(locale) + " (" + locale + ")";
}
public LocaleHolder(String localeFileName) {
String country = localeFileName.substring(7, 9);
String language = localeFileName.substring(10, 12);
this.locale = new Locale(country, language);
this.localeCode = locale.toString();
this.languageName = locale.getDisplayLanguage(locale) + " (" + locale + ")";
}
@Override
public String toString(){
return languageName;
}
public String getLocaleCode(){
return localeCode;
};
public Locale getLocale() {
return locale;
}
}

View file

@ -0,0 +1,129 @@
/*
Copyright 2019-2020 Dmitry Isaenko
This file is part of NS-USBloader.
NS-USBloader 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.
NS-USBloader 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 NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
*/
package nsusbloader.UI;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import nsusbloader.AppPreferences;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.Locale;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
public class SettingsLanguagesSetup {
private final ObservableList<LocaleHolder> languages;
private File thisApplicationFile;
private LocaleHolder recentlyUsedLanguageHolder;
public SettingsLanguagesSetup() {
this.languages = FXCollections.observableArrayList();
parseFiles();
sortLanguages();
defineRecentlyUsedLanguageHolder();
}
private void parseFiles() {
if (isApplicationIsJar()) // Executed as JAR file
parseFilesInsideJar();
else // Executed within IDE
parseFilesInFilesystem();
}
private boolean isApplicationIsJar() {
getThisApplicationFile();
return thisApplicationFile != null && thisApplicationFile.isFile();
}
private void getThisApplicationFile() {
try {
String encodedJarLocation =
getClass().getProtectionDomain().getCodeSource().getLocation().getPath().replace("+", "%2B");
this.thisApplicationFile = new File(URLDecoder.decode(encodedJarLocation, "UTF-8"));
} catch (UnsupportedEncodingException uee) {
uee.printStackTrace();
this.thisApplicationFile = null;
}
}
private void parseFilesInsideJar() {
try {
JarFile jar = new JarFile(thisApplicationFile);
Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
while (entries.hasMoreElements()) {
String name = entries.nextElement().getName();
if (name.startsWith("locale_")) {
languages.add(new LocaleHolder(name));
}
}
jar.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
private void parseFilesInFilesystem() {
URL resourceURL = this.getClass().getResource("/");
String[] filesList = new File(resourceURL.getFile()).list(); // Screw it. This WON'T produce NullPointerException
for (String jarFileName : filesList) {
if (jarFileName.startsWith("locale_")) {
languages.add(new LocaleHolder(jarFileName));
}
}
}
private void sortLanguages() {
languages.sort(Comparator.comparing(LocaleHolder::toString));
}
private void defineRecentlyUsedLanguageHolder() {
Locale localeFromPreferences = AppPreferences.getInstance().getLocale();
for (LocaleHolder holder : languages) {
Locale holderLocale = holder.getLocale();
if (holderLocale.equals(localeFromPreferences)) {
this.recentlyUsedLanguageHolder = holder;
return;
}
}
// Otherwise define default one that is "en_US"
for (LocaleHolder holder : languages) {
if (holder.getLocaleCode().equals("en_US")) {
this.recentlyUsedLanguageHolder = holder;
return;
}
}
}
public ObservableList<LocaleHolder> getLanguages() {
return languages;
}
public LocaleHolder getRecentLanguage() {
return recentlyUsedLanguageHolder;
}
}

View file

@ -20,7 +20,7 @@
<HBox alignment="CENTER_LEFT" spacing="5.0"> <HBox alignment="CENTER_LEFT" spacing="5.0">
<children> <children>
<Label text="%tab2_Lbl_Language" /> <Label text="%tab2_Lbl_Language" />
<ChoiceBox fx:id="langCB" prefWidth="100.0" /> <ChoiceBox fx:id="langCB" prefWidth="180.0" />
<Button fx:id="langBtn" mnemonicParsing="false" text="OK" /> <Button fx:id="langBtn" mnemonicParsing="false" text="OK" />
<VBox alignment="CENTER_RIGHT" HBox.hgrow="ALWAYS"> <VBox alignment="CENTER_RIGHT" HBox.hgrow="ALWAYS">
<children> <children>

View file

@ -0,0 +1,71 @@
btn_OpenFile=Zvolit soubory
btn_Upload=Nahr\u00E1t do NS
tab3_Txt_EnteredAsMsg1=Vstoupili jste jako:
tab3_Txt_EnteredAsMsg2=Pro minimalizaci probl\u00E9m\u016F byste m\u011Bl(a) b\u00FDt spr\u00E1vce, nebo m\u00EDt pro tohoto u\u017Eivatele nastaven\u00E1 'udev'.
tab3_Txt_FilesToUploadTitle=Soubory k nahr\u00E1n\u00ED:
tab3_Txt_GreetingsMessage=V\u00EDtejte v NS-USBloaderu
tab3_Txt_NoFolderOrFileSelected=Nebyly vybr\u00E1ny \u017E\u00E1dn\u00E9 soubory: nic k nahr\u00E1n\u00ED.
windowBodyConfirmExit=Pr\u00E1v\u011B prob\u00EDh\u00E1 p\u0159enos dat a zav\u0159en\u00ED aplikace jej p\u0159eru\u0161\u00ED.\nNic hor\u0161\u00EDho nyn\u00ED nem\u016F\u017Eete ud\u011Blat.\nZru\u0161it p\u0159enos a ukon\u010Dit aplikaci?
windowTitleConfirmExit=Ne, te\u010F nechci odej\u00EDt!
btn_Stop=P\u0159eru\u0161it
tab3_Txt_GreetingsMessage2=--\n\
Source: https://github.com/developersu/ns-usbloader/\n\
Site: https://developersu.blogspot.com/search/label/NS-USBloader\n\
Dmitry Isaenko [developer.su]
tab1_table_Lbl_Status=Stav
tab1_table_Lbl_FileName=N\u00E1zev souboru
tab1_table_Lbl_Size=Velikost
tab1_table_Lbl_Upload=Nahr\u00E1t?
tab1_table_contextMenu_Btn_BtnDelete=Odstranit
tab1_table_contextMenu_Btn_DeleteAll=Odstranit v\u0161e
tab2_Lbl_HostIP=IP po\u010D\u00EDta\u010De:
tab1_Lbl_NSIP=IP Switche:
tab2_Cb_ValidateNSHostName=V\u017Edy kontrolovat spr\u00E1vnost IP adresy Switche.
windowBodyBadIp=Ur\u010Dit\u011B jste zadali spr\u00E1vnou IP adresu Switche?
windowTitleBadIp=IP adresa Switche je z\u0159ejm\u011B nespr\u00E1vn\u00E1
tab2_Cb_ExpertMode=Pro experty (nastaven\u00ED s\u00EDt\u011B)
tab2_Lbl_HostPort=port
tab2_Cb_AutoDetectIp=Automaticky detekovat IP adresu
tab2_Cb_RandSelectPort=Vygenerovat n\u00E1hodn\u00FD port
tab2_Cb_DontServeRequests=Neodpov\u00EDdat na po\u017Eadavky
tab2_Lbl_DontServeRequestsDesc=Pokud toto zvol\u00EDte, tento po\u010D\u00EDta\u010D nebude reagovat na \u017E\u00E1dosti o NSP soubory ze strany Switche (v s\u00EDti) a zamez\u00ED TinFoilu prohled\u00E1vat m\u00EDsta se soubory.
tab2_Lbl_HostExtra=extra
windowTitleErrorPort=Nespr\u00E1vn\u00E9 nastaven\u00ED portu!
windowBodyErrorPort=Port mus\u00ED b\u00FDt v rozmez\u00ED 1 a\u017E 65535.
tab2_Cb_AutoCheckForUpdates=Automaticky kontrolovat aktualizace
windowTitleNewVersionAval=Je dostupn\u00E1 nov\u00E1 verze
windowTitleNewVersionNOTAval=Nov\u011Bj\u0161\u00ED verze nen\u00ED k dispozici
windowTitleNewVersionUnknown=Nepoda\u0159ilo se zkontrolovat aktualizace
windowBodyNewVersionUnknown=N\u011Bco se porouchalo\nMo\u017En\u00E1 nejste p\u0159ipojeni k internetu, nebo nefunguje GitHub
windowBodyNewVersionNOTAval=Jste na nejnov\u011Bj\u0161\u00ED verzi
tab2_Cb_AllowXciNszXcz=Umo\u017Enit volbu XCI / NSZ / XCZ soubor\u016F pro Tinfoil
tab2_Lbl_AllowXciNszXczDesc=Lze vyu\u017E\u00EDt v aplikac\u00EDch, kter\u00E9 podporuj\u00ED soubory typu XCI/NSZ/XCZ a pro p\u0159enos vyu\u017E\u00EDvaj\u00ED protokol Tinfoil. Nem\u011B\u0148te, jestli tomu nerozum\u00EDte. Aktivujte pro Awoo Installer.
tab2_Lbl_Language=Jazyk
windowBodyRestartToApplyLang=Pro aplikov\u00E1n\u00ED zm\u011Bn restartujte aplikaci.
btn_OpenSplitFile=Zvolit rozd\u011Blen\u00E9 NSP
tab2_Lbl_ApplicationSettings=Hlavn\u00ED nastaven\u00ED
tabSplMrg_Lbl_SplitNMergeTitle=Utilita k rozd\u011Blen\u00ED/slou\u010Den\u00ED soubor\u016F
tabSplMrg_RadioBtn_Split=Rozd\u011Blit
tabSplMrg_RadioBtn_Merge=Slou\u010Dit
tabSplMrg_Txt_File=Soubor:
tabSplMrg_Txt_Folder=Rozd\u011Blen\u00FD soubor (slo\u017Eka):
tabSplMrg_Btn_SelectFile=Zvolit soubor
tabSplMrg_Btn_SelectFolder=Zvolit slo\u017Eku
tabSplMrg_Lbl_SaveToLocation=Ulo\u017Eit do:
tabSplMrg_Btn_ChangeSaveToLocation=Zm\u011Bnit
tabSplMrg_Btn_Convert=P\u0159ev\u00E9st
windowTitleError=Chyba
windowBodyPleaseFinishTransfersFirst=Soubory nelze rozd\u011Blit/slou\u010Dit, kdy\u017E prob\u00EDh\u00E1 p\u0159enos dat p\u0159es USB/s\u00ED\u0165. Pros\u00EDm, zru\u0161te nejprve v\u0161echny aktivn\u00ED p\u0159enosy.
done_txt=Hotovo!
failure_txt=Proces selhal
btn_Select=Zvolit
btn_InjectPayloader=Injectnout Payload
tabNXDT_Btn_Start=Za\u010D\u00EDt!
tab2_Btn_InstallDrivers=St\u00E1hnout a nainstalovat ovlada\u010De
windowTitleDownloadDrivers=St\u00E1hnout a nainstalovat ovlada\u010De
windowBodyDownloadDrivers=Stahuji ovlada\u010De (libusbK v3.0.7.0)...
btn_Cancel=Zru\u0161it
btn_Close=Zav\u0159\u00EDt
tab2_Cb_GlVersion=GoldLeaf verze
tab2_Cb_GLshowNspOnly=Uk\u00E1zat v GoldLeafu pouze *.nsp.
windowBodyPleaseStopOtherProcessFirst=Pros\u00EDm, p\u0159ed pokra\u010Dov\u00E1n\u00EDm nejprve zru\u0161te aktivn\u00ED p\u0159enos.

View file

@ -0,0 +1,71 @@
btn_OpenFile=Select files
btn_Upload=Upload to NS
tab3_Txt_EnteredAsMsg1=You have been entered as:
tab3_Txt_EnteredAsMsg2=You should be root or have configured 'udev' rules for this user to avoid any issues.
tab3_Txt_FilesToUploadTitle=Files to upload:
tab3_Txt_GreetingsMessage=Welcome to NS-USBloader
tab3_Txt_NoFolderOrFileSelected=No files selected: nothing to upload.
windowBodyConfirmExit=Data transfer is in progress and closing this application will interrupt it.\nIt's the worse thing you can do now.\nInterrupt proccess and exit?
windowTitleConfirmExit=No, don't do this!
btn_Stop=Interrupt
tab3_Txt_GreetingsMessage2=--\n\
Source: https://github.com/developersu/ns-usbloader/\n\
Site: https://developersu.blogspot.com/search/label/NS-USBloader\n\
Dmitry Isaenko [developer.su]
tab1_table_Lbl_Status=Status
tab1_table_Lbl_FileName=File name
tab1_table_Lbl_Size=Size
tab1_table_Lbl_Upload=Upload?
tab1_table_contextMenu_Btn_BtnDelete=Remove
tab1_table_contextMenu_Btn_DeleteAll=Remove all
tab2_Lbl_HostIP=Host IP
tab1_Lbl_NSIP=NS IP:
tab2_Cb_ValidateNSHostName=Always validate NS IP input.
windowBodyBadIp=Are you sure that you entered NS IP address correctly?
windowTitleBadIp=IP address of NS most likely incorrect
tab2_Cb_ExpertMode=Expert mode (NET setup)
tab2_Lbl_HostPort=port
tab2_Cb_AutoDetectIp=Auto-detect IP
tab2_Cb_RandSelectPort=Randomly get port
tab2_Cb_DontServeRequests=Don't serve requests
tab2_Lbl_DontServeRequestsDesc=If selected, this computer won't reply to NSP files requests coming from NS (over the net) and use defined host settings to tell TinFoil where should it look for files.
tab2_Lbl_HostExtra=extra
windowTitleErrorPort=Port set incorrectly!
windowBodyErrorPort=Port can't be 0 or greater than 65535.
tab2_Cb_AutoCheckForUpdates=Auto check for updates
windowTitleNewVersionAval=New version available
windowTitleNewVersionNOTAval=No new versions available
windowTitleNewVersionUnknown=Unable to check for new versions
windowBodyNewVersionUnknown=Something went wrong\nMaybe internet unavailable, or GitHub is down
windowBodyNewVersionNOTAval=You're using the latest version
tab2_Cb_AllowXciNszXcz=Allow XCI / NSZ / XCZ files selection for Tinfoil
tab2_Lbl_AllowXciNszXczDesc=Used by applications that support XCI/NSZ/XCZ and utilizes Tinfoil transfer protocol. Don't change if not sure. Enable for Awoo Installer.
tab2_Lbl_Language=Language
windowBodyRestartToApplyLang=Please restart application to apply changes.
btn_OpenSplitFile=Select split NSP
tab2_Lbl_ApplicationSettings=Main settings
tabSplMrg_Lbl_SplitNMergeTitle=Split & merge files tool
tabSplMrg_RadioBtn_Split=Split
tabSplMrg_RadioBtn_Merge=Merge
tabSplMrg_Txt_File=File:
tabSplMrg_Txt_Folder=Split file (folder):
tabSplMrg_Btn_SelectFile=Select File
tabSplMrg_Btn_SelectFolder=Select Folder
tabSplMrg_Lbl_SaveToLocation=Save to:
tabSplMrg_Btn_ChangeSaveToLocation=Change
tabSplMrg_Btn_Convert=Convert
windowTitleError=Error
windowBodyPleaseFinishTransfersFirst=Unable to split/merge files when application USB/Network process active. Please interrupt active transfers first.
done_txt=Done!
failure_txt=Failed
btn_Select=Select
btn_InjectPayloader=Inject payload
tabNXDT_Btn_Start=Start!
tab2_Btn_InstallDrivers=Download and install drivers
windowTitleDownloadDrivers=Download and install drivers
windowBodyDownloadDrivers=Downloading drivers (libusbK v3.0.7.0)...
btn_Cancel=Cancel
btn_Close=Close
tab2_Cb_GlVersion=GoldLeaf version
tab2_Cb_GLshowNspOnly=Show only *.nsp in GoldLeaf.
windowBodyPleaseStopOtherProcessFirst=Please stop other active process before continuing.

View file

@ -0,0 +1,71 @@
btn_OpenFile=\u9078\u64C7\u6A94\u6848
btn_Upload=\u4E0A\u50B3\u81F3NS
tab3_Txt_EnteredAsMsg1=\u76EE\u524D\u767B\u5165\u7684\u4F7F\u7528\u8005:
tab3_Txt_EnteredAsMsg2=\u57F7\u884C\u6B64\u64CD\u4F5C\u6642\u4F60\u5FC5\u9808\u64C1\u6709\u6700\u9AD8\u5B58\u53D6\u6B0A\u9650,\u6216\u8005\u5DF2\u914D\u7F6E\u4E86'udev'\u898F\u5247,\u4EE5\u78BA\u4FDD\u4E0D\u6703\u51FA\u73FE\u4EFB\u4F55\u554F\u984C.
tab3_Txt_FilesToUploadTitle=\u4E0A\u50B3\u7684\u6A94\u6848:
tab3_Txt_GreetingsMessage=\u6B61\u8FCE\u4F7F\u7528NS-USBloader
tab3_Txt_NoFolderOrFileSelected=\u5C1A\u672A\u9078\u53D6\u6A94\u6848: \u4E0A\u50B3\u4F47\u5217\u6C92\u6709\u9805\u76EE
windowBodyConfirmExit=\u6B64\u6642\u9000\u51FA\u7A0B\u5F0F\u5C07\u6703\u4E2D\u65B7\u6B63\u5728\u50B3\u8F38\u7684\u8CC7\u6599.\n\u9019\u9805\u64CD\u4F5C\u53EF\u80FD\u6703\u9020\u6210\u4EE4\u4EBA\u5F8C\u6094\u7684\u640D\u5BB3.\n\u662F\u5426\u78BA\u8A8D\u8981\u4E2D\u65B7\u50B3\u8F38\u4E26\u4E14\u7D50\u675F\u7A0B\u5F0F?
windowTitleConfirmExit=\u4E0D,\u8ACB\u52FF\u9000\u51FA!
btn_Stop=\u4E2D\u65B7\u64CD\u4F5C
tab3_Txt_GreetingsMessage2=--\n\
Source: https://github.com/developersu/ns-usbloader/\n\
Site: https://developersu.blogspot.com/search/label/NS-USBloader\n\
Dmitry Isaenko [developer.su]
tab1_table_Lbl_Status=\u72C0\u614B
tab1_table_Lbl_FileName=\u6A94\u6848\u540D\u7A31
tab1_table_Lbl_Size=\u6A94\u6848\u5927\u5C0F
tab1_table_Lbl_Upload=\u4E0A\u50B3?
tab1_table_contextMenu_Btn_BtnDelete=\u79FB\u9664
tab1_table_contextMenu_Btn_DeleteAll=\u5168\u90E8\u79FB\u9664
tab2_Lbl_HostIP=\u96FB\u8166IP
tab1_Lbl_NSIP=NS IP:
tab2_Cb_ValidateNSHostName=\u6BCF\u6B21\u8F38\u5165\u5F8C\u90FD\u9A57\u8B49NS IP
windowBodyBadIp=\u4F60\u6240\u8F38\u5165\u7684NS IP\u4F4D\u5740\u662F\u5426\u6B63\u78BA?
windowTitleBadIp=NS IP\u4F4D\u5740\u4E0D\u6B63\u78BA
tab2_Cb_ExpertMode=\u5C08\u5BB6\u6A21\u5F0F (NET \u5B89\u88DD)
tab2_Lbl_HostPort=\u9023\u63A5\u57E0
tab2_Cb_AutoDetectIp=\u81EA\u52D5\u5075\u6E2CIP
tab2_Cb_RandSelectPort=\u96A8\u6A5F\u9078\u53D6\u9023\u63A5\u57E0
tab2_Cb_DontServeRequests=\u4E0D\u56DE\u61C9NS\u8ACB\u6C42
tab2_Lbl_DontServeRequestsDesc=\u555F\u7528\u6B64\u8A2D\u5B9A\u5F8C,\u6B64\u96FB\u8166\u5C07\u4E0D\u6703\u56DE\u61C9\u4F86\u81EANS(\u900F\u904E\u7DB2\u8DEF)\u7684NSP\u6A94\u6848\u8ACB\u6C42,\u4E26\u8B93TinFoil\u5C0B\u627E\u6A94\u6848\u4F86\u6E90\u6642\u4F7F\u7528\u9810\u8A2D\u7684\u4E3B\u6A5F\u8A2D\u5B9A.
tab2_Lbl_HostExtra=\u5176\u4ED6
windowTitleErrorPort=\u9023\u63A5\u57E0\u8A2D\u5B9A\u4E0D\u6B63\u78BA!
windowBodyErrorPort=\u9023\u63A5\u57E0\u8A2D\u5B9A\u503C\u5FC5\u9808\u4ECB\u65BC0\u523065535\u4E4B\u9593.
tab2_Cb_AutoCheckForUpdates=\u81EA\u52D5\u6AA2\u67E5\u66F4\u65B0
windowTitleNewVersionAval=\u6709\u53EF\u66F4\u65B0\u7684\u7248\u672C
windowTitleNewVersionNOTAval=\u76EE\u524D\u6C92\u6709\u53EF\u66F4\u65B0\u7684\u7248\u672C
windowTitleNewVersionUnknown=\u76EE\u524D\u7121\u6CD5\u6AA2\u67E5\u6709\u7121\u53EF\u66F4\u65B0\u7248\u672C
windowBodyNewVersionUnknown=\u767C\u751F\u932F\u8AA4\n\u53EF\u80FD\u7DB2\u8DEF\u4E0D\u53EF\u7528\u6216\u8A0A\u865F\u4E0D\u8DB3,\u6216\u8005\u7121\u6CD5\u9023\u4E0AGitHub\u5B98\u7DB2\u4F3A\u670D\u5668
windowBodyNewVersionNOTAval=\u76EE\u524D\u4F7F\u7528\u7684\u7A0B\u5F0F\u5DF2\u662F\u6700\u65B0\u7248\u672C
tab2_Cb_AllowXciNszXcz=\u5141\u8A31Tinfoil\u6A21\u5F0F\u6642\u9078\u53D6XCI / NSZ / XCZ \u6A94\u6848\u683C\u5F0F
tab2_Lbl_AllowXciNszXczDesc=\u6B64\u8A2D\u5B9A\u5C08\u70BA\u652F\u63F4XCI/NSZ/XCZ\u6A94\u6848\u683C\u5F0F\u8207Tinfoil\u50B3\u8F38\u5354\u8B70\u7684\u7B2C\u4E09\u65B9\u7A0B\u5F0F\u4F7F\u7528. \u5982\u4E0D\u78BA\u5B9A,\u8ACB\u52FF\u8B8A\u66F4\u6B64\u9805\u8A2D\u5B9A. \u4F7F\u7528Awoo Installer\u8ACB\u555F\u7528\u6B64\u8A2D\u5B9A.
tab2_Lbl_Language=\u4ECB\u9762\u8A9E\u7CFB
windowBodyRestartToApplyLang=\u8ACB\u91CD\u65B0\u555F\u52D5\u7A0B\u5F0F\u4EE5\u5957\u7528\u8B8A\u66F4\u7684\u8A2D\u5B9A.
btn_OpenSplitFile=\u9078\u64C7\u5206\u5272\u7684NSP
tab2_Lbl_ApplicationSettings=\u4E3B\u8981\u8A2D\u5B9A
tabSplMrg_Lbl_SplitNMergeTitle=\u5206\u5272&\u5408\u4F75\u6A94\u6848\u5DE5\u5177
tabSplMrg_RadioBtn_Split=\u5206\u5272&\u5408\u4F75\u6A94\u6848\u5DE5\u5177
tabSplMrg_RadioBtn_Merge=\u5408\u4F75
tabSplMrg_Txt_File=\u6A94\u6848:
tabSplMrg_Txt_Folder=\u5206\u5272\u6A94\u6848(\u8CC7\u6599\u593E):
tabSplMrg_Btn_SelectFile=\u9078\u64C7\u6A94\u6848
tabSplMrg_Btn_SelectFolder=\u9078\u64C7\u8CC7\u6599\u593E
tabSplMrg_Lbl_SaveToLocation=\u5132\u5B58\u8DEF\u5F91:
tabSplMrg_Btn_ChangeSaveToLocation=\u8B8A\u66F4
tabSplMrg_Btn_Convert=\u8F49\u6A94
windowTitleError=\u932F\u8AA4
windowBodyPleaseFinishTransfersFirst=\u7576\u7A0B\u5F0F\u6B63\u5728\u8655\u7406USB/Network\u5B89\u88DD\u6642\u7121\u6CD5\u540C\u6642\u57F7\u884C\u5206\u5272/\u5408\u4F75\u6A94\u6848. \u5982\u9700\u7E7C\u7E8C,\u5FC5\u9808\u4E2D\u65B7\u76EE\u524D\u7684\u50B3\u8F38.
done_txt=\u5B8C\u6210!
failure_txt=\u5931\u6557
btn_Select=\u9078\u64C7
btn_InjectPayloader=\u6CE8\u5165payload
tabNXDT_Btn_Start=\u958B\u59CB!
tab2_Btn_InstallDrivers=\u4E0B\u8F09\u4E26\u5B89\u88DD\u9A45\u52D5\u7A0B\u5F0F
windowTitleDownloadDrivers=\u4E0B\u8F09\u4E26\u5B89\u88DD\u9A45\u52D5\u7A0B\u5F0F
windowBodyDownloadDrivers=\u6B63\u5728\u4E0B\u8F09\u9A45\u52D5\u7A0B\u5F0F (libusbK v3.0.7.0)...
btn_Cancel=\u53D6\u6D88
btn_Close=\u95DC\u9589
tab2_Cb_GlVersion=GoldLeaf\u7248\u672C
tab2_Cb_GLshowNspOnly=\u5728GoldLeaf\u5167\u50C5\u986F\u793A*.nsp\u6A94\u6848
windowBodyPleaseStopOtherProcessFirst=\u5982\u8981\u57F7\u884C\u76EE\u524D\u7684\u64CD\u4F5C\u7A0B\u5E8F,\u8ACB\u5148\u505C\u6B62\u5176\u4ED6\u6B63\u5728\u8655\u7406\u7684\u7A0B\u5E8F.