The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit e64d3f79 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

the language should now change correctly, especially if the default language...

the language should now change correctly, especially if the default language of the operating system is german.
parent 33953c3c
package org.vadere.gui.components.utils;
import org.vadere.gui.projectview.VadereApplication;
import java.util.Locale;
import java.util.prefs.Preferences;
public class Language {
public static final Locale locale = Language.setLanguage();
/*
* The default language of this application is english.
*/
static {
Locale.setDefault(Locale.ENGLISH);
}
static Locale setLanguage() {
String language = Preferences.userNodeForPackage(VadereApplication.class).get("language", null);
if (language != null) {
switch (language) {
case "de":
return new Locale("de", "DE");
case "en":
default:
return new Locale("en");
}
}
return Locale.getDefault();
}
public static boolean languageIsGerman() {
return locale.getLanguage().equals(Locale.GERMAN.getLanguage());
}
}
package org.vadere.gui.components.utils;
import com.android.dx.gen.Local;
import javax.swing.*;
import org.vadere.gui.projectview.VadereApplication;
......@@ -18,6 +20,8 @@ import java.util.prefs.Preferences;
*/
public abstract class Messages {
private static final String BUNDLE_NAME = "messages";
private static final ResourceBundle RESOURCE_BUNDLE = loadBundle();
public static String getString(String key) {
try {
......@@ -28,26 +32,8 @@ public abstract class Messages {
}
}
private static final String BUNDLE_NAME = "messages";
public static final Locale locale = setLanguage();
private static final ResourceBundle RESOURCE_BUNDLE = loadBundle();
private static ResourceBundle loadBundle() {
return ResourceBundle.getBundle(BUNDLE_NAME, locale);
}
private static Locale setLanguage() {
String language = Preferences.userNodeForPackage(VadereApplication.class).get("language", null);
if (language != null) {
switch (language) {
case "de":
return Locale.GERMAN;
case "en":
default:
return Locale.ENGLISH;
}
}
return Locale.getDefault();
return ResourceBundle.getBundle(BUNDLE_NAME, Language.locale);
}
public static void changeLanguage(Locale lang) {
......@@ -56,8 +42,4 @@ public abstract class Messages {
getString("Messages.changeLanguagePopup.title"), JOptionPane.INFORMATION_MESSAGE);
}
public static boolean languageIsGerman() {
return locale.getLanguage().equals(Locale.GERMAN.getLanguage());
}
}
package org.vadere.gui.projectview.view;
import org.apache.commons.codec.language.bm.Lang;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Language;
import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.postvisualization.control.Player;
import org.vadere.gui.projectview.VadereApplication;
......@@ -410,7 +412,7 @@ public class ProjectView extends JFrame implements ProjectFinishedListener, Sing
ButtonGroup languageChoicesGroup = new ButtonGroup();
languageChoicesGroup.add(mntmEnglishLocale);
languageChoicesGroup.add(mntmGermanLocale);
if (Messages.languageIsGerman())
if (Language.languageIsGerman())
mntmGermanLocale.setSelected(true);
else
mntmEnglishLocale.setSelected(true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment