Translations from Android

This commit is contained in:
serso 2016-03-02 10:53:26 +01:00
parent 01c6597129
commit e9343e3b6b
22 changed files with 38 additions and 10 deletions

View File

@ -126,7 +126,7 @@ public class DisplayFragment extends BaseFragment implements View.OnClickListene
if (!state.valid) {
return;
}
addMenu(menu, R.string.cpp_copy_text, this);
addMenu(menu, R.string.cpp_copy, this);
final Generic result = state.getResult();
final JsclOperation operation = state.getOperation();
@ -181,7 +181,7 @@ public class DisplayFragment extends BaseFragment implements View.OnClickListene
final DisplayState state = display.getState();
final Generic result = state.getResult();
switch (item.getItemId()) {
case R.string.cpp_copy_text:
case R.string.cpp_copy:
display.copy();
return true;
case R.string.convert_to_bin:

View File

@ -124,7 +124,7 @@ public class ConverterFragment extends BaseDialogFragment
protected void onPrepareDialog(@NonNull AlertDialog.Builder builder) {
builder.setPositiveButton(R.string.c_use, null);
builder.setNegativeButton(R.string.cpp_cancel, null);
builder.setNeutralButton(R.string.cpp_copy_text, null);
builder.setNeutralButton(R.string.cpp_copy, null);
}
@Override

View File

@ -102,7 +102,7 @@ public class VariablesFragment extends BaseEntitiesFragment<IConstant> {
}
if (!Strings.isEmpty(variable.getValue())) {
addMenu(menu, R.string.cpp_copy_text, listener);
addMenu(menu, R.string.cpp_copy, listener);
}
}
@ -125,7 +125,7 @@ public class VariablesFragment extends BaseEntitiesFragment<IConstant> {
}
});
return true;
case R.string.cpp_copy_text:
case R.string.cpp_copy:
copyText(variable.getValue());
return true;
}

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">الإعدادات</string>
<string name="cpp_nan">ليس رقمًا</string>
<string name="cpp_error">خطأ</string>
<string name="cpp_copy">نسخ</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Nastavení</string>
<string name="cpp_nan">Není číslo</string>
<string name="cpp_error">Chyba</string>
<string name="cpp_copy">Kopírovat</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Einstellungen</string>
<string name="cpp_nan">Keine Zahl</string>
<string name="cpp_error">Fehler</string>
<string name="cpp_copy">Kopieren</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Ajustes</string>
<string name="cpp_nan">No es un número</string>
<string name="cpp_error">Error</string>
<string name="cpp_copy">Copiar</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Asetukset</string>
<string name="cpp_nan">Ei ole numero</string>
<string name="cpp_error">Virhe</string>
<string name="cpp_copy">Kopioi</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Paramètres</string>
<string name="cpp_nan">Pas un nombre.</string>
<string name="cpp_error">Erreur</string>
<string name="cpp_copy">Copier</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Impostazioni</string>
<string name="cpp_nan">Non è un numero</string>
<string name="cpp_error">Errore</string>
<string name="cpp_copy">Copia</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">設定</string>
<string name="cpp_nan">数字以外の値</string>
<string name="cpp_error">エラー</string>
<string name="cpp_copy">コピー</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Instellingen</string>
<string name="cpp_nan">Is geen getal</string>
<string name="cpp_error">Fout</string>
<string name="cpp_copy">Kopiëren</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Ustawienia</string>
<string name="cpp_nan">To nie liczba</string>
<string name="cpp_error">Błąd</string>
<string name="cpp_copy">Kopiuj</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Configurações</string>
<string name="cpp_nan">Não é número</string>
<string name="cpp_error">Erro</string>
<string name="cpp_copy">Copiar</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Definições</string>
<string name="cpp_nan">Não é um núm.</string>
<string name="cpp_error">Erro</string>
<string name="cpp_copy">Copiar</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Настройки</string>
<string name="cpp_nan">Не число</string>
<string name="cpp_error">Ошибка</string>
<string name="cpp_copy">Копировать</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Ayarlar</string>
<string name="cpp_nan">Sayı değil</string>
<string name="cpp_error">Hata</string>
<string name="cpp_copy">Kopyala</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Cài đặt</string>
<string name="cpp_nan">Không phải số</string>
<string name="cpp_error">Lỗi</string>
<string name="cpp_copy">Sao chép</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">设置</string>
<string name="cpp_nan">不是数字</string>
<string name="cpp_error">错误</string>
<string name="cpp_copy">复制</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">設定</string>
<string name="cpp_nan">非數字</string>
<string name="cpp_error">錯誤</string>
<string name="cpp_copy">複製</string>
</resources>

View File

@ -26,4 +26,5 @@
<string name="cpp_settings">Settings</string>
<string name="cpp_nan">Not a number</string>
<string name="cpp_error">Error</string>
<string name="cpp_copy">Copy</string>
</resources>

View File

@ -13,6 +13,7 @@ public class Android {
private static final List<TranslationLink> calendarLinks = new ArrayList<>();
private static final List<TranslationLink> contactsLinks = new ArrayList<>();
private static final List<TranslationLink> calculatorLinks = new ArrayList<>();
private static final List<TranslationLink> platformLinks = new ArrayList<>();
static {
settingsLinks.add(new TranslationLink("haptic_feedback_enable_title", "cpp_prefs_vibrate_on_keypress"));
@ -44,6 +45,8 @@ public class Android {
calculatorLinks.add(new TranslationLink("error_nan", "cpp_nan"));
calculatorLinks.add(new TranslationLink("error_syntax", "cpp_error"));
platformLinks.add(new TranslationLink("copy", "cpp_copy"));
}
public static void main(String... args) throws Exception {
@ -61,6 +64,12 @@ public class Android {
final File aospContacts = makeInputDirectory(aosp + "/platform/packages/apps/contacts");
final File aospCalculator = makeInputDirectory(aosp + "/platform/packages/apps/calculator");
final String androidHome = System.getenv("ANDROID_HOME");
if (TextUtils.isEmpty(androidHome)) {
throw new MissingOptionException("ANDROID_HOME must be set");
}
final File androidPlatform = makeInputDirectory(androidHome + "/platforms/android-23/data");
final File project;
if (commandLine.hasOption("project")) {
project = makeInputDirectory(commandLine.getOptionValue("project"));
@ -71,7 +80,7 @@ public class Android {
if (commandLine.hasOption("resources")) {
for (String resource : commandLine.getOptionValue("resources").split(",")) {
final int i = resource.indexOf("-");
if(i >= 0) {
if (i >= 0) {
projectLinks.add(new TranslationLink(resource.substring(0, i), "cpp_" + resource.substring(i + 1, resource.length())));
} else {
projectLinks.add(new TranslationLink(resource, "cpp_" + resource));
@ -83,7 +92,7 @@ public class Android {
Utils.delete(outDir);
outDir.mkdirs();
translate(outDir, "aosp", new TranslationDef(aospSettings, settingsLinks), new TranslationDef(aospCalendar, calendarLinks), new TranslationDef(aospContacts, contactsLinks), new TranslationDef(aospCalculator, calculatorLinks));
translate(outDir, "aosp", new TranslationDef(aospSettings, settingsLinks), new TranslationDef(aospCalendar, calendarLinks), new TranslationDef(aospContacts, contactsLinks), new TranslationDef(aospCalculator, calculatorLinks), new TranslationDef(androidPlatform, platformLinks));
if (project != null) {
translate(outDir, "other", new TranslationDef(project, projectLinks));
}
@ -103,9 +112,9 @@ public class Android {
private static Resources readResources(File from, String languageLocale) throws Exception {
File inFile = makeStringsFile(from, languageLocale);
if(!inFile.exists()) {
if (!inFile.exists()) {
final int i = languageLocale.indexOf("-r");
if(i >= 0) {
if (i >= 0) {
inFile = makeStringsFile(from, languageLocale.substring(0, i));
}
}
@ -152,13 +161,14 @@ public class Android {
private static class TranslationDef {
public final File project;
public final List <TranslationLink> links;
public final List<TranslationLink> links;
private TranslationDef(File project, List<TranslationLink> links) {
this.project = project;
this.links = links;
}
}
private static class TranslationLink {
public final String inName;
public final String outName;