Skip to content

feat(i18n)/add main languages support#635

Open
Namelessman-Tom wants to merge 7 commits intogoogle-ai-edge:mainfrom
Namelessman-Tom:feat(i18n)/add-main-languages-support
Open

feat(i18n)/add main languages support#635
Namelessman-Tom wants to merge 7 commits intogoogle-ai-edge:mainfrom
Namelessman-Tom:feat(i18n)/add-main-languages-support

Conversation

@Namelessman-Tom
Copy link
Copy Markdown

The feat(i18n) branch aims to implement internationalization for the main languages of the application in this repository.

In this PR, we have accomplished the following:

  • Reviewed almost all files and migrated hardcoded text strings used for Text components or UI purposes to string.xml (added 200+ lines), facilitating future work
  • Prioritized support for languages with high demand in the Issues (Chinese) (values-zh/string.xml), implementing Chinese translations for the app's UI text
  • Verified that the Chinese translations match the original English meaning to avoid ambiguity from words with multiple meanings
  • Conducted a complete on-device test run, covering as many interfaces and scenarios as possible to ensure the coverage and accuracy of the internationalization work

It's worth noting that to cover all places that should be internationalized as completely as possible and to facilitate internationalization work, we had to first migrate strings that were originally hardcoded in the code. This resulted in modifications to multiple code locations rather than elegantly adding just a string.xml file. Although this work barely changed any code logic or functionality (only modifying to stringResource calls and context.getString calls), this may cause many small-scale impacts to other contributors' workspaces in the repository. However, for the sake of standardization and maintainability, such changes are worthwhile and important.

This PR only added support for Chinese, but has laid the foundation for the project's internationalization. Contributors are welcome to continue internationalization work on this branch:

  • Despite our thorough review, there may still be hardcoded strings in the code that were overlooked but should be migrated
  • Internationalization of relevant fields in model_allowlist.json, which requires program support for loading files in corresponding languages or other localization solutions
  • Support for other languages

1 2 3
4 5 6
7 8 9
10 11 12
13

…anslations

- Migrate all hardcoded UI strings to string resources for internationalization
- Add Chinese (zh) translations for all new string resources
- Update 14 Kotlin files to use stringResource() instead of hardcoded strings

New string resources added:
- GM4 related: promo_gm4_title, promo_gm4_content, gm4_intro_*, gm4_try_today, etc.
- Error messages: error_unsupported_file_type, error_unsupported_model_type, error_web_only_model, etc.
- UI labels: retry, read_more, import_model, view_licenses, clear_history_*, etc.
- Dialog texts: delete_script_confirmation, live_camera_session_ended, etc.

Files modified:
- HomeScreen.kt: GM4 intro texts, error dialogs, feature labels
- ErrorDialog.kt: Dialog title and button
- PromoBannerGm4.kt: Banner title, content and buttons
- ModelImportDialog.kt: Cancel and Import buttons
- GlobalModelManager.kt: Error dialogs
- PromptTemplatesPanel.kt: Placeholder text
- SettingsDialog.kt: Buttons and labels
- TextInputHistorySheet.kt: Clear history dialog
- MessageInputText.kt: Menu items
- DownloadAndTryButton.kt: Error dialogs
- ChatView.kt: Session ended message
- AddOrEditSkillBottomSheet.kt: Delete confirmation dialog
- SkillTesterBottomSheet.kt: Input field labels
- ExampleCustomTaskScreen.kt: Text color label

This change enables proper internationalization support and makes the app ready for additional language translations.
Migrate rest of hardcoded UI strings to string resource files for better internationalization support. This change enables easier maintenance and future localization efforts.

Changes:
- Add 20+ new string resources in values/strings.xml
- Add Chinese translations in values-zh/strings.xml
- Replace hardcoded strings with stringResource() calls in:
  * SettingsDialog.kt (settings, theme, token management)
  * ModelImportDialog.kt (import dialog titles)
  * GlobalModelManager.kt (import messages, error messages)
  * PromoScreenGm4.kt (Gemma 4 promo content)
  * HomeScreen.kt (model count labels)
  * ModelList.kt (API documentation links)
  * NewReleaseNotification.kt (release notification)
  * MessageInputText.kt (camera action)
  * ConfigDialog.kt (cancel button)
  * GalleryAppTopBar.kt (done button)
Migrate remaining hardcoded UI strings to string resource files for better internationalization support. This change enables easier maintenance and future localization efforts.

Changes:
- Add 60+ new string resources in values/strings.xml
- Add Chinese translations in values-zh/strings.xml
- Replace hardcoded strings with stringResource() calls in:
  * AgentChatScreen.kt (agent skills description with link)
  * GemmaTermsOfUseDialog.kt (Gemma ToS content with link)
  * MobileActionsChallengeDialog.kt (instructions with bold text and link)
  * BenchmarkResultsViewer.kt (benchmark labels and units)
  * ConfigDialog.kt (localized label helper function)
- Add labelResId field to ConfigKey and SkillTryOutChip data classes
- Update all ConfigKeys with string resource IDs for localized display
- Update ExampleCustomTaskScreen.kt with localized config labels
@Namelessman-Tom
Copy link
Copy Markdown
Author

#602 #626 #627 #565

@ldh-star
Copy link
Copy Markdown

ldh-star commented Apr 9, 2026

这笔代码提交我拉下来试了一下发现有编译报错,应该是有本地改动忘记提交了
Clipboard_Screenshot_1775705403
R.string.aicore_image_limit_message
R.string.aicore_access_panel_title
R.string.askimage_emptystate_content_aicore
这几个引用都找不到对应实现

@Namelessman-Tom
Copy link
Copy Markdown
Author

这笔代码提交我拉下来试了一下发现有编译报错,应该是有本地改动忘记提交了 Clipboard_Screenshot_1775705403 R.string.aicore_image_limit_message R.string.aicore_access_panel_title R.string.askimage_emptystate_content_aicore 这几个引用都找不到对应实现

仓库新的提交中增加了字符串引用,我没有留意到而错误地应用了我的版本来解决冲突,导致缺少字符串资源。现在已解决,你可以再重新构建一下。

@Namelessman-Tom
Copy link
Copy Markdown
Author

Namelessman-Tom commented Apr 10, 2026

A community version with Chinese support was released in Release 1.0.11-i18n-community

@dpknag dpknag mentioned this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants