language work part 1
* added support for different languages * added english locals
This commit is contained in:
parent
fc0be39455
commit
ce52628554
|
@ -42,7 +42,9 @@ import java.sql.SQLException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.ProgressMonitor;
|
import javax.swing.ProgressMonitor;
|
||||||
|
@ -304,7 +306,7 @@ public class MainWindowController {
|
||||||
private File pictureCacheWin = new File(dirWin + "/picture_cache");
|
private File pictureCacheWin = new File(dirWin + "/picture_cache");
|
||||||
private File pictureCacheLinux = new File(dirLinux + "/picture_cache");
|
private File pictureCacheLinux = new File(dirLinux + "/picture_cache");
|
||||||
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta");
|
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta");
|
||||||
private ObservableList<String> languages = FXCollections.observableArrayList("english", "deutsch");
|
private ObservableList<String> languages = FXCollections.observableArrayList("English (en_US)", "Deutsch (de_DE)");
|
||||||
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs
|
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); // TODO add more IDs
|
||||||
private ObservableList<UIROMDataType> games = FXCollections.observableArrayList();
|
private ObservableList<UIROMDataType> games = FXCollections.observableArrayList();
|
||||||
ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList();
|
ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList();
|
||||||
|
@ -334,6 +336,37 @@ public class MainWindowController {
|
||||||
private ImageView smmdb_white = new ImageView(new Image("icons/ic_get_app_white_24dp_1x.png"));
|
private ImageView smmdb_white = new ImageView(new Image("icons/ic_get_app_white_24dp_1x.png"));
|
||||||
private Image close_black = new Image("icons/close_black_2048x2048.png");
|
private Image close_black = new Image("icons/close_black_2048x2048.png");
|
||||||
|
|
||||||
|
// language support
|
||||||
|
private ResourceBundle bundle;
|
||||||
|
private String language;
|
||||||
|
private String editHeadingText;
|
||||||
|
private String editBodyText;
|
||||||
|
private String removeHeadingText;
|
||||||
|
private String removeBodyText;
|
||||||
|
private String addUpdateHeadingText;
|
||||||
|
private String addUpdateBodyText;
|
||||||
|
private String addDLCHeadingText;
|
||||||
|
private String addDLCBodyText;
|
||||||
|
private String licensesLblHeadingText;
|
||||||
|
private String licensesLblBodyText;
|
||||||
|
private String aboutBtnHeadingText;
|
||||||
|
private String aboutBtnBodyText;
|
||||||
|
private String cloudSyncWaringHeadingText;
|
||||||
|
private String cloudSyncWaringBodyText;
|
||||||
|
private String cloudSyncErrorHeadingText;
|
||||||
|
private String cloudSyncErrorBodyText;
|
||||||
|
private String addBtnReturnErrorHeadingText;
|
||||||
|
private String addBtnReturnErrorBodyText;
|
||||||
|
|
||||||
|
private String playBtnPlay;
|
||||||
|
private String playBtnUpdating;
|
||||||
|
private String playBtnCopyingFiles;
|
||||||
|
private String okayBtnText;
|
||||||
|
private String cancelBtnText;
|
||||||
|
private String updateBtnCheckNow;
|
||||||
|
private String updateBtnNoUpdateAvailable;
|
||||||
|
private String updateBtnUpdateAvailable;
|
||||||
|
|
||||||
public void setMain(Main m) {
|
public void setMain(Main m) {
|
||||||
this.main = m;
|
this.main = m;
|
||||||
dbController = new DBController(this);
|
dbController = new DBController(this);
|
||||||
|
@ -399,6 +432,8 @@ public class MainWindowController {
|
||||||
courseTreeTable.getColumns().add(idColumn);
|
courseTreeTable.getColumns().add(idColumn);
|
||||||
courseTreeTable.getColumns().get(3).setVisible(false); // the idColumn should not bee displayed
|
courseTreeTable.getColumns().get(3).setVisible(false); // the idColumn should not bee displayed
|
||||||
|
|
||||||
|
setUILanguage();
|
||||||
|
|
||||||
LOGGER.info("initializing UI done");
|
LOGGER.info("initializing UI done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +480,7 @@ public class MainWindowController {
|
||||||
String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
|
String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
|
||||||
|
|
||||||
// new edit dialog
|
// new edit dialog
|
||||||
String headingText = "edit a game";
|
String headingText = "edit \"" + selectedGameTitle + "\"";
|
||||||
String bodyText = "You can edit the tile and rom/cover path.";
|
String bodyText = "You can edit the tile and rom/cover path.";
|
||||||
JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450,
|
JFXEditGameDialog editGameDialog = new JFXEditGameDialog(headingText, bodyText, dialogBtnStyle, 450,
|
||||||
300, 1, MWC, main.getPrimaryStage(), main.getPane());
|
300, 1, MWC, main.getPrimaryStage(), main.getPane());
|
||||||
|
@ -706,6 +741,17 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
languageChoisBox.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||||
|
@Override
|
||||||
|
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
|
||||||
|
String language = languageChoisBox.getItems().get((int) new_value).toString();
|
||||||
|
language = language.substring(language.length()-6,language.length()-1); //reading only en_US from English (en_US)
|
||||||
|
setLanguage(language);
|
||||||
|
setUILanguage();
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
branchChoisBox.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
branchChoisBox.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1304,6 +1350,82 @@ public class MainWindowController {
|
||||||
gamesAnchorPane.getChildren().add(games.get(i).getVBox());
|
gamesAnchorPane.getChildren().add(games.get(i).getVBox());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO add strings for dialogs
|
||||||
|
void setUILanguage(){
|
||||||
|
switch(getLanguage()){
|
||||||
|
case "en_US":
|
||||||
|
bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US); //us_English
|
||||||
|
languageChoisBox.getSelectionModel().select(0);
|
||||||
|
break;
|
||||||
|
case "de_DE":
|
||||||
|
bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.GERMAN); //German
|
||||||
|
languageChoisBox.getSelectionModel().select(1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bundle = ResourceBundle.getBundle("locals.cemu_UI-Local", Locale.US); //default local
|
||||||
|
languageChoisBox.getSelectionModel().select(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
aboutBtn.setText(bundle.getString("aboutBtn"));
|
||||||
|
settingsBtn.setText(bundle.getString("settingsBtn"));
|
||||||
|
addBtn.setText(bundle.getString("addBtn"));
|
||||||
|
reloadRomsBtn.setText(bundle.getString("reloadRomsBtn"));
|
||||||
|
smmdbBtn.setText(bundle.getString("smmdbBtn"));
|
||||||
|
cemuTFBtn.setText(bundle.getString("cemuTFBtn"));
|
||||||
|
romTFBtn.setText(bundle.getString("romTFBtn"));
|
||||||
|
updateBtn.setText(bundle.getString("updateBtnCheckNow"));
|
||||||
|
smmdbDownloadBtn.setText(bundle.getString("smmdbDownloadBtn"));
|
||||||
|
playBtn.setText(bundle.getString("playBtn"));
|
||||||
|
|
||||||
|
// Labels
|
||||||
|
cemu_UISettingsLbl.setText(bundle.getString("cemu_UISettingsLbl"));
|
||||||
|
cemuDirectoryLbl.setText(bundle.getString("cemuDirectoryLbl"));
|
||||||
|
romDirectoryLbl.setText(bundle.getString("romDirectoryLbl"));
|
||||||
|
mainColorLbl.setText(bundle.getString("mainColorLbl"));
|
||||||
|
languageLbl.setText(bundle.getString("languageLbl"));
|
||||||
|
updateLbl.setText(bundle.getString("updateLbl"));
|
||||||
|
branchLbl.setText(bundle.getString("branchLbl"));
|
||||||
|
cemuSettingsLbl.setText(bundle.getString("cemuSettingsLbl"));
|
||||||
|
licensesLbl.setText(bundle.getString("licensesLbl"));
|
||||||
|
|
||||||
|
// Columns
|
||||||
|
titleColumn.setText(bundle.getString("titleColumn"));
|
||||||
|
idColumn.setText(bundle.getString("idColumn"));
|
||||||
|
starsColumn.setText(bundle.getString("starsColumn"));
|
||||||
|
timeColumn.setText(bundle.getString("timeColumn"));
|
||||||
|
|
||||||
|
// Strings
|
||||||
|
editHeadingText = bundle.getString("editHeadingText");
|
||||||
|
editBodyText = bundle.getString("editBodyText");
|
||||||
|
removeHeadingText = bundle.getString("removeHeadingText");
|
||||||
|
removeBodyText = bundle.getString("removeBodyText");
|
||||||
|
addUpdateHeadingText = bundle.getString("addUpdateHeadingText");
|
||||||
|
addUpdateBodyText = bundle.getString("addUpdateBodyText");
|
||||||
|
addDLCHeadingText = bundle.getString("addDLCHeadingText");
|
||||||
|
addDLCBodyText = bundle.getString("addDLCBodyText");
|
||||||
|
licensesLblHeadingText = bundle.getString("licensesLblHeadingText");
|
||||||
|
licensesLblBodyText = bundle.getString("licensesLblBodyText");
|
||||||
|
aboutBtnHeadingText = bundle.getString("aboutBtnHeadingText");
|
||||||
|
aboutBtnBodyText = bundle.getString("aboutBtnBodyText");
|
||||||
|
cloudSyncWaringHeadingText = bundle.getString("cloudSyncWaringHeadingText");
|
||||||
|
cloudSyncWaringBodyText = bundle.getString("cloudSyncWaringBodyText");
|
||||||
|
cloudSyncErrorHeadingText = bundle.getString("cloudSyncErrorHeadingText");
|
||||||
|
cloudSyncErrorBodyText = bundle.getString("cloudSyncErrorBodyText");
|
||||||
|
addBtnReturnErrorHeadingText = bundle.getString("addBtnReturnErrorHeadingText");
|
||||||
|
addBtnReturnErrorBodyText = bundle.getString("addBtnReturnErrorBodyText");
|
||||||
|
|
||||||
|
playBtnPlay = bundle.getString("playBtnPlay");
|
||||||
|
playBtnUpdating = bundle.getString("playBtnUpdating");
|
||||||
|
playBtnCopyingFiles = bundle.getString("playBtnCopyingFiles");
|
||||||
|
okayBtnText = bundle.getString("okayBtnText");
|
||||||
|
cancelBtnText = bundle.getString("cancelBtnText");
|
||||||
|
updateBtnCheckNow = bundle.getString("updateBtnCheckNow");
|
||||||
|
updateBtnNoUpdateAvailable = bundle.getString("updateBtnNoUpdateAvailable");
|
||||||
|
updateBtnUpdateAvailable = bundle.getString("updateBtnUpdateAvailable");
|
||||||
|
}
|
||||||
|
|
||||||
private void checkAutoUpdate() {
|
private void checkAutoUpdate() {
|
||||||
|
|
||||||
|
@ -1544,6 +1666,7 @@ public class MainWindowController {
|
||||||
props.setProperty("cemuPath", getCemuPath());
|
props.setProperty("cemuPath", getCemuPath());
|
||||||
props.setProperty("romPath", getRomPath());
|
props.setProperty("romPath", getRomPath());
|
||||||
props.setProperty("color", getColor());
|
props.setProperty("color", getColor());
|
||||||
|
props.setProperty("language", getLanguage());
|
||||||
props.setProperty("fullscreen", String.valueOf(isFullscreen()));
|
props.setProperty("fullscreen", String.valueOf(isFullscreen()));
|
||||||
props.setProperty("cloudSync", String.valueOf(isCloudSync()));
|
props.setProperty("cloudSync", String.valueOf(isCloudSync()));
|
||||||
props.setProperty("autoUpdate", String.valueOf(isAutoUpdate()));
|
props.setProperty("autoUpdate", String.valueOf(isAutoUpdate()));
|
||||||
|
@ -1605,6 +1728,13 @@ public class MainWindowController {
|
||||||
LOGGER.error("could not load color value, setting default instead", e);
|
LOGGER.error("could not load color value, setting default instead", e);
|
||||||
setColor("00a8cc");
|
setColor("00a8cc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
setLanguage(props.getProperty("language"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("cloud not load language", e);
|
||||||
|
setLanguage(System.getProperty("user.language")+"_"+System.getProperty("user.country"));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setFullscreen(Boolean.parseBoolean(props.getProperty("fullscreen")));
|
setFullscreen(Boolean.parseBoolean(props.getProperty("fullscreen")));
|
||||||
|
@ -1910,6 +2040,14 @@ public class MainWindowController {
|
||||||
this.oldXPosHelper = oldXPosHelper;
|
this.oldXPosHelper = oldXPosHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
public AnchorPane getMainAnchorPane() {
|
public AnchorPane getMainAnchorPane() {
|
||||||
return mainAnchorPane;
|
return mainAnchorPane;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
#HomeFlix-Local_de_DE.properties German Local
|
||||||
|
|
||||||
|
#main window translations
|
||||||
|
info = Info
|
||||||
|
settings = Einstellungen
|
||||||
|
streamingSettings = Stream Einst.
|
||||||
|
tfSearch = Suche...
|
||||||
|
openFolder = Ordner \u00F6ffnen
|
||||||
|
|
||||||
|
#settings translations
|
||||||
|
settingsHead1Label = HomeFlix Einstellungen
|
||||||
|
tfPath = Pfad...
|
||||||
|
chooseFolder = Ordner ausw\u00E4hlen
|
||||||
|
mainColorLabel = Hauptfarbe:
|
||||||
|
fontsizeLabel = Schriftgr\u00F6\u00DFe:
|
||||||
|
localLabel = Sprache:
|
||||||
|
checkUpdates = Auf Update pr\u00FCfen
|
||||||
|
checkingUpdates = Es wird nach Updates gesucht...
|
||||||
|
updateBtnavail = Update verf\u00FCgbar
|
||||||
|
updateBtnNotavail = Kein Update verf\u00FCgbar
|
||||||
|
autoUpdateLabel = beim Start nach Updates suchen:
|
||||||
|
version = Version:
|
||||||
|
|
||||||
|
#column translations
|
||||||
|
columnName = Name
|
||||||
|
columnRating = Bewertung
|
||||||
|
columnStreamUrl = Datei Name
|
||||||
|
columnResolution = Aufl\u00F6sung
|
||||||
|
columnSeason = Staffel
|
||||||
|
columnYear = Jahr
|
||||||
|
|
||||||
|
#error translations
|
||||||
|
errorUpdateV = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not check update version (nvc)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
|
||||||
|
errorUpdateD = Beim ausf\u00FChren des Updates ist ein Fehler aufgetreten! \nError: could not download update files (ndf)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
|
||||||
|
errorPlay = Beim \u00F6ffnen der Datei ist ein Fehler aufgetreten! \nError: could not open file (nof) \nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
|
||||||
|
errorMode = Oh, da lief etwas falsch! Da hat jemand einen falschen Modus verwendet. \nError: mode unknow (muk)\nWeitere Hilfe erhalten sie unter www.kellerkinder.xyz \noder wenden sie sich an support@kellerkinder.xyz
|
||||||
|
errorOpenStream = Beim \u00F6ffnen des Streams ist ein Fehler aufgetreten!
|
||||||
|
errorLoad = Beim laden der Einstellungen ist ein Fehler aufgetreten!
|
||||||
|
errorSave = Beim speichern der Einstellungen ist ein Fehler aufgetreten!
|
||||||
|
noFilmFound = Kein Film mit diesem Titel gefunden!
|
||||||
|
vlcNotInstalled = Um einen Film abspielen wird der VLC Media Player ben\u00F6tigt!
|
||||||
|
infoText = \nMaintainer: seilo@kellerkinder.xyz und \nhendrik.schutter@coptersicht.de \n(c) 2016-2017 Kellerkinder www.kellerkinder.xyz
|
||||||
|
|
||||||
|
#textFlow translations
|
||||||
|
title = Titel
|
||||||
|
year = Jahr
|
||||||
|
rating = Einstufung
|
||||||
|
publishedOn = Ver\u00F6ffentlicht am
|
||||||
|
duration = Laufzeit
|
||||||
|
genre = Gener
|
||||||
|
director = Regisseur
|
||||||
|
writer = Autor
|
||||||
|
actors = Schauspieler
|
||||||
|
plot = Beschreibung
|
||||||
|
language = Original Sprache
|
||||||
|
country = Produktionsland
|
||||||
|
awards = Auszeichnungen
|
||||||
|
metascore = Metascore
|
||||||
|
imdbRating = IMDB-Bewertung
|
||||||
|
type = Type
|
||||||
|
|
||||||
|
firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben!
|
||||||
|
firstStartContent = Stammverzeichniss angeben?
|
|
@ -0,0 +1,58 @@
|
||||||
|
#HomeFlix-Local_en_US.properties US-English Local and default
|
||||||
|
|
||||||
|
# Buttons
|
||||||
|
aboutBtn = About
|
||||||
|
settingsBtn = Setting
|
||||||
|
addBtn = Add new Game
|
||||||
|
reloadRomsBtn = reload ROMs
|
||||||
|
smmdbBtn = ammdb
|
||||||
|
cemuTFBtn = choose directory
|
||||||
|
romTFBtn = choose directory
|
||||||
|
smmdbDownloadBtn =
|
||||||
|
playBtn =
|
||||||
|
|
||||||
|
# Labels
|
||||||
|
cemu_UISettingsLbl = cemu_UI settings
|
||||||
|
cemuDirectoryLbl = cemu directory
|
||||||
|
romDirectoryLbl = ROM directory
|
||||||
|
mainColorLbl = main color
|
||||||
|
languageLbl = language
|
||||||
|
updateLbl = updates
|
||||||
|
branchLbl = branch
|
||||||
|
cemuSettingsLbl = cemu settings
|
||||||
|
licensesLbl = licenses
|
||||||
|
|
||||||
|
# Columns
|
||||||
|
titleColumn = title
|
||||||
|
idColumn = ID
|
||||||
|
starsColumn = stars
|
||||||
|
timeColumn = time
|
||||||
|
|
||||||
|
# Strings
|
||||||
|
editHeadingText = edit
|
||||||
|
editBodyText = You can edit the tile and rom/cover path.
|
||||||
|
removeHeadingText = remove
|
||||||
|
removeBodyText = Are you sure you want to delete
|
||||||
|
addUpdateHeadingText =
|
||||||
|
addUpdateBodyText =
|
||||||
|
addDLCHeadingText =
|
||||||
|
addDLCBodyText =
|
||||||
|
licensesLblHeadingText =
|
||||||
|
licensesLblBodyText =
|
||||||
|
aboutBtnHeadingText =
|
||||||
|
aboutBtnBodyText =
|
||||||
|
cloudSyncWaringHeadingText =
|
||||||
|
cloudSyncWaringBodyText =
|
||||||
|
cloudSyncErrorHeadingText =
|
||||||
|
cloudSyncErrorBodyText =
|
||||||
|
addBtnReturnErrorHeadingText =
|
||||||
|
addBtnReturnErrorBodyText =
|
||||||
|
|
||||||
|
playBtnPlay =
|
||||||
|
playBtnUpdating =
|
||||||
|
playBtnCopyingFiles =
|
||||||
|
okayBtnText =
|
||||||
|
cancelBtnText =
|
||||||
|
updateBtnCheckNow = check now!
|
||||||
|
updateBtnNoUpdateAvailable = no update available
|
||||||
|
updateBtnUpdateAvailable = update available
|
Loading…
Reference in New Issue