Language could be selected by user manually.
Minor changes to CSS.
This commit is contained in:
Dmitry Isaenko 2019-06-14 05:06:26 +03:00
parent 082395bf80
commit 525262ebfe
12 changed files with 142 additions and 80 deletions

View file

@ -1,5 +1,6 @@
package nsusbloader;
import java.util.Locale;
import java.util.prefs.Preferences;
public class AppPreferences {
@ -105,4 +106,7 @@ public class AppPreferences {
public boolean getTfXCI(){return preferences.getBoolean("TF_XCI", false);}
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);}
}

View file

@ -1,6 +1,8 @@
package nsusbloader.Controllers;
import javafx.application.HostServices;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.concurrent.Task;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
@ -11,9 +13,10 @@ import nsusbloader.AppPreferences;
import nsusbloader.ServiceWindow;
import nsusbloader.ModelControllers.UpdatesChecker;
import javax.security.auth.callback.Callback;
import java.io.File;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;
import java.util.*;
public class SettingsController implements Initializable {
@ -48,6 +51,11 @@ public class SettingsController implements Initializable {
@FXML
private CheckBox tfXciSpprtCb;
@FXML
private Button langBtn;
@FXML
private ChoiceBox<String> langCB;
private HostServices hs;
@Override
@ -179,6 +187,31 @@ public class SettingsController implements Initializable {
updates.start();
});
tfXciSpprtCb.setSelected(AppPreferences.getInstance().getTfXCI());
// Language settings area
URL resourceURL = this.getClass().getResource("/");
String[] filesList = new File(resourceURL.getFile()).list(); // Screw it. This WON'T produce NullPointerException
ObservableList<String> langCBObsList = FXCollections.observableArrayList();
langCBObsList.add("eng");
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"));
});
}
public boolean getExpertModeSelected(){ return expertModeCb.isSelected(); }

View file

@ -18,7 +18,7 @@ public class NSLMain extends Application {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/NSLMain.fxml"));
Locale userLocale = new Locale(Locale.getDefault().getISO3Language()); // NOTE: user locale based on ISO3 Language codes
Locale userLocale = new Locale(AppPreferences.getInstance().getLanguage()); // NOTE: user locale based on ISO3 Language codes
ResourceBundle rb = ResourceBundle.getBundle("locale", userLocale);
loader.setResources(rb);

View file

@ -3,8 +3,10 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
@ -12,84 +14,96 @@
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<AnchorPane xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="nsusbloader.Controllers.SettingsController">
<children>
<VBox spacing="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<ScrollPane fitToWidth="true" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="nsusbloader.Controllers.SettingsController">
<content>
<AnchorPane>
<children>
<CheckBox fx:id="validateNSHostNameCb" mnemonicParsing="false" text="%netTabValidateNSHostNameCb">
<VBox.margin>
<Insets />
</VBox.margin>
</CheckBox>
<CheckBox fx:id="expertModeCb" mnemonicParsing="false" text="%netTabExpertModeCb" />
<VBox fx:id="expertSettingsVBox" spacing="5.0">
<VBox spacing="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<CheckBox fx:id="autoDetectIpCb" mnemonicParsing="false" text="%netTabAutoDetectIpCb">
<CheckBox fx:id="validateNSHostNameCb" mnemonicParsing="false" text="%netTabValidateNSHostNameCb">
<VBox.margin>
<Insets />
</VBox.margin>
</CheckBox>
<CheckBox fx:id="randPortCb" mnemonicParsing="false" text="%netTabRandSelectPortCb">
<VBox.margin>
<Insets />
</VBox.margin>
</CheckBox>
<HBox>
<CheckBox fx:id="expertModeCb" mnemonicParsing="false" text="%netTabExpertModeCb" />
<VBox fx:id="expertSettingsVBox" spacing="5.0">
<children>
<Label text="%netTabHostIPLbl" />
<Label text=":" />
<Label text="%netTabHostPortLbl" />
<Label text="/" />
<Label text="%netTabHostExtraLbl" />
</children>
</HBox>
<HBox>
<children>
<TextField fx:id="pcIpTextField" promptText="XXX.XXX.XXX.XXX" />
<Label text=":" />
<TextField fx:id="pcPortTextField" promptText="0-65535" />
<Label text="/" />
<TextField fx:id="pcExtraTextField" HBox.hgrow="ALWAYS">
<HBox.margin>
<CheckBox fx:id="autoDetectIpCb" mnemonicParsing="false" text="%netTabAutoDetectIpCb">
<VBox.margin>
<Insets />
</HBox.margin>
</TextField>
</VBox.margin>
</CheckBox>
<CheckBox fx:id="randPortCb" mnemonicParsing="false" text="%netTabRandSelectPortCb">
<VBox.margin>
<Insets />
</VBox.margin>
</CheckBox>
<HBox>
<children>
<Label text="%netTabHostIPLbl" />
<Label text=":" />
<Label text="%netTabHostPortLbl" />
<Label text="/" />
<Label text="%netTabHostExtraLbl" />
</children>
</HBox>
<HBox>
<children>
<TextField fx:id="pcIpTextField" promptText="XXX.XXX.XXX.XXX" />
<Label text=":" />
<TextField fx:id="pcPortTextField" promptText="0-65535" />
<Label text="/" />
<TextField fx:id="pcExtraTextField" HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets />
</HBox.margin>
</TextField>
</children>
</HBox>
<Separator prefWidth="200.0" />
<CheckBox fx:id="dontServeCb" mnemonicParsing="false" text="%netTabDontServeRequestsCb">
<VBox.margin>
<Insets />
</VBox.margin>
</CheckBox>
<Label disable="true" text="%netTabDontServeRequestsDescription" wrapText="true">
<VBox.margin>
<Insets />
</VBox.margin>
</Label>
</children>
<padding>
<Insets left="10.0" />
</padding>
</VBox>
<HBox>
<children>
<VBox>
<children>
<CheckBox fx:id="autoCheckUpdCb" mnemonicParsing="false" text="%netTabAutoCheckForUpdates" />
<Hyperlink fx:id="newVersionLink" />
</children>
</VBox>
<Pane HBox.hgrow="ALWAYS" />
<Button fx:id="checkForUpdBtn" mnemonicParsing="false" />
</children>
</HBox>
<Separator prefWidth="200.0" />
<CheckBox fx:id="dontServeCb" mnemonicParsing="false" text="%netTabDontServeRequestsCb">
<VBox.margin>
<Insets />
</VBox.margin>
</CheckBox>
<Label disable="true" text="%netTabDontServeRequestsDescription" wrapText="true">
<VBox.margin>
<Insets />
</VBox.margin>
</Label>
<HBox alignment="CENTER_LEFT" spacing="5.0">
<children>
<Label text="%netTabLanguage" />
<ChoiceBox fx:id="langCB" prefWidth="150.0" />
<Button fx:id="langBtn" mnemonicParsing="false" text="OK" />
</children>
</HBox>
<CheckBox fx:id="tfXciSpprtCb" mnemonicParsing="false" text="%netTabAllowXciCb" />
<Label disable="true" text="%netTabAllowXciTextField" wrapText="true" />
</children>
<padding>
<Insets left="10.0" />
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox>
<HBox>
<children>
<VBox>
<children>
<CheckBox fx:id="autoCheckUpdCb" mnemonicParsing="false" text="%netTabAutoCheckForUpdates" />
<Hyperlink fx:id="newVersionLink" />
</children>
</VBox>
<Pane HBox.hgrow="ALWAYS" />
<Button fx:id="checkForUpdBtn" mnemonicParsing="false" />
</children>
</HBox>
<CheckBox fx:id="tfXciSpprtCb" mnemonicParsing="false" text="%netTabAllowXciCb" />
<Label disable="true" text="%netTabAllowXciTextField" wrapText="true" />
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox>
</children>
</AnchorPane>
</AnchorPane>
</content>
</ScrollPane>

View file

@ -43,3 +43,5 @@ windowBodyNewVersionUnknown=Something went wrong\nMaybe internet unavailable, or
windowBodyNewVersionNOTAval=You're using the latest version
netTabAllowXciCb=Allow XCI files selection for TinFoil
netTabAllowXciTextField=Used by some third-party applications that support XCI and utilizes TinFoil transfer protocol. Don't change if not sure.
netTabLanguage=Language
windowBodyRestartToApplyLang=Please restart application to apply changes.

View file

@ -42,4 +42,5 @@ windowBodyNewVersionNOTAval=Vous utilisez la derni\u00E8re version
windowBodyNewVersionUnknown=Une erreur s'est produite\nPeut-\u00EAtre des probl\u00E8mes de connexion Internet ou GitHub est en panne
netTabAllowXciCb=Autoriser la s\u00E9lection de fichiers XCI pour TinFoil
netTabAllowXciTextField=Utilis\u00E9 par certaines applications tierces prenant en charge XCI et utilisant le protocole de transfert TinFoil. Ne changez pas en cas de doute.
netTabLanguage=La langue

View file

@ -5,7 +5,7 @@ logsEnteredAsMsg2=Devi essere root o avere configurato le regole 'udev' per ques
logsFilesToUploadTitle=File da inviare:
logsGreetingsMessage=Benvenuti in NS-USBloader
logsNoFolderFileSelected=Nessun file selezionato: niente da inviare.
windowBodyConfirmExit=Il trasferimento dei dati è in corso e la chiusura dell'applicazione lo interromperà.\nÈ la cosa peggiore che tu possa fare ora.\nInterrompere il processo ed uscire?
windowBodyConfirmExit=Il trasferimento dei dati \u00E8 in corso e la chiusura dell'applicazione lo interromper\u00E0.\n\u00C8 la cosa peggiore che tu possa fare ora.\nInterrompere il processo ed uscire?
windowTitleConfirmExit=No, non farlo!
btnStop=Interrompi
logsGreetingsMessage2=--\n\
@ -13,8 +13,8 @@ Sorgenti: https://github.com/developersu/ns-usbloader/\n\
Sito: https://developersu.blogspot.com/search/label/NS-USBloader\n\
Dmitry Isaenko [developer.su]
windowTitleConfirmWrongPFS0=Tipo di file non valido
windowBodyConfirmWrongPFS0=Il file NSP selezionato ha dei simboli iniziali non validi. Probabilmente è danneggiato.\n\
È meglio interrompere subito il processo. Continuare comunque il processo?
windowBodyConfirmWrongPFS0=Il file NSP selezionato ha dei simboli iniziali non validi. Probabilmente \u00E8 danneggiato.\n\
\u00C8 meglio interrompere subito il processo. Continuare comunque il processo?
tableStatusLbl=Stato
tableFileNameLbl=Nome file
tableSizeLbl=Dimensione
@ -26,18 +26,19 @@ NSIPlable=IP NS:
netTabValidateNSHostNameCb=Convalida sempre l'input dell'IP di NS.
windowBodyBadIp=Sei sicuro di aver inserito correttamente l'indirizzo IP di NS?
windowTitleBadIp=Indirizzo IP di NS probabilmente sbagliato
netTabExpertModeCb=Modalità esperto
netTabExpertModeCb=Modalit\u00E0 esperto
netTabHostPortLbl=porta
netTabAutoDetectIpCb=Auto-rileva IP
netTabRandSelectPortCb=Ottieni porta casualmente
netTabDontServeRequestsCb=Non servire le richieste
netTabDontServeRequestsDescription=Se selezionato, questo computer non risponderà alle richieste di file NSP in arrivo da NS (tramite rete) e userà le impostazioni dell'host definite per dire a TinFoil dove cercare i file.
netTabDontServeRequestsDescription=Se selezionato, questo computer non risponder\u00E0 alle richieste di file NSP in arrivo da NS (tramite rete) e user\u00E0 le impostazioni dell'host definite per dire a TinFoil dove cercare i file.
netTabHostExtraLbl=extra
windowTitleErrorPort=Porta impostata impropriamente!
windowBodyErrorPort=La porta non può essere 0 o maggiore di 65535.
windowBodyErrorPort=La porta non pu\u00F2 essere 0 o maggiore di 65535.
netTabAutoCheckForUpdates=Controllo automatico degli aggiornamenti
windowTitleNewVersionAval=Nuova versione disponibile
windowTitleNewVersionNOTAval=Nessuna nuova versione disponibile
windowTitleNewVersionUnknown=Impossibile cercare nuove versioni
windowBodyNewVersionUnknown=Qualcosa è andato storto\nForse internet non è disponibile o GitHub ha problemi
windowBodyNewVersionNOTAval=Stai usando la versione più recente
windowBodyNewVersionUnknown=Qualcosa \u00E8 andato storto\nForse internet non \u00E8 disponibile o GitHub ha problemi
windowBodyNewVersionNOTAval=Stai usando la versione pi\u00F9 recente
netTabLanguage=Linguaggio

View file

@ -43,3 +43,4 @@ windowBodyNewVersionUnknown=\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB
windowBodyNewVersionNOTAval=\uCD5C\uC2E0 \uBC84\uC804\uC744 \uC0AC\uC6A9 \uC911\uC785\uB2C8\uB2E4.
netTabAllowXciCb=TinFoil\uC5D0 \uB300\uD55C XCI \uD30C\uC77C \uC120\uD0DD \uD5C8\uC6A9
netTabAllowXciTextField=XCI\uB97C \uC9C0\uC6D0\uD558\uACE0 TinFoil \uC804\uC1A1 \uD504\uB85C\uD1A0\uCF5C\uC744 \uC0AC\uC6A9\uD558\uB294 \uC77C\uBD80 \uD0C0\uC0AC \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC5D0\uC11C \uC0AC\uC6A9\uB429\uB2C8\uB2E4. \uD655\uC2E4\uD558\uC9C0 \uC54A\uC73C\uBA74 \uBCC0\uACBD\uD558\uC9C0 \uB9C8\uC2ED\uC2DC\uC624.
netTabLanguage=\uC5B8\uC5B4

View file

@ -43,3 +43,4 @@ windowBodyNewVersionUnknown=Algo deu errado\nTalvez sem internet, ou github indi
windowBodyNewVersionNOTAval=Voc\u00EA est\u00E1 usando a \u00FAltima vers\u00E3o
netTabAllowXciCb=Permitir sele\u00E7\u00E3o de arquivos XCI para o TinFoil
netTabAllowXciTextField=Usados por algumas aplica\u00E7\u00F5es de terceiros que suportam XCI e utilizam o protocolo de transfer\u00EAncia TinFoil. Nao mude se nao tem certeza.
netTabLanguage=L\u00EDngua

View file

@ -44,4 +44,6 @@ windowBodyNewVersionNOTAval=\u0412\u044B \u0443\u0436\u0435 \u0438\u0441\u043F\u
windowBodyNewVersionUnknown=\u0427\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A.\n\u041C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043D\u0435\u0442 \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442\u0430 \u0438\u043B\u0438 GitHub \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D.
netTabAllowXciCb=\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u0432\u044B\u0431\u0438\u0440\u0430\u0442\u044C XCI \u0444\u0430\u0439\u043B\u044B \u0434\u043B\u044F TinFoil
netTabAllowXciTextField=\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0441\u044F \u043D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u043C\u0438 \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u043C\u0438 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F\u043C\u0438, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044E\u0442 XCI \u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0442 \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 TinFoil. \u041D\u0435 \u043C\u0435\u043D\u044F\u0439\u0442\u0435 \u0435\u0441\u043B\u0438 \u043D\u0435 \u0443\u0432\u0435\u0440\u0435\u043D\u044B.
netTabLanguage=\u042F\u0437\u044B\u043A
windowBodyRestartToApplyLang=\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0447\u0442\u043E\u0431\u044B \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0432\u0441\u0442\u0443\u043F\u0438\u043B\u0438 \u0432 \u0441\u0438\u043B\u0443.

View file

@ -43,3 +43,5 @@ windowBodyNewVersionNOTAval=\u0412\u0438 \u0432\u0436\u0435 \u0432\u0438\u043A\u
windowBodyNewVersionUnknown=\u0429\u043E\u0441\u044C \u043F\u0456\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A.\n\u041C\u043E\u0436\u043B\u0438\u0432\u043E, \u0456\u043D\u0442\u0435\u0440\u043D\u0435\u0442 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0438\u0439, \u0430\u0431\u043E GitHub \u043D\u0435 \u043F\u0440\u0430\u0446\u044E\u0454.
netTabAllowXciCb=\u0414\u043E\u0437\u0432\u043E\u043B\u0438\u0442\u0438 \u0432\u0438\u0431\u0456\u0440 XCI \u0444\u0430\u0439\u043B\u0456\u0432 \u0434\u043B\u044F \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u043D\u043D\u044F \u0443 TinFoil
netTabAllowXciTextField=\u0412\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0454\u0442\u044C\u0441\u044F \u0434\u0435\u044F\u043A\u0438\u043C\u0438 \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0456\u043C\u0438 \u0434\u043E\u0434\u0430\u0442\u043A\u0430\u043C\u0438, \u044F\u043A\u0456 \u043F\u0456\u0434\u0442\u0440\u0438\u043C\u0443\u044E\u0442\u044C XCI \u0456 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u044E\u0442\u044C \u043F\u0440\u043E\u0442\u043E\u043A\u043E\u043B \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0456 TinFoil. \u042F\u043A\u0449\u043E \u043D\u0435 \u0432\u043F\u0435\u0432\u043D\u0435\u043D\u0456 \u2014\u00A0\u043D\u0435 \u0437\u043C\u0456\u043D\u044E\u0439\u0442\u0435.
netTabLanguage=\u041C\u043E\u0432\u0430
windowBodyRestartToApplyLang=\u0411\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430, \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0456\u0442\u044C \u0434\u043E\u0434\u0430\u0442\u043E\u043A \u0449\u043E\u0431 \u0437\u043C\u0456\u043D\u0438 \u0432\u0441\u0442\u0443\u043F\u0438\u043B\u0438 \u0432 \u0441\u0438\u043B\u0443.

View file

@ -126,6 +126,7 @@
-fx-border-radius: 3;
-fx-border-width: 2;
-fx-text-fill: #2c2c2c;
-fx-effect: dropshadow(three-pass-box, #eea11e, 2, 0, 0, 0);
}
// Background color of the whole context menu