File tree Expand file tree Collapse file tree 3 files changed +11
-15
lines changed
src/me/theentropyshard/jdarkroom Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 11@ ECHO OFF
2- java -jar JDarkroom.jar en-US
2+ java -jar JDarkroom.jar en
Original file line number Diff line number Diff line change 11@ ECHO OFF
2- java -jar JDarkroom.jar ru-RU
2+ java -jar JDarkroom.jar ru
Original file line number Diff line number Diff line change 1919
2020import javax .swing .*;
2121import java .util .Locale ;
22- import java .util .regex .Matcher ;
23- import java .util .regex .Pattern ;
2422
2523public class Main {
2624 public static void main (String [] args ) {
2725 if (args .length > 0 ) {
28- Pattern localePattern = Pattern .compile ("([a-z]{2})-([A-Z]{2})$" );
29- Matcher matcher = localePattern .matcher (args [0 ]);
30- if (matcher .matches ()) {
31- try {
32- String [] langAndCountry = args [0 ].split ("-" );
33- Locale .setDefault (new Locale (langAndCountry [0 ], langAndCountry [1 ]));
34- } catch (Exception se ) {
35- se .printStackTrace ();
36- }
37- } else {
38- System .err .println ("Incorrect locale supplied: " + args [0 ]);
26+ String lang = args [0 ].toLowerCase (Locale .ROOT );
27+ if (!"ruen" .contains (lang )) {
28+ lang = "en" ;
29+ }
30+
31+ try {
32+ Locale .setDefault (new Locale (lang ));
33+ } catch (Exception e ) {
34+ e .printStackTrace ();
3935 }
4036 }
4137
You can’t perform that action at this time.
0 commit comments