Android case study

Building an Android app for Arabic first

Most apps in our region are translated into Arabic. Wasfetna is a recipe app I built the other way round: Arabic first, English second.

Project
Solo and personal, AI-assisted
Stack
Kotlin, Jetpack Compose, Hilt, Coroutines, Firebase
Languages
Arabic and English
Live on
Google Play and Huawei AppGallery

Text that doesn't assume who is reading

Arabic has no gender-neutral command. A button has to pick a man or a woman. Early on, my app did both, depending on when I built each screen.

I don't keep separate strings for men and women. I rewrote the text so it addresses nobody:

Buttons use the verbal nounبدء الطبخinstead of ابدأ الطبخ
Recipe steps use the passiveيُضاف الزيتinstead of أضيفي الزيت
Error messages are impersonalيرجى إعادة المحاولةinstead of حاول مرة أخرى

A small script scans the Arabic text, and the release check fails if it finds a verb that addresses a man or a woman. Part of it is a word list, so it can miss things. It catches most slips before users see them.

One exception is deliberate: the Home row اطبخها مجددًا keeps the command, because the verbal noun طبخها reads as "he cooked it".

Arabic needs more room than fonts admit

On the Wasfetna website, Chrome cut the dots under a final ي, so الإلكتروني read الإلكترونى. The font declared 4px below the line, but the dots reached about 9px.

I measured it instead of guessing. On a 54px text box, a line height of 53px still cut the dots, and 54px fixed them. The rule: the box needs a fixed height, and a line height at least that tall.

The Android app has a version of this too. Compose can trim the space above and below a line, so I turn trimming off for every Arabic text style.

Numbers don't follow the screen

Arabic runs right to left, but numbers don't. The code input keeps left-to-right order on Arabic screens, so the digits fill in the expected order.

A number can also change the word beside it. It's 5 وصفات but 12 وصفة, so recipe, dish and minute counts use Android's plural resources, and a test checks them.

Performance, measured on a real phone

I quote a speed number only if a benchmark produced it on a named phone. Cold start and recomposition come from Macrobenchmark runs on a Galaxy A54. The data figure comes from the phone's network counters on a Galaxy A35.

What changedBeforeAfter
Median cold start to first frame, with a Baseline Profile (September 2026 run)509 ms431 ms
Recomposition per frame, scrolling search results1.9 ms0.03 ms
Data for a fresh install6.4 MB~1.5 MB

The recomposition fix was simple: the list saved its scroll position into shared state on every frame. It now hands the position over once, when the screen closes.

One app, two stores

Wasfetna ships Google and Huawei builds from one codebase, with unit, UI and screenshot tests. Huawei devices have no Play Services, so I wrote a custom Firebase App Check provider for them, verified on the server by a Cloud Function.

How I used AI

I built Wasfetna with Claude Code and Codex. I use them for implementation, refactoring and code review. I review every change myself and check it with tests and benchmarks, because I own what ships.

دراسة حالة في أندرويد

بناء تطبيق أندرويد للعربية أولًا

معظم التطبيقات في منطقتنا تُترجَم إلى العربية. أما وصفتنا فتطبيق وصفات بنيتُه بالعكس: العربية أولًا، ثم الإنجليزية.

المشروع
مشروع شخصي بنيتُه وحدي، بمساعدة الذكاء الاصطناعي
التقنيات
Kotlin, Jetpack Compose, Hilt, Coroutines, Firebase
اللغات
العربية والإنجليزية
متاح على
Google Play و Huawei AppGallery

نصوص لا تفترض من يقرؤها

ليس في العربية أمرٌ محايد بين المذكر والمؤنث، فالزر مضطر إلى مخاطبة رجل أو امرأة. وفي البداية كان تطبيقي يفعل الأمرين، بحسب وقت بناء كل شاشة.

لا أحتفظ بنصوص منفصلة للرجال والنساء. أعدتُ كتابة النص بحيث لا يخاطب أحدًا:

الأزرار تستخدم المصدربدء الطبخبدلًا من «ابدأ الطبخ»
خطوات الوصفة بصيغة المبني للمجهوليُضاف الزيتبدلًا من «أضيفي الزيت»
رسائل الخطأ بصيغة غير شخصيةيرجى إعادة المحاولةبدلًا من «حاول مرة أخرى»

يفحص سكربت صغير النصوص العربية، ويفشل فحص الإصدار إذا وجد فعلًا يخاطب رجلًا أو امرأة. وجزء منه قائمة كلمات، لذا قد يفوته شيء، لكنه يلتقط معظم الأخطاء قبل أن تصل إلى المستخدمين.

واستثناء واحد أبقيتُه عن قصد: صف «اطبخها مجددًا» في الرئيسية، لأن المصدر «طبخها» يُقرأ «طَبَخَها».

العربية تحتاج إلى مساحة أكبر مما تعلنه الخطوط

في موقع وصفتنا، قصّ Chrome النقطتين تحت الياء الأخيرة، فصارت «الإلكتروني» تُقرأ «الإلكترونى». كان الخط يعلن 4px تحت السطر، لكن النقطتين تصلان إلى نحو 9px.

قِستُ بدل أن أخمّن. في مربع نص بارتفاع 54px، ظل ارتفاع السطر 53px يقصّ النقطتين، وأصلحهما 54px. القاعدة: ارتفاع ثابت للمربع، وارتفاع سطر لا يقل عنه.

وللمشكلة صورة أخرى في تطبيق أندرويد. يستطيع Compose قصّ المساحة فوق السطر وتحته، لذلك أُوقف هذا القص في كل أنماط النص العربي.

الأرقام لا تتبع اتجاه الشاشة

تسير العربية من اليمين إلى اليسار، أما الأرقام فلا. يبقى حقل الرمز من اليسار إلى اليمين على الشاشات العربية، فتظهر الأرقام بالترتيب المتوقع.

وقد يغيّر الرقم الكلمة التي بجانبه: «5 وصفات» لكن «12 وصفة»، لذلك تستخدم أعداد الوصفات والأطباق والدقائق موارد الجمع في أندرويد، ويتحقق منها اختبار.

قياس الأداء على هاتف حقيقي

لا أذكر رقمًا للسرعة إلا إذا أنتجه اختبار أداء على هاتف مسمّى. أرقام الإقلاع البارد و Recomposition من اختبارات Macrobenchmark على Galaxy A54. أما رقم البيانات فمن عدّادات الشبكة في الهاتف على Galaxy A35.

ما الذي تغيّرقبلبعد
وسيط الإقلاع البارد حتى أول إطار، مع Baseline Profile (قياس أيلول 2026)509 ms431 ms
Recomposition لكل إطار، عند تمرير نتائج البحث1.9 ms0.03 ms
البيانات عند التثبيت الجديد6.4 MB~1.5 MB

كان إصلاح Recomposition بسيطًا: كانت القائمة تحفظ موضع التمرير في حالة مشتركة عند كل إطار، وهي الآن تسلّم الموضع مرة واحدة عند إغلاق الشاشة.

تطبيق واحد ومتجران

يصدر تطبيق وصفتنا بنسختين لـGoogle و Huawei من قاعدة كود واحدة، مع اختبارات وحدة وواجهة ولقطات شاشة. لا تملك أجهزة Huawei خدمات Play، لذلك كتبتُ لها مزوّدًا مخصصًا لـFirebase App Check، تتحقق منه Cloud Function على الخادم.

كيف استخدمتُ الذكاء الاصطناعي

بنيتُ تطبيق وصفتنا باستخدام Claude Code و Codex. أستخدمهما في التنفيذ وإعادة الهيكلة ومراجعة الكود. أراجع كل تغيير بنفسي وأتحقق منه بالاختبارات وقياسات الأداء، لأنني المسؤول عمّا يصل إلى المستخدمين.