Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
import com.google.android.material.progressindicator.LinearProgressIndicator;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import pro.sketchware.utility.telemetry.SafeCrashlytics;
import com.topjohnwu.superuser.Shell;

import java.io.File;
Expand Down Expand Up @@ -129,7 +129,7 @@
public class DesignActivity extends BaseAppCompatActivity implements View.OnClickListener {
public static String sc_id;
private final Handler handler = new Handler(Looper.getMainLooper());
private final FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
private final SafeCrashlytics crashlytics = SafeCrashlytics.get();
private ImageView xmlLayoutOrientation;
private boolean B;
private int currentTabNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import pro.sketchware.utility.telemetry.SafeCrashlytics;

import java.io.File;
import java.lang.ref.WeakReference;
Expand Down Expand Up @@ -136,7 +136,7 @@ public class LogicEditorActivity extends BaseAppCompatActivity implements View.O

private final Handler handler = new Handler();
private final int[] v = new int[2];
private final FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
private final SafeCrashlytics crashlytics = SafeCrashlytics.get();
public ProjectFileBean M;
public PaletteBlock m;
public BlockPane o;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/besome/sketch/editor/view/ViewPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
import com.besome.sketch.editor.view.item.ItemWebView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import pro.sketchware.utility.telemetry.SafeCrashlytics;

import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -117,7 +117,7 @@

public class ViewPane extends RelativeLayout {
private final String stringsStart = "@string/";
private final FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
private final SafeCrashlytics crashlytics = SafeCrashlytics.get();
private Context context;
private ViewGroup rootLayout;
private int b = 99;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package pro.sketchware.utility.telemetry;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.google.firebase.FirebaseApp;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

/**
* Null-safe wrapper around {@link FirebaseCrashlytics}.
*
* <p>Sketchware Pro is built without a {@code google-services.json}, so the
* Firebase content provider that auto-initializes the default {@code FirebaseApp}
* never runs. Calls to {@code FirebaseCrashlytics.getInstance()} therefore throw
* {@link IllegalStateException} the first time they are evaluated. Several
* activities held that instance in a {@code private final} field which is
* initialized in the constructor &mdash; before {@code onCreate} &mdash; meaning
* the activity could not even be instantiated, which produced
* "Unable to instantiate activity" crashes (see Phase 1 r1 bug report).
*
* <p>This wrapper resolves the {@code FirebaseCrashlytics} instance lazily and
* silently no-ops every call when Firebase is unavailable, so the host app stays
* functional. When telemetry is wanted in the future, callers do not need to
* change &mdash; the wrapper will start delegating as soon as a
* {@code FirebaseApp} exists.
*/
public final class SafeCrashlytics {

private static final String TAG = "SafeCrashlytics";
private static final SafeCrashlytics INSTANCE = new SafeCrashlytics();

@Nullable
private final FirebaseCrashlytics delegate;

private SafeCrashlytics() {
this.delegate = resolveDelegate();
}

@Nullable
private static FirebaseCrashlytics resolveDelegate() {
try {
// Touch the default FirebaseApp first to surface
// IllegalStateException locally rather than from getInstance().
FirebaseApp.getInstance();
return FirebaseCrashlytics.getInstance();
} catch (IllegalStateException notInitialized) {
Log.i(TAG, "FirebaseApp not initialized; crashlytics disabled.");
return null;
} catch (Throwable other) {
Log.w(TAG, "Failed to obtain FirebaseCrashlytics; crashlytics disabled.", other);
return null;
}
}

@NonNull
public static SafeCrashlytics get() {
return INSTANCE;
}

public boolean isEnabled() {
return delegate != null;
}

public void log(@NonNull String message) {
if (delegate != null) {
try {
delegate.log(message);
} catch (Throwable ignored) {
// Never let telemetry plumbing escalate into a user-facing crash.
}
}
}

public void recordException(@NonNull Throwable throwable) {
if (delegate != null) {
try {
delegate.recordException(throwable);
} catch (Throwable ignored) {
// Same rationale as log(): keep telemetry best-effort.
}
}
}
}
71 changes: 71 additions & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,75 @@
<string name="block_category_var">متغيرات</string>
<string name="block_category_view_func">عناصر العرض</string>
<string name="block_move_to_bin">نقل لسلة المحذوفات</string>

<!-- ==================== Main tabs ==================== -->
<string name="main_tab_title_competitions">المسابقات</string>
<string name="main_tab_title_myproject">مشاريعي</string>
<string name="main_tab_title_projects_store">متجر المشاريع</string>
<string name="main_tab_title_tutorials">الدروس</string>

<!-- ==================== Settings ==================== -->
<string name="settings_appearance">المظهر</string>
<string name="settings_appearance_description">تغيير مظهر التطبيق</string>
<string name="settings_appearance_theme">سمة سكتشوير</string>
<string name="settings_appearance_theme_system">إعدادات النظام</string>
<string name="settings_appearance_theme_light">السمة الفاتحة</string>
<string name="settings_appearance_theme_dark">السمة الداكنة</string>
<string name="settings_events_manager">مدير الأحداث</string>
<string name="settings_events_manager_activity_events">أحداث الشاشة</string>
<string name="settings_events_manager_listeners">المستمعون</string>
<string name="settings_events_manager_details">تفاصيل مدير الأحداث</string>
<string name="settings_block_selector">مدير منتقي البلوكات</string>

<!-- ==================== My Projects ==================== -->
<string name="myprojects_confirm_project_delete">هل أنت متأكد من حذف هذا المشروع؟</string>
<string name="myprojects_customize_icon">تخصيص الأيقونة</string>
<string name="myprojects_export_project_actionbar_title">تصدير المشروع</string>
<string name="myprojects_export_project_button_export_src">تصدير الكود المصدري</string>
<string name="myprojects_export_project_button_send_src_zip">إرسال الكود المصدري كملف Zip</string>
<string name="myprojects_export_project_button_sign_apk">توقيع الـ APK</string>
<string name="myprojects_export_project_title_export_src">كود مصدري لـ Android Studio</string>
<string name="myprojects_export_project_title_local_path">مسار محلي</string>
<string name="myprojects_export_project_title_sign_apk">توقيع الـ APK</string>
<string name="myprojects_list_menu_title_create_a_new_project">مشروع جديد</string>
<string name="myprojects_list_menu_title_delete">حذف</string>
<string name="myprojects_list_menu_title_settings">إعدادات</string>

<!-- ==================== Manage exported URLs ==================== -->
<string name="manage_export_url_actionbar_title">إدارة الروابط المصدّرة</string>
<string name="manage_export_url_list_app_name">اسم التطبيق</string>
<string name="manage_export_url_list_expire_dt_expired">منتهي الصلاحية</string>
<string name="manage_export_url_list_package_name">اسم الحزمة</string>
<string name="manage_export_url_list_reg_dt">تاريخ التسجيل</string>
<string name="manage_export_url_message_no_url">لا يوجد رابط مُصدَّر.</string>

<!-- ==================== Common errors / messages ==================== -->
<string name="common_error_activity_not_found">الشاشة غير موجودة</string>
<string name="common_error_an_error_occurred">حدث خطأ!</string>
<string name="common_error_failed_to_connect_server">فشل الاتصال بالخادم</string>
<string name="common_error_failed_to_save">فشل الحفظ</string>
<string name="common_error_unknown">خطأ غير معروف! يرجى التواصل مع المسؤول</string>

<!-- ==================== Search ==================== -->
<string name="search_recent_button_delete_all_recent_keyword">حذف الكل</string>
<string name="search_recent_message_delete_keyword_dialog_delete_all">هل تريد حذف كل الكلمات المفتاحية؟</string>
<string name="search_recent_message_delete_keyword_dialog_delete_one">هل تريد حذف هذه الكلمة المفتاحية؟</string>
<string name="search_recent_message_no_data">لا توجد كلمات مفتاحية حديثة لعرضها</string>
<string name="search_recent_recent_keyword">الكلمات المفتاحية الحديثة</string>
<string name="search_recent_title">بحث المحتوى</string>
<string name="search_recent_title_delete_keyword_dialog">حذف كلمة مفتاحية</string>
<string name="search_result_message_no_data">لا توجد نتائج بحث للعرض. :(</string>
<string name="search_result_title">نتائج البحث عن %s</string>

<!-- ==================== Theme presets ==================== -->
<string name="theme_section_title">قوالب السمة</string>
<string name="theme_section_description">اختر من السمات الجاهزة أو أنشئ سمة عشوائية</string>
<string name="theme_generate_random">إنشاء عشوائي</string>
<string name="theme_random_generated">تم إنشاء سمة عشوائية</string>

<!-- ==================== Drawer (root) ==================== -->
<string name="main_drawer_context_menu_title_slack_invitation">احصل على دعوتي</string>
<string name="main_drawer_context_menu_title_slack_open">افتح في Slack (يلزم دعوة)</string>
<string name="main_drawer_title_ad_label">تطبيقات أخرى لـ Sketchware</string>
<string name="main_drawer_title_sketchware_for_arduino">سكتشوير لـ Arduino</string>
</resources>
109 changes: 109 additions & 0 deletions app/src/main/res/values-id/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Indonesian (id) seed translation for Sketchware Pro - Phase 2.
Untranslated strings fall back to values/strings.xml (English).
Contributions welcome via pull request / Crowdin (rencana Phase 2).
-->

<string name="app_name">Sketchware Pro</string>

<!-- ==================== Common words ==================== -->
<string name="common_word_accept">Simpan</string>
<string name="common_word_activity">Aktivitas</string>
<string name="common_word_add">Tambah</string>
<string name="common_word_agree">Setuju</string>
<string name="common_word_all">Semua</string>
<string name="common_word_block">Blok</string>
<string name="common_word_cancel">Batal</string>
<string name="common_word_change">Ubah</string>
<string name="common_word_choose">Pilih</string>
<string name="common_word_close">Tutup</string>
<string name="common_word_collection">Koleksi</string>
<string name="common_word_component">Komponen</string>
<string name="common_word_continue">Lanjutkan</string>
<string name="common_word_copy">Salin</string>
<string name="common_word_create">Buat</string>
<string name="common_word_delete">Hapus</string>
<string name="common_word_deleted">Terhapus!</string>
<string name="common_word_dismiss">Abaikan</string>
<string name="common_word_description">Deskripsi</string>
<string name="common_word_detail">Detail</string>
<string name="common_word_download">Unduh</string>
<string name="common_word_edit">Edit</string>
<string name="common_word_exit">Keluar</string>
<string name="common_word_export">Ekspor</string>
<string name="common_word_finish">Selesai</string>
<string name="common_word_font">Font</string>
<string name="common_word_goback">Kembali</string>
<string name="common_word_image">Gambar</string>
<string name="common_word_import">Impor</string>
<string name="common_word_information">Informasi</string>
<string name="common_word_locale">Bahasa</string>
<string name="common_word_modify">Ubah</string>
<string name="common_word_next">Berikutnya</string>
<string name="common_word_no">Tidak</string>
<string name="common_word_ok">OK</string>
<string name="common_word_prev">Sebelumnya</string>
<string name="common_word_preview">Pratinjau</string>
<string name="common_word_private">Pribadi</string>
<string name="common_word_progressing">Sedang berjalan</string>
<string name="common_word_public">Publik</string>
<string name="common_word_remove">Hapus</string>
<string name="common_word_reset">Atur ulang</string>
<string name="common_word_restore">Pulihkan</string>
<string name="common_word_run">Jalankan</string>
<string name="common_word_save">Simpan</string>
<string name="common_word_saved">Tersimpan</string>
<string name="common_word_select">Pilih</string>
<string name="common_word_share">Bagikan</string>
<string name="common_word_show">Tampilkan</string>
<string name="common_word_update">Perbarui</string>
<string name="common_word_upload">Unggah</string>
<string name="common_word_view">Lihat</string>
<string name="common_word_yes">Ya</string>

<!-- ==================== Main tabs ==================== -->
<string name="main_tab_title_competitions">Kompetisi</string>
<string name="main_tab_title_myproject">Proyek Saya</string>
<string name="main_tab_title_projects_store">Toko Proyek</string>
<string name="main_tab_title_tutorials">Tutorial</string>

<!-- ==================== Drawer ==================== -->
<string name="main_drawer_title_docs">Dokumentasi</string>
<string name="main_drawer_title_export_urls">URL Ekspor</string>
<string name="main_drawer_title_language_settings">Pengaturan Bahasa</string>
<string name="main_drawer_title_program_information">Informasi Program</string>
<string name="main_drawer_title_purchase_list">Daftar Pembelian</string>
<string name="main_drawer_title_remove_ads">Hapus Iklan</string>
<string name="main_drawer_title_save_sketchware">Simpan Sketchware</string>
<string name="main_drawer_title_share_with_friends">Bagikan dengan Teman</string>
<string name="main_drawer_title_subscribe">Berlangganan</string>
<string name="main_drawer_title_system_settings">Pengaturan Sistem</string>

<!-- ==================== Settings ==================== -->
<string name="settings_appearance">Tampilan</string>
<string name="settings_appearance_description">Ubah tampilan Sketchware</string>
<string name="settings_appearance_theme">Tema Sketchware</string>
<string name="settings_appearance_theme_system">Bawaan sistem</string>
<string name="settings_appearance_theme_light">Tema terang</string>
<string name="settings_appearance_theme_dark">Tema gelap</string>

<!-- ==================== Block categories ==================== -->
<string name="block_category_component_func">Komponen</string>
<string name="block_category_control">Kontrol</string>
<string name="block_category_file">Berkas</string>
<string name="block_category_list">Daftar</string>
<string name="block_category_math">Matematika</string>
<string name="block_category_moreblock">Blok tambahan</string>
<string name="block_category_operator">Operator</string>
<string name="block_category_var">Variabel</string>
<string name="block_category_view_func">Tampilan</string>

<!-- ==================== Common errors ==================== -->
<string name="common_error_activity_not_found">Aktivitas tidak ditemukan</string>
<string name="common_error_an_error_occurred">Terjadi kesalahan!</string>
<string name="common_error_failed_to_connect_server">Gagal terhubung ke server</string>
<string name="common_error_failed_to_save">Gagal menyimpan</string>
<string name="common_error_unknown">Kesalahan tidak diketahui! Silakan hubungi administrator</string>
</resources>
9 changes: 5 additions & 4 deletions app/src/main/res/xml/locales_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
app/src/main/res/values-<locale>/strings.xml; otherwise users who pick the
language from system Settings see a fully English UI, which is misleading.

Phase 1 ships English (default) and Arabic. The roadmap targets Indonesian,
Portuguese (BR), Spanish, Russian, Hindi, Persian, Turkish, and Vietnamese
next - those entries should be re-added together with their values-<locale>
resource folders.
Phase 1 shipped English (default) and Arabic. Phase 2 adds Indonesian as a
seed translation. The roadmap targets Portuguese (BR), Spanish, Russian,
Hindi, Persian, Turkish, and Vietnamese next - those entries should be
re-added together with their values-<locale> resource folders.
-->
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en" />
<locale android:name="ar" />
<locale android:name="id" />
</locale-config>
10 changes: 5 additions & 5 deletions docs/CONTRIBUTING-i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Android 13+ system language picker would advertise a language that
silently falls back to English.

### Currently shipping
| Tag | Language | Status |
|--------|-------------------|---------------|
| `en` | English (default) | 100% |
| `ar` | Arabic | Phase 1 seed |
| Tag | Language | Status |
|--------|-------------------|-------------------------------------|
| `en` | English (default) | 100% |
| `ar` | Arabic | Phase 2 (≈160 strings, expanding) |
| `id` | Indonesian | Phase 2 seed (≈100 strings) |

### Planned (will be added to `locales_config.xml` together with their `values-<locale>/`)
- `id` — Indonesian
- `pt-BR` — Portuguese (Brazil)
- `es` — Spanish
- `ru` — Russian
Expand Down
Loading