搜索

PythonReactSEOPDF
GitHub Skill

translate

Add a new translatable string to all locale files (English, Italian, Spanish, Catalan). Use when adding user-visible text to the app.

vide☆ 41 仓库 Stars5 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Translate Skill

Add a new string resource to all 4 locale files.

String Resource Files

Locale File
English app/src/main/res/values/strings.xml
Italian app/src/main/res/values-it/strings.xml
Spanish app/src/main/res/values-es/strings.xml
Catalan app/src/main/res/values-ca/strings.xml

Process

  1. Ask the user for:

    • The string name (use snake_case, e.g., drive_details_title)
    • The English text
    • Context for translators (optional but recommended)
  2. Generate translations for Italian, Spanish, and Catalan

  3. Add to all 4 files with an XML comment for context:

    <!-- Context: Shown as the title of the drive details screen -->
    <string name="drive_details_title">Drive Details</string>
    

Guidelines

  • Use snake_case for string names (e.g., settings_title, drive_history)
  • Add XML comments above strings to provide context for translators
  • Technical terms like AC, DC, kW, kWh should NOT be translated
  • Format specifiers (%s, %d, %1$s) must be preserved in translations
  • Keep translations natural - don't be overly literal

String with Parameters

For strings with parameters, use positional format specifiers:

<string name="distance_km">%1$d km away</string>

In Kotlin:

stringResource(R.string.distance_km, distance)

Plurals

For quantity strings, use plurals:

<plurals name="days_count">
    <item quantity="one">%d day</item>
    <item quantity="other">%d days</item>
</plurals>

After Adding Strings

Remind the user to use stringResource(R.string.xxx) in Compose code:

Text(stringResource(R.string.drive_details_title))

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-02-04
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!