Set preferred supported locale for template

* fixes decimal separator
* fixes tests that relied on German system locale
* fixes gh ci test

Change-Id: Iab5bb54343c6511c4415df1d767bf5dfc8146888
diff --git a/src/main/java/de/ids_mannheim/korap/plkexport/Service.java b/src/main/java/de/ids_mannheim/korap/plkexport/Service.java
index cb0d7ae..2ef6338 100644
--- a/src/main/java/de/ids_mannheim/korap/plkexport/Service.java
+++ b/src/main/java/de/ids_mannheim/korap/plkexport/Service.java
@@ -732,6 +732,7 @@
         // Generate template
         try {
             Template template = cfg.getTemplate("export.ftl");
+            template.setLocale(getPreferredSupportedLocale());
             template.process(templateData, out);
         }
 
@@ -778,28 +779,27 @@
     /*
      * Load dictionary for a chosen locale as a resource bundle
      */
-    private ResourceBundle getDictionary () throws IOException {
+    private ResourceBundle getDictionary() throws IOException {
+        return ResourceBundle.getBundle(
+                "locales/export", getPreferredSupportedLocale()
+        );
+    }
 
-        // Load prefered dictionary
-        Locale prefered = new Locale("en");
+    private Locale getPreferredSupportedLocale() throws IOException {
+        Locale fallback = new Locale("en");
 
         if (req != null) {
-
-        CHOOSE:
             for (Locale l : req.getAcceptableLanguages()) {
                 switch (l.getLanguage()) {
-                case "de":
-                    prefered = l;
-                    break CHOOSE;
-                case "en":
-                    prefered = l;
-                    break CHOOSE;
-                };
-            };
-        };
+                    case "de":
+                        return (l);
+                    case "en":
+                        return (l);
+                }
+            }
+        }
 
-        return ResourceBundle.getBundle(
-            "locales/export", prefered
-            );
-    };
-};
+        return fallback;
+    }
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/plkexport/AssetTest.java b/src/test/java/de/ids_mannheim/korap/plkexport/AssetTest.java
index 2c5b22c..cc9f571 100644
--- a/src/test/java/de/ids_mannheim/korap/plkexport/AssetTest.java
+++ b/src/test/java/de/ids_mannheim/korap/plkexport/AssetTest.java
@@ -111,7 +111,7 @@
         assertEquals("HTTP Code",
                      Status.OK.getStatusCode(), responsehtml.getStatus());
         str = responsehtml.readEntity(String.class);
-        assertTrue("HTTP Body (en)", str.contains("Maximum number of exportable matches: <tt>10.000</tt>"));
+        assertTrue("HTTP Body (en)", str.contains("Maximum number of exportable matches: <tt>10,000</tt>"));
 
     };