svn commit: r1853341 - /tomcat/trunk/java/org/apache/tomcat/buildutil/translate/Export.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1853341 - /tomcat/trunk/java/org/apache/tomcat/buildutil/translate/Export.java

kkolinko
Author: kkolinko
Date: Mon Feb 11 11:00:39 2019
New Revision: 1853341

URL: http://svn.apache.org/viewvc?rev=1853341&view=rev
Log:
Translations export tool: print translation keys in alphabetic order.

Print translations sorted by key, instead of random order used by a hash map.

Modified:
    tomcat/trunk/java/org/apache/tomcat/buildutil/translate/Export.java

Modified: tomcat/trunk/java/org/apache/tomcat/buildutil/translate/Export.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/buildutil/translate/Export.java?rev=1853341&r1=1853340&r2=1853341&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/buildutil/translate/Export.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/buildutil/translate/Export.java Mon Feb 11 11:00:39 2019
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -124,7 +125,9 @@ public class Export {
             File out = new File(storageDir, Constants.L10N_PREFIX + language + Constants.L10N_SUFFIX);
             try (FileOutputStream fos = new FileOutputStream(out);
                     Writer w = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) {
-                for (Object key : translation.keySet()) {
+                String[] keys = translation.keySet().toArray(new String[0]);
+                Arrays.sort(keys);
+                for (Object key : keys) {
                     w.write(key + "=" + Utils.formatValue(translation.getProperty((String) key)) + "\n");
                 }
             } catch (IOException ioe) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]