.opencode/skills/localization/SKILL.md
Properly work with localization in Android projects. Use this skill when adding new string resources, working with plurals, formatting dates and texts.
npx skillsauth add easydev991/Jetpack-WorkoutApp localizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Basic rules:
res/values/strings.xml (Russian) and res/values-en/strings.xml (English)name in lowercase with underscoresExample of adding a string:
<!-- res/values/strings.xml -->
<string name="welcome_message">Добро пожаловать!</string>
<!-- res/values-en/strings.xml -->
<string name="welcome_message">Welcome!</string>
Usage in code:
context.getString(R.string.welcome_message)
// or in XML
android:text="@string/welcome_message"
When to use:
Russian language rule:
one - 1, 21, 31, 41...few - 2-4, 22-24, 32-34...many - 0, 5-20, 25-30, 35-40...other - for all other cases (usually not used in Russian)Example:
<!-- res/values/strings.xml -->
<plurals name="days_count">
<item quantity="one">%d день</item>
<item quantity="few">%d дня</item>
<item quantity="many">%d дней</item>
<item quantity="other">%d дней</item>
</plurals>
<!-- res/values-en/strings.xml -->
<plurals name="days_count">
<item quantity="one">%d day</item>
<item quantity="other">%d days</item>
</plurals>
Usage in code:
val days = 5
val text = resources.getQuantityString(R.plurals.days_count, days, days)
// Result: "5 дней" (ru) or "5 days" (en)
Basic tools:
String.format() - for formatting strings with placeholdersMessageFormat - for complex formatting (if needed)DateFormat - for dates considering user localeString formatting example:
<!-- res/values/strings.xml -->
<string name="items_count_format">Найдено %d элементов</string>
<!-- res/values-en/strings.xml -->
<string name="items_count_format">Found %d items</string>
Usage in code:
val count = 42
val text = getString(R.string.items_count_format, count)
// Result: "Найдено 42 элементов"
Date formatting example:
val date = LocalDate.now()
val formatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)
val formattedDate = date.format(formatter)
// Result depends on device locale
Important rule: All logs in code are written in Russian regardless of app localization
// Correct
Log.e(TAG, "Ошибка загрузки данных: ${error.message}")
Log.i(TAG, "Загружено $count элементов")
// Incorrect
Log.e(TAG, "Error loading data: ${error.message}")
String grouping:
auth_, parks_, events_)Grouping example:
<!-- Authorization -->
<string name="auth_login">Войти</string>
<string name="auth_password">Пароль</string>
<string name="auth_forgot_password">Забыли пароль?</string>
<!-- Parks -->
<string name="parks_title">Площадки</string>
<string name="parks_empty">Нет площадок</string>
<string name="parks_filter">Фильтр</string>
Rules:
%1$s, %2$d) for strings with multiple substitutionsExample with multiple parameters:
<!-- res/values/strings.xml -->
<string name="user_profile">%1$s, %2$d лет</string>
<!-- res/values-en/strings.xml -->
<string name="user_profile">%1$s, %2$d years old</string>
Usage:
val name = "Иван"
val age = 25
val text = getString(R.string.user_profile, name, age)
// Result: "Иван, 25 лет"
Localized error messages:
<!-- Network errors -->
<string name="error_network">Ошибка сети. Проверьте подключение к интернету.</string>
<string name="error_timeout">Время ожидания истекло. Попробуйте еще раз.</string>
<!-- Authorization errors -->
<string name="error_invalid_credentials">Неверный логин или пароль</string>
<string name="error_unauthorized">Необходима авторизация</string>
<!-- Data errors -->
<string name="error_not_found">Данные не найдены</string>
<string name="error_invalid_data">Неверные данные</string>
Usage in code:
try {
loadData()
} catch (e: IOException) {
Log.e(TAG, "Ошибка сети: ${e.message}")
showError(getString(R.string.error_network))
}
res/values/strings.xml (Russian)res/values-en/strings.xml (English)name is unique and follows naming conventiontesting
Пиши тесты в андроид-проекте правильно. Используй этот навык при написании любых типов тестов (unit, integration, UI), тестировании бизнес-логики, сетевых функций и компонентов UI.
tools
Реализуй pull-to-refresh в Jetpack Compose с использованием Material 3 PullToRefreshBox. Используй этот навык при добавлении возможности обновления данных на экранах со списками или карточками.
tools
Правильно работай с локализацией в Android-проекте. Используй этот навык при добавлении новых строковых ресурсов, работе с plurals, форматировании дат и текстов.
tools
Блокировка UI контента экрана во время загрузки данных или выполнения асинхронных операций с отображением индикатора загрузки. Используй этот навык при разработке экранов с сетевыми запросами, операциями CRUD и других асинхронных действий.