0Pricing
Indie Hacker Mobile Apps · Урок

Доступность и интернационализация

Сделайте приложение удобным для всех, добавив специальные возможности и подготовив его к работе на разных языках и в различных регионах.

«Доступность и интернационализация» — бесплатный урок Indie Hacker Mobile Apps на CoddyKit. Это урок 2 из 4. Ты можешь прочитать весь урок бесплатно ниже — а потом практиковать его прямо в браузере с встроенным редактором кода и ИИ-репетитором 24/7. Это часть пути обучения Indie Hacker Mobile Apps, и твой прогресс синхронизируется между веб-версией и приложением CoddyKit. Курс Indie Hacker Mobile Apps содержит 4 уроков всего.

Части этого урока еще не переведены и отображаются на английском.

Welcome to Inclusive Design

Making your mobile app accessible and internationally friendly isn't just good practice; it's essential for reaching a wider audience and providing a great user experience for everyone.

In this lesson, we'll explore key principles and practical steps to achieve both.

Understanding Accessibility (A11y)

Accessibility (A11y) refers to designing and developing apps that can be used by people with a wide range of abilities and disabilities.

  • Visual Impairment: Users might rely on screen readers or need high contrast.
  • Motor Impairment: Users might need larger touch targets or keyboard navigation.
  • Hearing Impairment: Users might need captions for audio/video.

By making your app accessible, you ensure it's usable by everyone.

Screen Readers & Labels

Screen readers are assistive technologies that read out loud the content on a screen, helping visually impaired users navigate your app.

For screen readers to work effectively, interactive elements need proper accessibility labels. These labels provide a descriptive text for the element that might not be visually obvious.

Try running this conceptual example:

public class AccessibilityDemo {
  // A simplified Button component concept
  static class Button {
    String text;
    String accessibilityLabel;

    Button(String text, String accessibilityLabel) {
      this.text = text;
      this.accessibilityLabel = accessibilityLabel;
    }

    // Simulate what a screen reader might announce
    String getScreenReaderAnnouncement() {
      if (accessibilityLabel != null && !accessibilityLabel.isEmpty()) {
        return accessibilityLabel;
      }
      return text; // Fallback to visible text
    }
  }

  public static void main(String[] args) {
    Button submitButton = new Button("Submit", "Tap to submit the form");
    Button okButton = new Button("OK", null); // Missing a specific label

    System.out.println("Screen reader announces (Submit): " + submitButton.getScreenReaderAnnouncement());
    System.out.println("Screen reader announces (OK): " + okButton.getScreenReaderAnnouncement());
  }
}

Visuals: Contrast & Scale

Good visual design is also key for accessibility:

  • Color Contrast: Ensure sufficient contrast between text and background colors. This helps users with low vision or color blindness.
  • Dynamic Type/Font Scaling: Allow users to adjust font sizes. Respect system-wide font size settings so your app adapts to user preferences.

Tools are available to check color contrast ratios, ensuring your designs meet accessibility standards.

Touch Targets & Interaction

For users with motor impairments or those simply using a device one-handed, the size of interactive elements matters.

  • Minimum Touch Target Size: Aim for a minimum touch target size of 48x48 device-independent pixels (DIPs) on both iOS and Android.
  • Clear Feedback: Provide visual feedback when an element is tapped (e.g., a ripple effect or highlight).

This improves usability for everyone, not just those with specific needs.

Understanding Internationalization (I18n)

Internationalization (I18n) is the process of designing and developing an app in a way that makes it easy to adapt to various languages and regional differences without requiring engineering changes to the source code.

This means your app can be translated into multiple languages (localization) and handle different date formats, currencies, and text directions.

Localizing Your Text Strings

The core of internationalization for text is extracting all user-facing strings into separate resource files. Instead of hardcoding text, you use a 'key' that points to the correct translation for the user's selected language.

This approach makes it simple to add new languages or update existing translations without touching your app's code logic.

See how it works conceptually:

import java.util.HashMap;
import java.util.Map;

public class LocalizationDemo {
  // Simulate language resource bundles
  private static final Map<String, Map<String, String>> strings = new HashMap<>();

  static {
    // English strings
    Map<String, String> enStrings = new HashMap<>();
    enStrings.put("greeting", "Hello!");
    enStrings.put("welcome_message", "Welcome to our app.");
    strings.put("en", enStrings);

    // Spanish strings
    Map<String, String> esStrings = new HashMap<>();
    esStrings.put("greeting", "¡Hola!");
    esStrings.put("welcome_message", "Bienvenido a nuestra aplicación.");
    strings.put("es", esStrings);
  }

  // Method to get a localized string
  public static String getString(String locale, String key) {
    Map<String, String> localeStrings = strings.get(locale);
    if (localeStrings != null) {
      return localeStrings.getOrDefault(key, "MISSING_STRING_FOR_" + key);
    }
    return "UNKNOWN_LOCALE";
  }

  public static void main(String[] args) {
    String currentLocale = "en"; // Imagine this comes from device settings
    System.out.println("English Greeting: " + getString(currentLocale, "greeting"));
    System.out.println("English Welcome: " + getString(currentLocale, "welcome_message"));

    currentLocale = "es"; // Change locale
    System.out.println("Spanish Greeting: " + getString(currentLocale, "greeting"));
    System.out.println("Spanish Welcome: " + getString(currentLocale, "welcome_message"));
  }
}

Adapting Dates, Numbers & Currencies

Beyond text, different cultures format dates, times, numbers, and currencies uniquely:

  • Dates: MM/DD/YYYY (US) vs. DD/MM/YYYY (EU).
  • Numbers: Decimal separators (. vs. ,) and thousands separators vary.
  • Currencies: Symbol placement ($100 vs. 100€) and decimal precision differ.

Most mobile platforms provide APIs to automatically format these values based on the user's device locale.

Layouts for All Languages

Some languages, like Arabic and Hebrew, are written and read from right-to-left (RTL). Your app's UI needs to adapt to this.

  • Flexible Layouts: Use flexible layouts that can automatically mirror for RTL languages.
  • Icons & Images: Ensure icons and images that imply direction (e.g., an arrow pointing forward) are also mirrored.

Designing with flexibility from the start avoids costly rework later.

Accessibility & I18n Check

Which of the following are important considerations when developing for accessibility and internationalization?

Your App, For Everyone

You've learned how making your app accessible (A11y) and ready for internationalization (I18n) expands your reach and improves the user experience for everyone.

  • Use accessibility labels for screen readers.
  • Ensure good color contrast and dynamic text sizing.
  • Provide large enough touch targets.
  • Externalize all strings for localization.
  • Format dates, numbers, and currencies based on locale.
  • Design flexible layouts for RTL languages.

By integrating these principles from the start, you build a truly inclusive mobile product.

Часто задаваемые вопросы

Урок «Доступность и интернационализация» бесплатный?

Да — полный текст урока «Доступность и интернационализация» бесплатно доступен здесь в веб-версии. Чтобы практиковать его интерактивно (встроенный редактор кода и ИИ-репетитор 24/7) и разблокировать остальной курс Indie Hacker Mobile Apps, подпишись на CoddyKit PRO. Курс Indie Hacker Mobile Apps содержит 4 уроков всего.

Чему я научусь в уроке «Доступность и интернационализация»?

Сделайте приложение удобным для всех, добавив специальные возможности и подготовив его к работе на разных языках и в различных регионах. Ты практикуешь Indie Hacker Mobile Apps с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.

Нужен ли мне опыт, чтобы начать Indie Hacker Mobile Apps?

Предыдущий опыт не требуется. Indie Hacker Mobile Apps на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 2 из 4.

Сколько времени занимает урок «Доступность и интернационализация»?

Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.

Можно ли писать и запускать код в этом уроке Indie Hacker Mobile Apps?

Да. Каждый урок Indie Hacker Mobile Apps включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.

Все уроки этого курса

  1. Расширенные компоненты интерфейса и анимации
  2. Доступность и интернационализация
  3. Обратная связь пользователей и основы A/B-тестирования
  4. Проектирование производительности и воспринимаемой скорости
← Назад к Indie Hacker Mobile Apps