Merge remote-tracking branch 'upstream/master' into fork

This commit is contained in:
sk 2022-11-21 21:58:55 +01:00
commit e42988b51e
2 changed files with 81 additions and 40 deletions

View File

@ -1,43 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en" />
<locale android:name="ar" />
<locale android:name="ar-SA"/>
<locale android:name="bn-BD"/>
<locale android:name="bs" />
<locale android:name="ca" />
<locale android:name="cs" />
<locale android:name="de" />
<locale android:name="bs-BA"/>
<locale android:name="ca-ES"/>
<locale android:name="cs-CZ"/>
<locale android:name="de-DE"/>
<locale android:name="el-GR"/>
<locale android:name="en"/>
<locale android:name="es-ES"/>
<locale android:name="eu-ES"/>
<locale android:name="fi-FI"/>
<locale android:name="fr-FR"/>
<locale android:name="gd-GB"/>
<locale android:name="el" />
<locale android:name="es" />
<locale android:name="eu" />
<locale android:name="fi" />
<locale android:name="fr" />
<loacle android:name="sl"/>
<locale android:name="gl" />
<locale android:name="gl-ES"/>
<locale android:name="hi-IN"/>
<locale android:name="hr" />
<locale android:name="hy" />
<locale android:name="id"/>
<locale android:name="it" />
<locale android:name="iw" />
<locale android:name="ja" />
<locale android:name="hr-HR"/>
<locale android:name="hy-AM"/>
<locale android:name="in-ID"/>
<locale android:name="it-IT"/>
<locale android:name="iw-IL"/>
<locale android:name="ja-JP"/>
<locale android:name="kab"/>
<locale android:name="ko" />
<locale android:name="nl"/>
<locale android:name="oc" />
<locale android:name="pl" />
<locale android:name="ko-KR"/>
<locale android:name="nl-NL"/>
<locale android:name="oc-FR"/>
<locale android:name="pl-PL"/>
<locale android:name="pt-BR"/>
<locale android:name="pt-PT"/>
<locale android:name="ro"/>
<locale android:name="ru" />
<locale android:name="ru-RU"/>
<locale android:name="si-LK"/>
<locale android:name="sl"/>
<locale android:name="sv" />
<locale android:name="th" />
<locale android:name="tr" />
<locale android:name="uk" />
<locale android:name="vi" />
<locale android:name="zh-Hans" />
<locale android:name="zh-Hant" />
<locale android:name="sv-SE"/>
<locale android:name="th-TH"/>
<locale android:name="tr-TR"/>
<locale android:name="uk-UA"/>
<locale android:name="vi-VN"/>
<locale android:name="zh-CN"/>
<locale android:name="zh-TW"/>
</locale-config>

View File

@ -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<String> 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("""
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
""");
for(String locale : locales){
writer.write("\t<locale android:name=\"");
writer.write(locale);
writer.write("\"/>\n");
}
writer.write("</locale-config>");
}
}
}