Skip to content

Comments

fix: Add i18n support for setting-drawer component#4006

Open
miantalha45 wants to merge 6 commits intoapache:masterfrom
miantalha45:fix/setting-drawer-i18n-translation
Open

fix: Add i18n support for setting-drawer component#4006
miantalha45 wants to merge 6 commits intoapache:masterfrom
miantalha45:fix/setting-drawer-i18n-translation

Conversation

@miantalha45
Copy link

@miantalha45 miantalha45 commented Jan 26, 2026

Description

 Fixes the issue where the theme settings drawer displayed Chinese text even when the application language was set to English or other languages.

Changes

  • Created SettingDrawerI18nDirective to dynamically translate hardcoded Chinese text in the @delon/theme/setting-drawer component
  • The directive loads translations from i18n JSON files and replaces text in the DOM
  • Added translations for all setting drawer text in all supported languages (en-US, zh-CN, zh-TW, ja-JP, pt-BR)
  • Added comprehensive test cases for the directive
  • Registered the directive in LayoutModule and applied it to the setting-drawer component

Technical Details

  • The @delon/theme/setting-drawer component has hardcoded Chinese text that doesn't support i18n
  • Solution uses a custom Angular directive that:
    1. Dynamically loads all translations from i18n JSON files
    2. Builds a reverse mapping (text → translation key)
    3. Replaces text in the DOM when language changes
    4. Handles special cases like the info message that may be split across multiple text nodes

Testing

  • Added unit tests for the directive
  • Tested manually in the application with all supported languages
  • Verified text replacement works correctly for all setting drawer labels

Related Issue

Fixes #4004
image

- Created SettingDrawerI18nDirective to translate hardcoded Chinese text
- Dynamically loads translations from i18n JSON files
- Supports all languages: en-US, zh-CN, zh-TW, ja-JP, pt-BR
- Added comprehensive test cases
- Fixes issue where setting drawer showed Chinese text regardless of language setting
@Duansg
Copy link
Member

Duansg commented Jan 29, 2026

pls check ci

@tomsun28 tomsun28 requested a review from zqr10159 January 29, 2026 14:12
@miantalha45
Copy link
Author

@zqr10159 Please have a look into it.

@miantalha45
Copy link
Author

@tomsun28 Any update on this PR?

@miantalha45 miantalha45 requested a review from zqr10159 February 20, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] <title> Theme Settings Drawer Shows Chinese Text When Language is Set to English

5 participants