Skip to content

update i18n script && fix Korean display bug#146

Merged
lihuanhuan merged 2 commits intoOneKeyHQ:masterfrom
lihuanhuan:classic1s
Jun 6, 2025
Merged

update i18n script && fix Korean display bug#146
lihuanhuan merged 2 commits intoOneKeyHQ:masterfrom
lihuanhuan:classic1s

Conversation

@lihuanhuan
Copy link
Contributor

@lihuanhuan lihuanhuan commented Jun 4, 2025

Summary by CodeRabbit

  • New Features
    • Improved language handling with clearer language identifiers and unified language item management across the interface.
  • Bug Fixes
    • Corrected typographical errors and improved clarity in several language translations and UI prompts, including passphrase confirmation text in multiple languages.
  • Refactor
    • Simplified internal language selection and localization logic for more consistent and maintainable behavior.
  • Style
    • Enhanced readability of language data structures and improved display alignment for multilingual UI elements.
  • Chores
    • Automated generation of language header and source files for easier localization updates.

@coderabbitai
Copy link

coderabbitai bot commented Jun 4, 2025

Walkthrough

This update standardizes language handling in the firmware. It replaces variable-based language counts with fixed constants, introduces clear enums for languages, and centralizes language string access through a unified table. Several UI strings are updated to say "Confirm Passphrase" instead of "Use This Passphrase?" across all supported languages. The code also gains new scripts to auto-generate language headers and sources.

Changes

File(s) Change Summary
legacy/firmware/config.c, config_emu.c, layout2.c Replaced langs_len with I18N_LANGUAGE_ITEMS for language iteration and indexing.
legacy/firmware/gettext.c Refactored to use a language table lookup instead of a switch-case for language strings.
legacy/firmware/i18n/i18n.c, i18n.h Removed langs_len, added constants and enums for languages, introduced languages_table array.
legacy/firmware/i18n/keys.h Updated comment for a passphrase macro.
legacy/firmware/i18n/locales/*.inc (all locales) Changed "Use This Passphrase?" to "Confirm Passphrase" in all supported languages.
legacy/firmware/menu_core.c Changed loop boundary in _gettext to I18N_ITEMS_COUNT.
legacy/firmware/trezor.c Moved font_init() earlier in the main() initialization sequence.
legacy/script/i18n.py Added functions to auto-generate language header and source files for C.
legacy/firmware/fsm_msg_nostr.h Changed public key description construction to use localized string and bracket replacement.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Firmware
    participant LanguageTable

    User->>Firmware: Selects or sets language
    Firmware->>LanguageTable: Looks up language index/strings using I18N_LANGUAGE_ITEMS and enums
    LanguageTable-->>Firmware: Returns localized string
    Firmware-->>User: Displays correct localized message (e.g., "Confirm Passphrase")
Loading
sequenceDiagram
    participant Script
    participant i18n.py
    participant HeaderFile
    participant SourceFile

    Script->>i18n.py: Run localization export
    i18n.py->>HeaderFile: Generate i18n.h with enums, constants, externs
    i18n.py->>SourceFile: Generate i18n.c with language arrays and table
Loading

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Pylint (3.3.7)
legacy/script/i18n.py

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 03ddcce and 2a0bbde.

📒 Files selected for processing (13)
  • legacy/firmware/fsm_msg_nostr.h (1 hunks)
  • legacy/firmware/i18n/keys.h (1 hunks)
  • legacy/firmware/i18n/locales/de.inc (1 hunks)
  • legacy/firmware/i18n/locales/en.inc (1 hunks)
  • legacy/firmware/i18n/locales/es.inc (1 hunks)
  • legacy/firmware/i18n/locales/ja.inc (1 hunks)
  • legacy/firmware/i18n/locales/ko_kr.inc (1 hunks)
  • legacy/firmware/i18n/locales/pt_br.inc (1 hunks)
  • legacy/firmware/i18n/locales/zh_cn.inc (2 hunks)
  • legacy/firmware/i18n/locales/zh_tw.inc (1 hunks)
  • legacy/firmware/layout2.c (4 hunks)
  • legacy/firmware/trezor.c (1 hunks)
  • legacy/script/i18n.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
legacy/firmware/fsm_msg_nostr.h (2)
legacy/util.c (1)
  • bracket_replace (103-126)
legacy/util.h (1)
  • bracket_replace (81-81)
legacy/firmware/trezor.c (2)
legacy/firmware/font_ex.c (1)
  • font_init (101-111)
legacy/firmware/font_ex.h (1)
  • font_init (34-34)
🪛 Ruff (0.11.9)
legacy/script/i18n.py

48-48: Missing return type annotation for public function write_i18n_header

Add return type annotation: None

(ANN201)


48-48: Missing type annotation for function argument languages_map

(ANN001)


48-48: Unused function argument: languages_map

(ARG001)


48-48: Missing type annotation for function argument items_count

(ANN001)


74-74: Trailing comma missing

Add trailing comma

(COM812)


86-86: Trailing comma missing

Add trailing comma

(COM812)


93-93: Missing return type annotation for public function write_i18n_source

Add return type annotation: None

(ANN201)


93-93: Missing type annotation for function argument languages_map

(ANN001)


93-93: Unused function argument: languages_map

(ARG001)


126-126: Trailing comma missing

Add trailing comma

(COM812)


137-137: Trailing comma missing

Add trailing comma

(COM812)


148-148: Trailing comma missing

Add trailing comma

(COM812)


159-159: Trailing comma missing

Add trailing comma

(COM812)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Style check
  • GitHub Check: Gen check
  • GitHub Check: Defs check
🔇 Additional comments (12)
legacy/firmware/i18n/locales/zh_tw.inc (1)

145-145: LGTM! Consistent UI text update.

The passphrase prompt change from question to confirmation aligns with the broader i18n improvements.

legacy/firmware/i18n/locales/es.inc (1)

145-145: LGTM! Coordinated localization improvement.

The Spanish passphrase confirmation text update matches the standardization across all language files.

legacy/firmware/trezor.c (1)

292-292: Good improvement to initialization order.

Moving font_init() earlier ensures fonts are ready before UI layout operations. This change supports the i18n improvements.

legacy/firmware/i18n/locales/ja.inc (1)

145-145: Japanese translation properly updated.

The change from "Passphrase 使いますか?" to "パスフレーズを確認" correctly shifts from question form to confirmation statement. Translation looks accurate.

legacy/firmware/i18n/locales/pt_br.inc (1)

145-145: Portuguese translation correctly updated.

The change from "Usar esta Passphrase?" to "Confirmar Passphrase" properly shifts from question to confirmation. Translation is accurate for Brazilian Portuguese.

legacy/firmware/i18n/locales/en.inc (1)

145-145: Good UX improvement!

Changing from question to statement makes the action clearer. "Confirm Passphrase" is more direct than "Use This Passphrase?".

legacy/firmware/i18n/locales/de.inc (1)

145-145: Accurate German translation!

"Passphrase bestätigen" correctly translates the new English text. The change maintains consistency across languages.

legacy/firmware/i18n/locales/ko_kr.inc (1)

145-145: Consistent Korean translation!

"Passphrase 확인" correctly translates the improved English text. The change from formal question to direct statement aligns with better UX patterns.

legacy/firmware/i18n/locales/zh_cn.inc (2)

145-145: Consistent Chinese translation!

"确认 Passphrase" correctly translates the improved English text. Maintains consistency with the UX improvement across all languages.


261-261: Good typographical fix!

The character correction in the PIN input instructions improves text clarity and correctness.

legacy/firmware/layout2.c (2)

485-485: Consistent use of language constant

Good - using I18N_LANGUAGE_ITEMS constant here matches the pattern from above. This unifies the language count handling across the codebase.


640-687: Excellent refactoring with language enums

This is a significant improvement! Replacing magic numbers with named enum constants like I18N_LANG_EN, I18N_LANG_ZH_CN, etc. makes the code much more readable and maintainable.

The addition of Korean language support (I18N_LANG_KO_KR) with proper bitmap positioning shows careful attention to internationalization.

The switch from hardcoded language IDs to semantic enum values eliminates a major source of potential bugs.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or Summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 6a500f4 and c84a072.

📒 Files selected for processing (18)
  • legacy/firmware/config.c (2 hunks)
  • legacy/firmware/config_emu.c (2 hunks)
  • legacy/firmware/gettext.c (1 hunks)
  • legacy/firmware/i18n/i18n.c (2 hunks)
  • legacy/firmware/i18n/i18n.h (2 hunks)
  • legacy/firmware/i18n/keys.h (1 hunks)
  • legacy/firmware/i18n/locales/de.inc (1 hunks)
  • legacy/firmware/i18n/locales/en.inc (1 hunks)
  • legacy/firmware/i18n/locales/es.inc (1 hunks)
  • legacy/firmware/i18n/locales/ja.inc (1 hunks)
  • legacy/firmware/i18n/locales/ko_kr.inc (1 hunks)
  • legacy/firmware/i18n/locales/pt_br.inc (1 hunks)
  • legacy/firmware/i18n/locales/zh_cn.inc (2 hunks)
  • legacy/firmware/i18n/locales/zh_tw.inc (1 hunks)
  • legacy/firmware/layout2.c (4 hunks)
  • legacy/firmware/menu_core.c (1 hunks)
  • legacy/firmware/trezor.c (1 hunks)
  • legacy/script/i18n.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
legacy/firmware/trezor.c (2)
legacy/firmware/font_ex.h (1)
  • font_init (34-34)
legacy/firmware/font_ex.c (1)
  • font_init (101-111)
🪛 Ruff (0.11.9)
legacy/script/i18n.py

48-48: Missing return type annotation for public function write_i18n_header

Add return type annotation: None

(ANN201)


48-48: Missing type annotation for function argument languages_map

(ANN001)


48-48: Unused function argument: languages_map

(ARG001)


48-48: Missing type annotation for function argument items_count

(ANN001)


89-89: Missing return type annotation for public function write_i18n_source

Add return type annotation: None

(ANN201)


89-89: Missing type annotation for function argument languages_map

(ANN001)


89-89: Unused function argument: languages_map

(ARG001)

🪛 GitHub Actions: Prebuild checks
legacy/script/i18n.py

[warning] 62-62: Flake8: W293 blank line contains whitespace


[warning] 66-66: Flake8: W293 blank line contains whitespace


[warning] 74-74: Flake8: W293 blank line contains whitespace


[warning] 77-77: Flake8: W293 blank line contains whitespace


[warning] 84-84: Flake8: W293 blank line contains whitespace


[warning] 112-112: Flake8: W293 blank line contains whitespace


[warning] 116-116: Flake8: W293 blank line contains whitespace


[warning] 122-122: Flake8: W293 blank line contains whitespace


[warning] 126-126: Flake8: W293 blank line contains whitespace


[warning] 131-131: Flake8: W293 blank line contains whitespace


[warning] 135-135: Flake8: W293 blank line contains whitespace


[warning] 140-140: Flake8: W293 blank line contains whitespace


[warning] 143-143: Flake8: W293 blank line contains whitespace


[warning] 149-149: Flake8: W293 blank line contains whitespace

🔇 Additional comments (26)
legacy/firmware/i18n/locales/zh_tw.inc (1)

145-145: LGTM! Improved UI text clarity.

The change from a question to a confirmation statement makes the interface more direct and user-friendly. This aligns well with the broader i18n standardization effort.

legacy/firmware/i18n/locales/es.inc (1)

145-145: LGTM! Clearer user interface text.

Changing from "¿Usar este passphrase?" to "Confirmar Passphrase" makes the action more direct and clear. Great improvement for user experience consistency.

legacy/firmware/i18n/keys.h (1)

312-312: LGTM! Comment updated to match UI text.

Good practice to keep macro comments in sync with the actual localized strings. This maintains consistency with the passphrase prompt changes across all language files.

legacy/firmware/menu_core.c (1)

26-32:

Details

✅ Verification successful

Validate loop boundary update
The loop now uses I18N_ITEMS_COUNT. Ensure the languages_en[] array length matches this constant.


🏁 Script executed:

#!/bin/bash
# Count entries in the English locale
entries=$(grep -c '^\s*"' legacy/firmware/i18n/locales/en.inc)
# Extract the defined item count
count=$(grep -R "#define I18N_ITEMS_COUNT" legacy/firmware/i18n/i18n.h | awk '{print $3}')
echo "entries=$entries, I18N_ITEMS_COUNT=$count"

Length of output: 243


Loop boundary is correct
We counted 383 entries in locales/en.inc and I18N_ITEMS_COUNT is 383. The loop boundary matches the array length—no change needed.

legacy/firmware/trezor.c (1)

291-293: Ensure font init happens before UI render
Moving font_init() ahead of layoutHome() and usbInit() loads fonts early. Good fix.

legacy/firmware/i18n/locales/ja.inc (1)

145-145: Update Japanese passphrase prompt
Changed to “パスフレーズを確認” to match the new confirmation style.

legacy/firmware/i18n/locales/pt_br.inc (1)

145-145: Update PT-BR passphrase prompt
Replaced question with “Confirmar Passphrase” for consistency.

legacy/firmware/i18n/locales/en.inc (1)

145-145: Standardize English passphrase text
Switched from a question to “Confirm Passphrase”. Clearer intent.

legacy/firmware/i18n/locales/ko_kr.inc (1)

145-145: LGTM! UI text improvement.

The change from question format to confirmation format aligns with the broader standardization effort across all language files. This improves UI consistency.

legacy/firmware/i18n/locales/de.inc (1)

145-145: LGTM! Consistent with other language updates.

The German translation correctly changes from question format to confirmation format, matching the standardization pattern applied across all locale files.

legacy/firmware/config.c (2)

286-286: Good refactoring to use constant.

Replacing langs_len with I18N_LANGUAGE_ITEMS improves consistency and aligns with the i18n system refactoring. The constant-based approach is more maintainable.


397-397: Consistent with refactoring pattern.

Same improvement as the previous loop - using the constant instead of variable provides better consistency across the codebase.

legacy/firmware/config_emu.c (2)

693-693: LGTM! Consistent with config.c changes.

The constant-based approach matches the refactoring in the main config file and maintains consistency between emulator and hardware implementations.


934-934: Good consistency across implementations.

This change maintains the same pattern as config.c, ensuring both emulator and hardware configs use the standardized constant for language iteration.

legacy/firmware/i18n/locales/zh_cn.inc (2)

145-145: LGTM! Standardized passphrase prompt.

The change from "使用此 Passphrase?" to "确认 Passphrase" aligns with UI standardization across languages. Good consistency improvement.


261-261: Good fix for character display issue.

Replaced incorrect vertical bar character "|" with proper Chinese character "键". This likely fixes display problems on certain devices.

legacy/firmware/gettext.c (1)

14-17: Excellent refactoring! Simplified language lookup.

Replaced complex switch-case with clean table lookup. Bounds checking with I18N_LANGUAGE_ITEMS prevents array overflows. Much more maintainable.

legacy/firmware/i18n/i18n.c (2)

5-25: Great readability improvement!

Multi-line array initialization is much clearer than compact format. Easy to read and maintain.


36-45: Smart centralization of language data.

The languages_table array provides unified access to all language strings. Clean design that simplifies the gettextX function.

legacy/firmware/i18n/i18n.h (3)

8-9: Good use of fixed constants.

Replacing variable counts with fixed constants makes the system more predictable and easier to reason about.


11-20: Excellent enum design.

Explicit integer values ensure correct indexing into languages_table. Type safety bonus for language identifiers.


34-34: Proper external declaration.

Matches the languages_table definition in i18n.c. Enables centralized language access across the codebase.

legacy/firmware/layout2.c (4)

469-476: LGTM - Language count standardization looks good.

The replacement of langs_len with I18N_LANGUAGE_ITEMS constant makes the code more maintainable and aligns with the standardization mentioned in the summary.


485-485: Consistent usage of the new constant.

Good - this maintains consistency with the other changes in the function.


3640-3687: Language enum migration looks solid, including Korean support.

The switch from numeric indices to enum constants (I18N_LANG_EN, I18N_LANG_ZH_CN, etc.) improves code readability. The addition of I18N_LANG_KO_KR case addresses the Korean display bug mentioned in the PR title. Bitmap positioning adjustments appear appropriate for different language text layouts.


2392-2392:

Details

❓ Verification inconclusive

Verify text rendering simplification doesn't break layout.

The function now draws text centered at a fixed position instead of handling multi-line splitting. Ensure this change doesn't cause text overflow or truncation issues.

Let me check if there are other usages of this function to understand the impact:


🏁 Script executed:

#!/bin/bash
# Description: Find usages of layoutTxConfirmPage to verify the text rendering change impact
# Expected: Should show where this function is called and what kind of text is passed

rg -A 3 -B 3 "layoutTxConfirmPage"

Length of output: 6323


Verify centered confirm-text won’t overflow

The new layoutTxConfirmPage uses a single oledDrawStringCenterAdapter at a fixed Y-position (21px). Make sure none of the strings passed ever exceed the display width or require wrapping. Review these call sites:

  • legacy/firmware/filecoin.c
  • legacy/firmware/polkadot.c
  • legacy/firmware/cosmos.c
  • legacy/firmware/algorand.c
  • legacy/firmware/ada.c
  • legacy/firmware/alephium/alph_layout.c
  • legacy/firmware/tron.c
  • legacy/firmware/ton_layout.c
  • legacy/firmware/layout2.c

If any data can be longer than the screen, either revert to multi-line handling (e.g. layoutPaginated) or add explicit breaks.

somebodyLi
somebodyLi previously approved these changes Jun 4, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between c84a072 and 03ddcce.

📒 Files selected for processing (12)
  • legacy/firmware/fsm_msg_nostr.h (1 hunks)
  • legacy/firmware/i18n/keys.h (1 hunks)
  • legacy/firmware/i18n/locales/de.inc (1 hunks)
  • legacy/firmware/i18n/locales/en.inc (1 hunks)
  • legacy/firmware/i18n/locales/es.inc (1 hunks)
  • legacy/firmware/i18n/locales/ja.inc (1 hunks)
  • legacy/firmware/i18n/locales/ko_kr.inc (1 hunks)
  • legacy/firmware/i18n/locales/pt_br.inc (1 hunks)
  • legacy/firmware/i18n/locales/zh_cn.inc (2 hunks)
  • legacy/firmware/i18n/locales/zh_tw.inc (1 hunks)
  • legacy/firmware/layout2.c (4 hunks)
  • legacy/firmware/trezor.c (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
legacy/firmware/trezor.c (2)
legacy/firmware/font_ex.c (1)
  • font_init (101-111)
legacy/firmware/font_ex.h (1)
  • font_init (34-34)
legacy/firmware/fsm_msg_nostr.h (2)
legacy/util.c (1)
  • bracket_replace (103-126)
legacy/util.h (1)
  • bracket_replace (81-81)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Gen check
  • GitHub Check: Style check
  • GitHub Check: Defs check
🔇 Additional comments (12)
legacy/firmware/i18n/locales/zh_tw.inc (1)

145-145: Consistent translation update. Traditional Chinese string now reads "確認 Passphrase", matching other locales.

legacy/firmware/i18n/locales/es.inc (1)

145-145: Spanish prompt updated correctly. Matches other locales’ "Confirm Passphrase".

legacy/firmware/trezor.c (1)

291-294: Initialize fonts before layout. Moving font_init() ahead of usbInit() ensures fonts are ready before UI rendering, aligning with updated i18n support.

legacy/firmware/i18n/locales/pt_br.inc (1)

145-145: Consistent Brazilian Portuguese update. Prompt now reads "Confirmar Passphrase", matching other locales.

legacy/firmware/i18n/locales/ja.inc (1)

145-145: LGTM! UI text standardization looks good.

The change from question format to confirmation statement improves UI consistency. Japanese translation uses appropriate katakana for the technical term.

legacy/firmware/i18n/locales/en.inc (1)

145-145: Excellent UI text improvement!

The change from "Use This Passphrase?" to "Confirm Passphrase" is clearer and more actionable. Sets good foundation for other language translations.

legacy/firmware/i18n/locales/de.inc (1)

145-145: German translation looks solid!

"Passphrase bestätigen" follows good localization practice by keeping the technical term in English. Consistent with the UI standardization effort.

legacy/firmware/i18n/locales/ko_kr.inc (1)

145-145: Perfect fix for the Korean display bug!

The change from long question format to concise "Passphrase 확인" likely resolves UI layout issues. Shorter text fits better in constrained UI space while maintaining clarity.

legacy/firmware/i18n/locales/zh_cn.inc (2)

145-145: Approve standardized passphrase terminology.

Good change! The shift from "使用此 Passphrase?" to "确认 Passphrase" aligns with the standardization across all language files.


261-261: Approve typo correction in PIN instruction.

Correct fix! Replacing "|" with "键" makes the PIN input instruction accurate and readable.

legacy/firmware/layout2.c (2)

485-488: Confirm boundary with constant
You replaced the old langs_len check with I18N_LANGUAGE_ITEMS - 1. Double-check that I18N_LANGUAGE_ITEMS truly matches the size of i18n_langs[] to avoid off-by-one issues.


3640-3690:

Details

❓ Verification inconclusive

Consolidate per-language icon coordinates
Each case in layoutInputDirection now hardcodes different bitmap coordinates. This duplication risks drift and makes adjustments hard. Consider centralizing these values in a small lookup table keyed by i18n_lang_t, then drive the oledDrawBitmap calls from that table. Also, manually test each locale to confirm the arrows render correctly.


Consolidate per-language icon coordinates
The switch in layoutInputDirection hardcodes X/Y values for each language. This duplicates logic and makes future tweaks error-prone. I recommend:

  • Define a small lookup table (e.g. struct array) keyed by i18n_lang_t holding up/down bitmap coordinates and any direction offsets
  • In layoutInputDirection, read from that table instead of inlining values
  • Call oledDrawBitmap using the table entries
  • Manually test every locale to verify correct arrow placement

This centralizes your data, cuts down on drift, and simplifies adjustments.

@lihuanhuan lihuanhuan merged commit 698e94b into OneKeyHQ:master Jun 6, 2025
6 of 8 checks passed
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.

3 participants