Skip to content

feat: add thousands separator support to Input component#10725

Draft
Kahnchan wants to merge 7 commits intoOneKeyHQ:xfrom
Kahnchan:feat/input-thousands-separator
Draft

feat: add thousands separator support to Input component#10725
Kahnchan wants to merge 7 commits intoOneKeyHQ:xfrom
Kahnchan:feat/input-thousands-separator

Conversation

@Kahnchan
Copy link
Contributor

@Kahnchan Kahnchan commented Mar 18, 2026

Summary

  • 千分位分隔符(opt-in):为 Input 组件新增 enableThousandsSeparator prop,启用后在输入过程中自动插入千分位符号,已应用于 Perp 交易面板的价格/数量输入及存取款金额输入
  • Locale 小数符号显示:所有 keyboardType="decimal-pad" / "number-pad" 的 input 自动将内部存储的 . 转换为当前 locale 的小数符号显示(如德语显示 ,),内部 raw value 不变
  • 欧洲 locale 小数输入修复:通过计数法区分千分位符号和用户输入的小数符号,避免德语(groupSep=.)、法语(groupSep=\u202F)等 locale 下小数符号被误判为千分位而丢失
  • 存取款弹窗:将"您将获得"行的 $ 前缀替换为 USDC 后缀

Locale 支持一览

Locale 小数符号 千分位符号 示例
de, es, id, it-IT, pt, pt-BR, vi , . 1.234.567,89
fr-FR , 窄空格 1 234 567,89
ru, uk-UA , 不换行空格 1 234 567,89
en, zh-CN/HK/TW, ja-JP, ko-KR, th-TH . , 1,234,567.89

Test plan

  • 英语 locale:价格/数量输入千分位显示为 ,,小数点为 .
  • 德语 locale:千分位显示为 .,小数点显示为 ,;按 ., 均可输入小数
  • 法语/俄语 locale:千分位为空格,小数点为 ,
  • 未加 enableThousandsSeparator 的旧 input 行为不变
  • 存取款弹窗"您将获得"显示 USDC 而非 $

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@revan-zhang
Copy link
Contributor

revan-zhang commented Mar 18, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

@sidmorizon sidmorizon enabled auto-merge (squash) March 18, 2026 08:28
@sidmorizon sidmorizon disabled auto-merge March 18, 2026 08:29
@sidmorizon
Copy link
Contributor

法语、德语区的用户有问题,看 devin 的评论

@limichange limichange marked this pull request as draft March 19, 2026 01:54
- Use locale-specific grouping and decimal separators from LOCALE_SEPARATORS
  instead of hardcoded commas, so German/French/etc. users see correct format
- Apply locale decimal display (e.g. ',' for de/fr) to all decimal-pad inputs,
  not only those with enableThousandsSeparator
- Fix European locale decimal entry: use separator count comparison to
  distinguish thousands-separator chars from user-typed decimal separators
  (e.g. German user pressing '.' on an English keyboard)
@Kahnchan
Copy link
Contributor Author

法语、德语区的用户有问题,看 devin 的评论

我重新提了 PR,主要是两个功能改动:

  • Input 内小数符号在不同语言下的展示。这个是之前就存在的问题, 之前 Input 内的小数位全部用了 . ,现在改成针对语言区分小数符号展示。 对所有 keyboardType="decimal-pad"  或  number-pad 的 input 都生效,只改显示层。

  • 输入时展示千分位。会根据不同语言展示千分位。只在加了 enableThousandsSeparator 的 input 生效,不影响其他 input。

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