diff --git a/mastodon/src/main/res/xml/locales_config.xml b/mastodon/src/main/res/xml/locales_config.xml
index 7e50a26f1..29fcaf7e1 100644
--- a/mastodon/src/main/res/xml/locales_config.xml
+++ b/mastodon/src/main/res/xml/locales_config.xml
@@ -1,43 +1,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tools/GenerateLocaleConfig.java b/tools/GenerateLocaleConfig.java
new file mode 100644
index 000000000..fc585af02
--- /dev/null
+++ b/tools/GenerateLocaleConfig.java
@@ -0,0 +1,44 @@
+// Run: java tools/GenerateLocaleConfig.java
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+
+
+public class GenerateLocaleConfig{
+ public static void main(String[] args) throws IOException{
+ File dir=new File("../mastodon/src/main/res/");
+ if(!dir.exists())
+ dir=new File("mastodon/src/main/res");
+ if(!dir.exists())
+ throw new RuntimeException("Please run from project directory (can't find mastodon/src/main/res)");
+
+ ArrayList locales=new ArrayList<>();
+ locales.add("en");
+
+ for(File file:dir.listFiles()){
+ String name=file.getName();
+ if(file.isDirectory() && name.startsWith("values-")){
+ if(new File(file, "strings.xml").exists()){
+ locales.add(name.substring(name.indexOf('-')+1).replace("-r", "-"));
+ }
+ }
+ }
+
+ locales.sort(String::compareTo);
+ try(OutputStreamWriter writer=new OutputStreamWriter(new FileOutputStream(new File(dir, "xml/locales_config.xml")), StandardCharsets.UTF_8)){
+ writer.write("""
+
+
+ """);
+ for(String locale : locales){
+ writer.write("\t\n");
+ }
+ writer.write("");
+ }
+ }
+}
\ No newline at end of file