From e9343e3b6b99a10af5eaaa64e0cefed5a27f66c3 Mon Sep 17 00:00:00 2001 From: serso Date: Wed, 2 Mar 2016 10:53:26 +0100 Subject: [PATCH] Translations from Android --- .../android/calculator/DisplayFragment.java | 4 ++-- .../converter/ConverterFragment.java | 2 +- .../variables/VariablesFragment.java | 4 ++-- .../main/res/values-ar/text_imported_aosp.xml | 1 + .../main/res/values-cs/text_imported_aosp.xml | 1 + .../main/res/values-de/text_imported_aosp.xml | 1 + .../main/res/values-es/text_imported_aosp.xml | 1 + .../main/res/values-fi/text_imported_aosp.xml | 1 + .../main/res/values-fr/text_imported_aosp.xml | 1 + .../main/res/values-it/text_imported_aosp.xml | 1 + .../main/res/values-ja/text_imported_aosp.xml | 1 + .../main/res/values-nl/text_imported_aosp.xml | 1 + .../main/res/values-pl/text_imported_aosp.xml | 1 + .../res/values-pt-rBR/text_imported_aosp.xml | 1 + .../res/values-pt-rPT/text_imported_aosp.xml | 1 + .../main/res/values-ru/text_imported_aosp.xml | 1 + .../main/res/values-tr/text_imported_aosp.xml | 1 + .../main/res/values-vi/text_imported_aosp.xml | 1 + .../res/values-zh-rCN/text_imported_aosp.xml | 1 + .../res/values-zh-rTW/text_imported_aosp.xml | 1 + .../main/res/values/text_imported_aosp.xml | 1 + .../android/translations/Android.java | 20 ++++++++++++++----- 22 files changed, 38 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java b/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java index 32a3a35b..2fc4a837 100644 --- a/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java @@ -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: diff --git a/app/src/main/java/org/solovyev/android/calculator/converter/ConverterFragment.java b/app/src/main/java/org/solovyev/android/calculator/converter/ConverterFragment.java index 9f567223..b087c9a4 100644 --- a/app/src/main/java/org/solovyev/android/calculator/converter/ConverterFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/converter/ConverterFragment.java @@ -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 diff --git a/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java index 90ed0065..eb628fe9 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java @@ -102,7 +102,7 @@ public class VariablesFragment extends BaseEntitiesFragment { } 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 { } }); return true; - case R.string.cpp_copy_text: + case R.string.cpp_copy: copyText(variable.getValue()); return true; } diff --git a/app/src/main/res/values-ar/text_imported_aosp.xml b/app/src/main/res/values-ar/text_imported_aosp.xml index 816377d7..0ae5ef32 100644 --- a/app/src/main/res/values-ar/text_imported_aosp.xml +++ b/app/src/main/res/values-ar/text_imported_aosp.xml @@ -26,4 +26,5 @@ الإعدادات ليس رقمًا خطأ + نسخ \ No newline at end of file diff --git a/app/src/main/res/values-cs/text_imported_aosp.xml b/app/src/main/res/values-cs/text_imported_aosp.xml index 506ea57c..9f967f39 100644 --- a/app/src/main/res/values-cs/text_imported_aosp.xml +++ b/app/src/main/res/values-cs/text_imported_aosp.xml @@ -26,4 +26,5 @@ Nastavení Není číslo Chyba + Kopírovat \ No newline at end of file diff --git a/app/src/main/res/values-de/text_imported_aosp.xml b/app/src/main/res/values-de/text_imported_aosp.xml index 5d408b3d..5d1e81ae 100644 --- a/app/src/main/res/values-de/text_imported_aosp.xml +++ b/app/src/main/res/values-de/text_imported_aosp.xml @@ -26,4 +26,5 @@ Einstellungen Keine Zahl Fehler + Kopieren \ No newline at end of file diff --git a/app/src/main/res/values-es/text_imported_aosp.xml b/app/src/main/res/values-es/text_imported_aosp.xml index 13bea852..44693b5a 100644 --- a/app/src/main/res/values-es/text_imported_aosp.xml +++ b/app/src/main/res/values-es/text_imported_aosp.xml @@ -26,4 +26,5 @@ Ajustes No es un número Error + Copiar \ No newline at end of file diff --git a/app/src/main/res/values-fi/text_imported_aosp.xml b/app/src/main/res/values-fi/text_imported_aosp.xml index da8f0da2..f98f39a5 100644 --- a/app/src/main/res/values-fi/text_imported_aosp.xml +++ b/app/src/main/res/values-fi/text_imported_aosp.xml @@ -26,4 +26,5 @@ Asetukset Ei ole numero Virhe + Kopioi \ No newline at end of file diff --git a/app/src/main/res/values-fr/text_imported_aosp.xml b/app/src/main/res/values-fr/text_imported_aosp.xml index 56130b36..71bbd40d 100644 --- a/app/src/main/res/values-fr/text_imported_aosp.xml +++ b/app/src/main/res/values-fr/text_imported_aosp.xml @@ -26,4 +26,5 @@ Paramètres Pas un nombre. Erreur + Copier \ No newline at end of file diff --git a/app/src/main/res/values-it/text_imported_aosp.xml b/app/src/main/res/values-it/text_imported_aosp.xml index 276f3a1e..62aee235 100644 --- a/app/src/main/res/values-it/text_imported_aosp.xml +++ b/app/src/main/res/values-it/text_imported_aosp.xml @@ -26,4 +26,5 @@ Impostazioni Non è un numero Errore + Copia \ No newline at end of file diff --git a/app/src/main/res/values-ja/text_imported_aosp.xml b/app/src/main/res/values-ja/text_imported_aosp.xml index e1190a13..610bf26b 100644 --- a/app/src/main/res/values-ja/text_imported_aosp.xml +++ b/app/src/main/res/values-ja/text_imported_aosp.xml @@ -26,4 +26,5 @@ 設定 数字以外の値 エラー + コピー \ No newline at end of file diff --git a/app/src/main/res/values-nl/text_imported_aosp.xml b/app/src/main/res/values-nl/text_imported_aosp.xml index ed03831a..bd8f1130 100644 --- a/app/src/main/res/values-nl/text_imported_aosp.xml +++ b/app/src/main/res/values-nl/text_imported_aosp.xml @@ -26,4 +26,5 @@ Instellingen Is geen getal Fout + Kopiëren \ No newline at end of file diff --git a/app/src/main/res/values-pl/text_imported_aosp.xml b/app/src/main/res/values-pl/text_imported_aosp.xml index dcace046..e17b6b0a 100644 --- a/app/src/main/res/values-pl/text_imported_aosp.xml +++ b/app/src/main/res/values-pl/text_imported_aosp.xml @@ -26,4 +26,5 @@ Ustawienia To nie liczba Błąd + Kopiuj \ No newline at end of file diff --git a/app/src/main/res/values-pt-rBR/text_imported_aosp.xml b/app/src/main/res/values-pt-rBR/text_imported_aosp.xml index 65c61b63..ce74428b 100644 --- a/app/src/main/res/values-pt-rBR/text_imported_aosp.xml +++ b/app/src/main/res/values-pt-rBR/text_imported_aosp.xml @@ -26,4 +26,5 @@ Configurações Não é número Erro + Copiar \ No newline at end of file diff --git a/app/src/main/res/values-pt-rPT/text_imported_aosp.xml b/app/src/main/res/values-pt-rPT/text_imported_aosp.xml index 984d5896..4173d3f7 100644 --- a/app/src/main/res/values-pt-rPT/text_imported_aosp.xml +++ b/app/src/main/res/values-pt-rPT/text_imported_aosp.xml @@ -26,4 +26,5 @@ Definições Não é um núm. Erro + Copiar \ No newline at end of file diff --git a/app/src/main/res/values-ru/text_imported_aosp.xml b/app/src/main/res/values-ru/text_imported_aosp.xml index 3a25e1bc..ceb69317 100644 --- a/app/src/main/res/values-ru/text_imported_aosp.xml +++ b/app/src/main/res/values-ru/text_imported_aosp.xml @@ -26,4 +26,5 @@ Настройки Не число Ошибка + Копировать \ No newline at end of file diff --git a/app/src/main/res/values-tr/text_imported_aosp.xml b/app/src/main/res/values-tr/text_imported_aosp.xml index efb46991..fda5e7a9 100644 --- a/app/src/main/res/values-tr/text_imported_aosp.xml +++ b/app/src/main/res/values-tr/text_imported_aosp.xml @@ -26,4 +26,5 @@ Ayarlar Sayı değil Hata + Kopyala \ No newline at end of file diff --git a/app/src/main/res/values-vi/text_imported_aosp.xml b/app/src/main/res/values-vi/text_imported_aosp.xml index 1914690a..d4b8636c 100644 --- a/app/src/main/res/values-vi/text_imported_aosp.xml +++ b/app/src/main/res/values-vi/text_imported_aosp.xml @@ -26,4 +26,5 @@ Cài đặt Không phải số Lỗi + Sao chép \ No newline at end of file diff --git a/app/src/main/res/values-zh-rCN/text_imported_aosp.xml b/app/src/main/res/values-zh-rCN/text_imported_aosp.xml index 622772d1..d2253055 100644 --- a/app/src/main/res/values-zh-rCN/text_imported_aosp.xml +++ b/app/src/main/res/values-zh-rCN/text_imported_aosp.xml @@ -26,4 +26,5 @@ 设置 不是数字 错误 + 复制 \ No newline at end of file diff --git a/app/src/main/res/values-zh-rTW/text_imported_aosp.xml b/app/src/main/res/values-zh-rTW/text_imported_aosp.xml index 2874aa9c..0057ab88 100644 --- a/app/src/main/res/values-zh-rTW/text_imported_aosp.xml +++ b/app/src/main/res/values-zh-rTW/text_imported_aosp.xml @@ -26,4 +26,5 @@ 設定 非數字 錯誤 + 複製 \ No newline at end of file diff --git a/app/src/main/res/values/text_imported_aosp.xml b/app/src/main/res/values/text_imported_aosp.xml index 5c92089b..b4b239f5 100644 --- a/app/src/main/res/values/text_imported_aosp.xml +++ b/app/src/main/res/values/text_imported_aosp.xml @@ -26,4 +26,5 @@ Settings Not a number Error + Copy \ No newline at end of file diff --git a/translations/src/main/java/org/solovyev/android/translations/Android.java b/translations/src/main/java/org/solovyev/android/translations/Android.java index f16d55dc..6d1c2fb6 100644 --- a/translations/src/main/java/org/solovyev/android/translations/Android.java +++ b/translations/src/main/java/org/solovyev/android/translations/Android.java @@ -13,6 +13,7 @@ public class Android { private static final List calendarLinks = new ArrayList<>(); private static final List contactsLinks = new ArrayList<>(); private static final List calculatorLinks = new ArrayList<>(); + private static final List 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 links; + public final List links; private TranslationDef(File project, List links) { this.project = project; this.links = links; } } + private static class TranslationLink { public final String inName; public final String outName;