From 507af06b0b433c141c869cfab0eace3db471bef7 Mon Sep 17 00:00:00 2001 From: stussak Date: Tue, 14 Jul 2015 11:47:38 +0000 Subject: [PATCH] fixes default language selection git-svn-id: svn+ssh://hausach.mfo.de/localhome/imaginar/svn/imaginary/jsurfer/branches/JFXSurfer@793 4beaa02c-d2ff-4d45-9dad-6a4a666722bb --- .../fxgui/FXAlgebraicExpressionButtonPanel.fx | 15 +++++++++++---- src/de/mfo/jsurfer/fxgui/TabField.fx | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/de/mfo/jsurfer/fxgui/FXAlgebraicExpressionButtonPanel.fx b/src/de/mfo/jsurfer/fxgui/FXAlgebraicExpressionButtonPanel.fx index 4c7c019..ee37010 100644 --- a/src/de/mfo/jsurfer/fxgui/FXAlgebraicExpressionButtonPanel.fx +++ b/src/de/mfo/jsurfer/fxgui/FXAlgebraicExpressionButtonPanel.fx @@ -89,7 +89,7 @@ public class FXAlgebraicExpressionButtonPanel return new java.util.Locale( "en" ); } - public var language:java.util.Locale=getDefaultLocale(); + public var language:java.util.Locale; var messages:java.util.ResourceBundle=bind ResourceBundle.getBundle( "de.mfo.jsurfer.fxgui.MessagesBundle", language ); public-init var getScale:function (n:Number, w:Number):Number; public-init var showImpressum:function ():Void; @@ -104,8 +104,8 @@ public class FXAlgebraicExpressionButtonPanel public function set() { - setButtons(); setPopUp(); + setButtons(); setTextField(); setTextField2(); @@ -353,7 +353,7 @@ public class FXAlgebraicExpressionButtonPanel } ]; - var languagesTmp : String[] = de.mfo.jsurfer.gui.Options.languages.toArray() as String[]; + var languagesTmp : String[] = de.mfo.jsurfer.gui.Options.languages.toArray() as String[]; // languages IDs are already trimmed var starLanguages : String[] = knownLangs_ISO2[ l | javafx.util.Sequences.indexOf( languagesTmp, l ) == -1 ]; var languageList : java.util.LinkedList = new java.util.LinkedList(); for( l in languagesTmp ) @@ -370,9 +370,16 @@ public class FXAlgebraicExpressionButtonPanel } var languages : String[] = languageList.toArray() as String[]; languages = languages[ l | javafx.util.Sequences.indexOf( knownLangs_ISO2, l ) != -1 ]; + if( languages.size() > 0 ) - { knownLangs_ISO2 = languages; + + if( languagesTmp.size() == 1 and languagesTmp[ 0 ].trim() == "*" ) + { + language = getDefaultLocale(); + } + else + { language = new java.util.Locale( knownLangs_ISO2[ 0 ] ); // use first language in list } diff --git a/src/de/mfo/jsurfer/fxgui/TabField.fx b/src/de/mfo/jsurfer/fxgui/TabField.fx index 2a0d5d0..23b2cc0 100644 --- a/src/de/mfo/jsurfer/fxgui/TabField.fx +++ b/src/de/mfo/jsurfer/fxgui/TabField.fx @@ -105,7 +105,7 @@ public class TabField { [ FXGalleryChooser { - language:java.util.Locale.GERMAN + language: this.language, width:bind R.width*getScale(sceneHeight,sceneWidth), height:bind R.height*getScale(sceneHeight,sceneWidth), gallery:bind pointerGallery @@ -153,7 +153,7 @@ public class TabField { [ FXGalleryMini { - language:java.util.Locale.GERMAN + language: this.language, width:bind G.width*getScale(sceneHeight,sceneWidth), height:bind G.height*getScale(sceneHeight,sceneWidth), gallerys: bind galleries,