Skip to content

fix(a11y): fix table header is empty and add localization support #904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

aojunhao123
Copy link
Contributor

@aojunhao123 aojunhao123 commented Jan 24, 2025

空表头单元格影响读屏器理解表格结构
顺便给读屏器内容添加了国际化支持

QQ_1737701389560

Summary by CodeRabbit

  • 无障碍性改进
    • 为日期面板中的空单元格和按钮添加了本地化的屏幕阅读器友好标签
    • 改进了各个面板的按钮可访问性,使用动态的本地化字符串替代静态标签
  • 本地化增强
    • 在多种语言的本地化文件中添加了“week”属性,提供对应语言的“周”翻译

Copy link

vercel bot commented Jan 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
picker ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 6, 2025 3:57pm

Copy link

coderabbitai bot commented Jan 24, 2025

"""

概述

演练

PickerPanel 组件中,多个子组件的无障碍性标签进行了修改。具体来说,DatePanelMonthPanelQuarterPanelYearPanelPanelHeader 组件中的按钮 aria-label 属性被更新为使用本地化字符串,替代了静态标签。此外,Locale 类型中新增了 week 属性,以支持多种语言的周的翻译。这些变更增强了组件的可访问性,确保了用户界面在不同语言环境下的一致性。

变更

文件 变更摘要
src/PickerPanel/DatePanel/index.tsx 修改标题单元格渲染,添加无障碍性标签
src/PickerPanel/MonthPanel/index.tsx 更新按钮的无障碍性标签为本地化字符串
src/PickerPanel/PanelHeader.tsx 更新多个按钮的无障碍性标签为本地化字符串
src/PickerPanel/QuarterPanel/index.tsx 更新按钮的无障碍性标签为本地化字符串
src/PickerPanel/YearPanel/index.tsx 更新按钮的无障碍性标签为本地化字符串
src/interface.tsx Locale 类型添加 week 属性
src/locale/*.ts 在多种语言的 locale 对象中添加 week 属性及其对应的翻译

诗歌

🐰 周的痕迹,悄然隐藏
无声标签,阅读器明白
可访问性,兔子的骄傲
代码如诗,轻轻飞翔
无障碍的美,静静绽放 🌈
"""

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.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/locale/tk_TK.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /.eslintrc.js
Error: Cannot find module '@umijs/fabric/dist/eslint'
Require stack:

  • /.eslintrc.js
  • /node_modules/.pnpm/@eslint[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/[email protected]/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/[email protected]/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/[email protected]/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:145:19)
    at Object. (/.eslintrc.js:2:21)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76da25a and 7660147.

📒 Files selected for processing (1)
  • src/locale/tk_TK.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/locale/tk_TK.ts

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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 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.

@aojunhao123
Copy link
Contributor Author

@afc163 大佬有空瞅瞅

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: 0

🧹 Nitpick comments (1)
src/PickerPanel/DatePanel/index.tsx (1)

101-107: 添加隐藏文本以改进可访问性非常不错。

此处通过在空表头中加入 “Week” 的隐藏文本,帮助屏幕阅读器获取有意义的提示,做法值得肯定。不过建议在多语言场景下,考虑使用本地化字符串并通过多语言包或配置来获取对应字符串,以满足国际化需求。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95528b8 and dcf600e.

⛔ Files ignored due to path filters (1)
  • tests/__snapshots__/panel.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • src/PickerPanel/DatePanel/index.tsx (1 hunks)

@aojunhao123
Copy link
Contributor Author

@afc163 大佬这个有空看看

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.47%. Comparing base (95528b8) to head (7660147).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #904   +/-   ##
=======================================
  Coverage   95.47%   95.47%           
=======================================
  Files          64       64           
  Lines        2740     2740           
  Branches      742      742           
=======================================
  Hits         2616     2616           
  Misses        121      121           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aojunhao123 aojunhao123 changed the title feat: improve a11y when table header is empty feat: improve a11y when table header is empty and add localization support Feb 6, 2025
@aojunhao123
Copy link
Contributor Author

@afc163 @yoyo837 @zombieJ

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: 1

🧹 Nitpick comments (1)
src/locale/zh_TW.ts (1)

14-14: 建议统一用字规范

注意到第14行使用了简体'周'而不是繁体'週'。建议修改以保持一致性。

-  weekSelect: '選擇周',
+  weekSelect: '選擇週',
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dcf600e and 76da25a.

⛔ Files ignored due to path filters (2)
  • tests/__snapshots__/panel.spec.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/range.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (77)
  • src/PickerPanel/DatePanel/index.tsx (3 hunks)
  • src/PickerPanel/MonthPanel/index.tsx (1 hunks)
  • src/PickerPanel/PanelHeader.tsx (4 hunks)
  • src/PickerPanel/QuarterPanel/index.tsx (1 hunks)
  • src/PickerPanel/YearPanel/index.tsx (1 hunks)
  • src/interface.tsx (1 hunks)
  • src/locale/am_ET.ts (1 hunks)
  • src/locale/ar_EG.ts (1 hunks)
  • src/locale/az_AZ.ts (1 hunks)
  • src/locale/bg_BG.ts (1 hunks)
  • src/locale/bn_BD.ts (1 hunks)
  • src/locale/by_BY.ts (1 hunks)
  • src/locale/ca_ES.ts (1 hunks)
  • src/locale/cs_CZ.ts (1 hunks)
  • src/locale/da_DK.ts (1 hunks)
  • src/locale/de_DE.ts (1 hunks)
  • src/locale/el_GR.ts (1 hunks)
  • src/locale/en_GB.ts (1 hunks)
  • src/locale/en_US.ts (1 hunks)
  • src/locale/es_ES.ts (1 hunks)
  • src/locale/es_MX.ts (1 hunks)
  • src/locale/et_EE.ts (1 hunks)
  • src/locale/eu_ES.ts (1 hunks)
  • src/locale/fa_IR.ts (1 hunks)
  • src/locale/fi_FI.ts (1 hunks)
  • src/locale/fr_BE.ts (1 hunks)
  • src/locale/fr_CA.ts (1 hunks)
  • src/locale/fr_FR.ts (1 hunks)
  • src/locale/ga_IE.ts (1 hunks)
  • src/locale/gl_ES.ts (1 hunks)
  • src/locale/he_IL.ts (1 hunks)
  • src/locale/hi_IN.ts (1 hunks)
  • src/locale/hr_HR.ts (1 hunks)
  • src/locale/hu_HU.ts (1 hunks)
  • src/locale/id_ID.ts (1 hunks)
  • src/locale/is_IS.ts (1 hunks)
  • src/locale/it_IT.ts (1 hunks)
  • src/locale/ja_JP.ts (1 hunks)
  • src/locale/ka_GE.ts (1 hunks)
  • src/locale/kk_KZ.ts (1 hunks)
  • src/locale/km_KH.ts (1 hunks)
  • src/locale/kmr_IQ.ts (1 hunks)
  • src/locale/kn_IN.ts (1 hunks)
  • src/locale/ko_KR.ts (1 hunks)
  • src/locale/lt_LT.ts (1 hunks)
  • src/locale/lv_LV.ts (1 hunks)
  • src/locale/mk_MK.ts (1 hunks)
  • src/locale/ml_IN.ts (1 hunks)
  • src/locale/mn_MN.ts (1 hunks)
  • src/locale/ms_MY.ts (1 hunks)
  • src/locale/my_MM.ts (1 hunks)
  • src/locale/nb_NO.ts (1 hunks)
  • src/locale/ne_NP.ts (1 hunks)
  • src/locale/nl_BE.ts (1 hunks)
  • src/locale/nl_NL.ts (1 hunks)
  • src/locale/pl_PL.ts (1 hunks)
  • src/locale/pt_BR.ts (1 hunks)
  • src/locale/pt_PT.ts (1 hunks)
  • src/locale/ro_RO.ts (1 hunks)
  • src/locale/ru_RU.ts (1 hunks)
  • src/locale/si_LK.ts (1 hunks)
  • src/locale/sk_SK.ts (1 hunks)
  • src/locale/sl_SI.ts (1 hunks)
  • src/locale/sr_Cyrl_RS.ts (1 hunks)
  • src/locale/sr_RS.ts (1 hunks)
  • src/locale/sv_SE.ts (1 hunks)
  • src/locale/ta_IN.ts (1 hunks)
  • src/locale/th_TH.ts (1 hunks)
  • src/locale/tk_TK.ts (1 hunks)
  • src/locale/tr_TR.ts (1 hunks)
  • src/locale/ug_CN.ts (1 hunks)
  • src/locale/uk_UA.ts (1 hunks)
  • src/locale/ur_PK.ts (1 hunks)
  • src/locale/uz_UZ.ts (1 hunks)
  • src/locale/vi_VN.ts (1 hunks)
  • src/locale/zh_CN.ts (1 hunks)
  • src/locale/zh_TW.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/locale/sl_SI.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/PickerPanel/DatePanel/index.tsx
🔇 Additional comments (74)
src/locale/zh_CN.ts (1)

15-15: 翻译准确且符合简体中文使用习惯!

'周'的翻译准确地表达了'week'的含义,并与文件中其他日期/时间相关的翻译保持一致。

src/locale/ko_KR.ts (1)

12-12: 韩语翻译准确!

'주'是'week'在韩语中的标准翻译,与文件中其他本地化内容保持一致。

src/locale/ja_JP.ts (1)

15-15: 日语翻译准确!

'週'是'week'在日语中的标准翻译,与文件中使用的正式日语风格相符。

src/locale/zh_TW.ts (1)

16-16: 繁体中文翻译准确!

'週'是'week'在繁体中文中的标准写法,符合台湾地区的用字习惯。

src/locale/am_ET.ts (1)

10-10: 代码看起来不错!

阿姆哈拉语的翻译正确且位置合适。

src/locale/he_IL.ts (1)

12-12: 代码看起来不错!

希伯来语的翻译正确且位置合适。

src/locale/da_DK.ts (1)

12-12: 代码看起来不错!建议验证在表头中的使用情况。

丹麦语的翻译正确且位置合适。由于这些更改是为了改善表格标题的可访问性,建议验证这些翻译在实际的表头中的显示效果。

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# 描述:验证DatePanel组件中week翻译的使用情况

# 搜索DatePanel组件中使用week翻译的代码
ast-grep --pattern 'locale.week' src/PickerPanel/DatePanel

Length of output: 122


验证结果:丹麦语“week”翻译在表头中的调用正常

  • src/PickerPanel/DatePanel/index.tsx 的第104行中发现 {locale.week} 的引用,表明翻译已被正确集成至表头组件中。

这个修改看起来没有问题,建议同时在 UI 层面上再确认一次实际显示效果。

src/locale/th_TH.ts (1)

12-12: 代码变更正确!

新增的泰语翻译 'สัปดาห์' 用于表格表头,有助于提高屏幕阅读器的可访问性。

src/locale/fa_IR.ts (1)

12-12: 代码变更正确!

新增的波斯语翻译 'هفته' 用于表格表头,有助于提高屏幕阅读器的可访问性。

src/locale/kmr_IQ.ts (1)

12-12: 代码变更正确!

新增的库尔德语翻译 'Sêbê' 用于表格表头,有助于提高屏幕阅读器的可访问性。

src/locale/sv_SE.ts (1)

12-12: 代码变更正确!

新增的瑞典语翻译 'Vecka' 用于表格表头,有助于提高屏幕阅读器的可访问性。

src/locale/en_GB.ts (1)

12-12: 代码变更正确!

为英式英语区域设置添加了"Week"翻译,这有助于提高表格标题的可访问性。

src/locale/ar_EG.ts (1)

12-12: 代码变更正确!

为阿拉伯语区域设置添加了"الأسبوع"(周)翻译,这有助于提高表格标题的可访问性。

src/locale/az_AZ.ts (1)

12-12: 代码变更正确!

为阿塞拜疆语区域设置添加了"Həftə"(周)翻译。该翻译与第17行的weekSelect属性中使用的翻译保持一致,这表明翻译是准确的。

src/locale/is_IS.ts (1)

12-12: 代码变更正确!

为冰岛语区域设置添加了"Vika"(周)翻译,这有助于提高表格标题的可访问性。

src/locale/hi_IN.ts (1)

12-12: 代码变更看起来不错!

新增的 'week' 属性翻译准确,符合印地语的语言习惯。这个改动有助于提高表格标题的可访问性。

src/locale/kk_KZ.ts (1)

12-12: 代码变更看起来不错!

新增的 'week' 属性翻译准确,符合哈萨克语的语言习惯。这个改动有助于提高表格标题的可访问性。

src/locale/bn_BD.ts (1)

12-12: 代码变更看起来不错!

新增的 'week' 属性翻译准确,符合孟加拉语的语言习惯。这个改动有助于提高表格标题的可访问性。

src/locale/et_EE.ts (1)

12-12: 代码变更看起来不错!

新增的 'week' 属性翻译准确,符合爱沙尼亚语的语言习惯。这个改动有助于提高表格标题的可访问性。

src/locale/vi_VN.ts (1)

12-12: 新增的 'week' 属性翻译正确且符合预期!

'Tuần' 是越南语中 "周" 的正确翻译,与现有的本地化内容保持一致。这个添加将改善表格标题的可访问性。

src/locale/pl_PL.ts (1)

12-12: 新增的 'week' 属性翻译正确且符合预期!

'Tydzień' 是波兰语中 "周" 的正确翻译,与现有的本地化内容保持一致。这个添加将改善表格标题的可访问性。

src/locale/bg_BG.ts (1)

12-12: 新增的 'week' 属性翻译正确且符合预期!

'Седмица' 是保加利亚语中 "周" 的正确翻译,与现有的本地化内容保持一致。这个添加将改善表格标题的可访问性。

src/locale/my_MM.ts (1)

12-12: 新增的 'week' 属性翻译正确且符合预期!

'အပတ်' 是缅甸语中 "周" 的正确翻译,与现有的本地化内容保持一致。这个添加将改善表格标题的可访问性。

src/locale/ca_ES.ts (1)

12-12: 新增的 'week' 翻译正确!

'Setmana' 是加泰罗尼亚语中 "周" 的正确翻译。这个改动提升了本地化支持。

src/locale/nl_BE.ts (1)

12-12: 新增的 'week' 翻译正确!

'Week' 是比利时荷兰语中 "周" 的正确翻译。这个改动与其他语言环境文件保持一致。

src/locale/nl_NL.ts (1)

12-12: 新增的 'week' 翻译正确!

'Week' 是荷兰语中 "周" 的正确翻译。这个改动与比利时荷兰语(nl_BE)的翻译保持一致。

src/locale/en_US.ts (1)

12-12: 新增的 'week' 翻译正确且改进了可访问性!

'Week' 是美式英语中 "周" 的正确翻译。这个改动不仅完善了本地化支持,还通过为空表头提供适当的标签改进了屏幕阅读器的可访问性。

src/locale/ms_MY.ts (1)

15-15: 代码变更看起来不错!

新增的 'Minggu' 翻译正确对应马来语中的"周"。这个改动有助于提高表格标题的可访问性。

src/locale/uz_UZ.ts (1)

12-12: 代码变更看起来不错!

新增的 'Xafta' 翻译正确对应乌兹别克语中的"周"。这个改动有助于提高表格标题的可访问性。

src/locale/cs_CZ.ts (1)

12-12: 代码变更看起来不错!

新增的 'Týden' 翻译正确对应捷克语中的"周"。这个改动有助于提高表格标题的可访问性。

src/locale/mk_MK.ts (1)

12-12: 代码变更看起来不错!

新增的 'Недела' 翻译正确对应马其顿语中的"周"。这个改动有助于提高表格标题的可访问性。

src/locale/gl_ES.ts (1)

12-12: 新增的本地化字符串符合加利西亚语规范!

新增的 'week' 属性值 'Semana' 正确反映了加利西亚语中"周"的表达方式。这个改动有助于提升表格表头的可访问性。

src/locale/es_ES.ts (1)

12-12: 新增的本地化字符串符合西班牙语规范!

新增的 'week' 属性值 'Semana' 正确反映了西班牙语中"周"的表达方式。这个改动与其他语言版本保持一致,有助于提升表格表头的可访问性。

src/locale/nb_NO.ts (1)

12-12: 新增的本地化字符串符合挪威语规范!

新增的 'week' 属性值 'Uke' 正确反映了挪威语中"周"的表达方式。这个改动与其他语言版本保持一致,有助于提升表格表头的可访问性。

src/locale/mn_MN.ts (1)

12-12: 新增的本地化字符串符合蒙古语规范!

新增的 'week' 属性值 'Долоо хоног' 正确反映了蒙古语中"周"的表达方式。这个改动与其他语言版本保持一致,有助于提升表格表头的可访问性。

建议:验证蒙古语翻译的准确性

为确保翻译的准确性,建议与蒙古语母语者确认此翻译。

✅ Verification successful

🌐 Web query:

What is the correct translation of "week" in Mongolian?

💡 Result:

The correct translation of "week" in Mongolian is **долоо хоног** (pronounced *doloo khonog*), which literally means "seven days"[7][9]. This term combines:

- **долоо** (*doloo*) = seven  
- **хоног** (*khonog*) = days  

This is the standard term used in modern Mongolian to refer to a 7-day week cycle[7][9]. The word appears consistently across multiple authoritative sources including linguistic references and translation dictionaries[7][9].

Citations:

- 1: https://www.youtube.com/watch?v=D39yqvnCdBE
- 2: https://glosbe.com/en/mn/Wednesday
- 3: https://juddsinmongolia.com/2022/11/17/days-of-the-week/
- 4: https://en.wikipedia.org/wiki/Weekday_names
- 5: https://www.youtube.com/watch?v=oESnN9CApNk
- 6: http://eye-of-tengri.blogspot.com/2015/09/mongolian-word-of-week-66_22.html
- 7: http://www.cjvlang.com/Dow/dowmon.html
- 8: http://eye-of-tengri.blogspot.com/2015/09/mongolian-word-of-week-66.html
- 9: https://glosbe.com/en/mn/week
- 10: http://translationinmongolia.blogspot.com/2016/05/literal-translations-days-weeks-and.html

确认:蒙古语“周”翻译正确

查询结果证明,蒙古语中“week”的标准表达为“долоо хоног”,与代码中的“Долоо хоног”完全匹配(仅存在首字母大小写的轻微差异,对界面文案一般影响不大)。建议如有疑虑,可进一步请蒙古语母语者确认。

  • 文件: src/locale/mn_MN.ts (第 12 行)
src/locale/ru_RU.ts (1)

12-12: 代码变更正确!

新增的 week 属性翻译准确,与其他本地化属性保持一致,有助于提高表格表头的可访问性。

src/locale/ka_GE.ts (1)

12-12: 代码变更正确!

新增的 week 属性翻译准确,与其他本地化属性保持一致,有助于提高表格表头的可访问性。

src/locale/kn_IN.ts (1)

12-12: 代码变更正确!

新增的 week 属性翻译准确,与其他本地化属性保持一致,有助于提高表格表头的可访问性。

src/locale/sr_RS.ts (1)

12-12: 代码变更正确!

新增的 week 属性翻译准确,与其他本地化属性保持一致,有助于提高表格表头的可访问性。

src/locale/sr_Cyrl_RS.ts (1)

12-12: 代码变更正确!

新增的塞尔维亚语(西里尔文)翻译 'Недеља' 准确表达了"周"的含义,这有助于提高屏幕阅读器的可访问性。

src/locale/uk_UA.ts (1)

12-12: 代码变更正确!

新增的乌克兰语翻译 'Тиждень' 准确表达了"周"的含义,这有助于提高屏幕阅读器的可访问性。

src/locale/ur_PK.ts (1)

12-12: 代码变更正确!

新增的乌尔都语翻译 'ہفتہ' 准确表达了"周"的含义,这有助于提高屏幕阅读器的可访问性。

src/locale/sk_SK.ts (1)

12-12: 代码变更正确!

新增的斯洛伐克语翻译 'Týždeň' 准确表达了"周"的含义,这有助于提高屏幕阅读器的可访问性。

src/locale/de_DE.ts (1)

12-12: 代码变更正确!

新增的德语翻译 'Woche' 准确表达了"周"的含义,这有助于提高表格标题的可访问性。

src/locale/si_LK.ts (1)

12-12: 代码变更正确!

新增的僧伽罗语翻译 'සතිය' 与现有的 weekSelect 翻译保持一致,确保了术语使用的统一性。

src/locale/es_MX.ts (1)

12-12: 代码变更正确!

新增的墨西哥西班牙语翻译 'Semana' 与现有的 weekSelect 翻译保持一致,确保了术语使用的统一性。

src/locale/fi_FI.ts (1)

12-12: 代码变更正确!

新增的芬兰语翻译 'Viikko' 准确表达了"周"的含义,这有助于提高表格标题的可访问性。

src/locale/it_IT.ts (1)

12-12: 意大利语翻译正确且符合规范!

'Settimana' 是意大利语中"周"的正确翻译,与文件中其他翻译保持一致的语言风格。

src/locale/el_GR.ts (1)

12-12: 希腊语翻译正确且符合规范!

'Εβδομάδα' 是希腊语中"周"的正确翻译,与文件中其他翻译保持一致的语言风格。

src/locale/ne_NP.ts (1)

12-12: 尼泊尔语翻译正确且符合规范!

'हप्ता' 是尼泊尔语中"周"的正确翻译,与文件中第17行的 weekSelect 翻译保持一致。

src/locale/ro_RO.ts (1)

12-12: 罗马尼亚语翻译正确且符合规范!

'Săptămână' 是罗马尼亚语中"周"的正确翻译,与文件中第17行的 weekSelect 翻译保持一致。

src/locale/lv_LV.ts (1)

12-12: 新增的 'week' 属性翻译准确!

'Nedēļa' 是拉脱维亚语中 "周" 的正确翻译,这个改动有助于提高表格标题的可访问性。

src/locale/by_BY.ts (1)

12-12: 新增的 'week' 属性翻译准确!

'Тыдзень' 是白俄罗斯语中 "周" 的正确翻译,这个改动与其他语言文件保持一致。

src/locale/fr_BE.ts (1)

12-12: 新增的 'week' 属性翻译准确!

'Semaine' 是法语中 "周" 的正确翻译,并且与其他法语区域(法国、加拿大)的翻译保持一致。

src/locale/id_ID.ts (1)

12-12: 建议确认 'week' 属性的翻译

'Minggu' 在印尼语中既可以表示 "周" 也可以表示 "星期天"。为避免混淆,建议考虑使用更明确的词语,如 'Pekan'。

src/locale/hr_HR.ts (1)

12-12: 新增的本地化字符串看起来不错!

新增的 week 属性及其克罗地亚语翻译 'Sedmica' 正确实现了。

src/locale/eu_ES.ts (1)

12-12: 巴斯克语翻译实现正确!

新增的 week 属性及其巴斯克语翻译 'Asteko' 正确实现了。

src/locale/fr_CA.ts (1)

12-12: 法语翻译保持一致性!

新增的 week 属性及其法语翻译 'Semaine' 与其他法语区域设置保持一致,实现正确。

src/locale/fr_FR.ts (1)

12-12: 法语翻译实现正确!

新增的 week 属性及其法语翻译 'Semaine' 正确实现了。

src/locale/km_KH.ts (1)

15-15: 新增的本地化字符串符合预期!

新增的 week 属性使用了正确的高棉语翻译 'សប្តាហ៍',这将改善表格标题的可访问性。

src/locale/lt_LT.ts (1)

12-12: 新增的本地化字符串符合预期!

新增的 week 属性使用了正确的立陶宛语翻译 'Savaitė',这将改善表格标题的可访问性。

src/locale/ta_IN.ts (1)

12-12: 新增的本地化字符串符合预期!

新增的 week 属性使用了正确的泰米尔语翻译 'வாரம்',这将改善表格标题的可访问性。

src/locale/ml_IN.ts (1)

12-12: 新增的本地化字符串符合预期!

新增的 week 属性使用了正确的马拉雅拉姆语翻译 'ആഴ്ച',这将改善表格标题的可访问性。

src/locale/ga_IE.ts (1)

12-12: 新增的本地化字符串看起来不错!

'seachtain' 是爱尔兰语中 "week" 的正确翻译。这个改动有助于提高表格标题的可访问性。

src/locale/tr_TR.ts (1)

12-12: 新增的本地化字符串看起来不错!

'Hafta' 是土耳其语中 "week" 的正确翻译。这个改动有助于提高表格标题的可访问性。

src/locale/ug_CN.ts (1)

14-14: 新增的本地化字符串看起来不错!

'ھەپتە' 是维吾尔语中 "week" 的正确翻译。这个改动有助于提高表格标题的可访问性。

src/locale/pt_PT.ts (1)

12-12: 新增的本地化字符串看起来不错!

'Semana' 是葡萄牙语中 "week" 的正确翻译。这个改动有助于提高表格标题的可访问性。

建议:验证其他语言文件

建议检查是否所有语言文件都已添加了 week 属性,以确保完整的本地化支持。

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# 描述:检查所有语言文件是否都包含 week 属性

# 搜索所有缺少 week 属性的语言文件
echo "检查缺少 week 属性的语言文件:"
rg -L 'week:' 'src/locale/*.ts'

Length of output: 134


请根据以上脚本输出的信息进行手动验证:

  • 若 "src/locale" 目录不存在,请确认语言文件存放的正确目录。
  • 检查所有语言文件中是否都包含 "week:" 属性,确保本地化支持的完整性。

请将执行结果反馈,以便进一步确认审查意见的准确性。


🏁 Script executed:

#!/bin/bash
# 脚本目的:
# 1. 检查项目中是否存在路径 "src/locale"。
# 2. 如果该目录存在,列出其中所有 .ts 文件,并检查每个文件中是否包含 "week:" 属性。
# 3. 如果该目录不存在,则搜索项目中可能存放语言文件的其它目录(例如:src/locales)。

echo "【步骤1】检查是否存在 'src/locale' 目录:"
if [ -d "src/locale" ]; then
  echo "'src/locale' 目录存在,内容如下:"
  ls -1 src/locale
else
  echo "'src/locale' 目录不存在!"
fi

echo ""
echo "【步骤2】尝试查找类似语言文件目录(目录名中包含 'locale' 或 'locales'):"
find . -type d \( -iname "*locale*" -o -iname "*locales*" \) -print

echo ""
echo "【步骤3】若存在语言文件目录,请检查其中 .ts 文件是否包含 'week:' 属性。"
# 先查找所有可能的语言文件目录(假设文件名中含有国家码,例如 pt_PT.ts)
echo "查找所有 .ts 文件(文件名格式包含 '_', 如 pt_PT.ts):"
find . -type f -name "*_*\.ts"

echo ""
echo "【步骤4】检查找到的 .ts 文件中 'week:' 属性的情况:"
# 针对上一步找到的每个文件,检查是否包含 "week:" 属性
find . -type f -name "*_*\.ts" | while read file; do
  echo "检查文件: $file"
  if grep -q "week:" "$file"; then
    echo "  -> 包含 week 属性"
  else
    echo "  -> 缺少 week 属性"
  fi
done

Length of output: 49011


验证结果:所有本地化文件均包含 “week” 属性

经过检查 src/locale 目录下的所有语言文件(如 pt_PT.tszh_CN.tsja_JP.ts 等),每个文件都包含了 week: 属性。注意到输出中部分来自 node_modules 的文件并不属于应用语言文件,因此无需关注。

src/locale/pt_BR.ts (1)

12-12: 新增的本地化字符串符合预期!

新增的 'week' 属性值 'Semana' 正确表示了葡萄牙语中的"周"的含义,这有助于提高表格标题的可访问性。

src/locale/hu_HU.ts (1)

12-12: 本地化字符串添加正确!

新增的 'week' 属性值 'Hét' 正确表示了匈牙利语中的"周"的含义,与其他语言的本地化更改保持一致。

src/PickerPanel/QuarterPanel/index.tsx (1)

42-42: 优化了年份选择按钮的可访问性!

使用 locale.yearSelect 替换静态文本作为 aria-label,这样可以确保屏幕阅读器能够以用户的首选语言朗读年份选择按钮。

src/PickerPanel/MonthPanel/index.tsx (1)

74-74: 月份面板的年份选择按钮可访问性得到改善!

使用 locale.yearSelect 作为 aria-label 的实现与 QuarterPanel 保持一致,确保了组件库的可访问性标准统一。

src/PickerPanel/YearPanel/index.tsx (1)

80-80: 使用本地化文本改善了可访问性!

将静态文本替换为 locale.decadeSelect 使屏幕阅读器能够以用户首选语言朗读按钮标签。

src/PickerPanel/PanelHeader.tsx (1)

125-125: 导航按钮的可访问性得到全面改善!

所有导航按钮现在都使用本地化文本作为 aria-label:

  • 上一年按钮:locale.previousYear
  • 上一月按钮:locale.previousMonth
  • 下一月按钮:locale.nextMonth
  • 下一年按钮:locale.nextYear

这些更改使屏幕阅读器用户能够更好地理解和使用日期选择器的导航功能。

Also applies to: 141-141, 155-155, 168-168

src/interface.tsx (1)

66-66: 类型定义增强支持本地化!

Locale 类型中添加 week: string 属性,为周相关标签提供本地化支持,这有助于改善整体可访问性。

@afc163 afc163 merged commit abb12ba into react-component:master Feb 7, 2025
9 checks passed
@aojunhao123 aojunhao123 changed the title feat: improve a11y when table header is empty and add localization support fix(a11y): fix table header is empty and add localization support Feb 7, 2025
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