locale specific to Simplified Chinese and Taiwanese Mandarin not translating as expected
padmavemulapati opened this issue · 2 comments
Product
axe-core
Product Version
4.9.0
Latest Version
- I have tested the issue with the latest version of the product
Issue Description
Expectation
With the generated axe.zh_CN.min.js
and axe.zh_TW.min.js
(generated using npm run build -- --lang=zh_CN
and npm run build -- --lang=zh_TW
) source snippet , unable to see the descriptions in respective translations
Actual
In Simplified Chinese and Taiwanese Mandarin should be traslated
How to Reproduce
- Created a test file for the 4.9.0 Change -
aria-hiddden-body
tag addedwcag131
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+ARIA 1.0//EN" "http://www.w3.org/WAI/ARIA/schemata/html4-aria-1.dtd">
<html lang="en">
<head>
<title>aria-hidden on body Test</title>
<body aria-hidden="true">
<h2>Some title.</h2>
<a href="http://www.deque.com">Deque</a>
<div id="mocha"></div>
</body>
</head>
</html>
- Run the axe-core with
npm run build
- With the axe-core_4.9.0.min.js source snippet run axe using
await axe.run()
- Seeing the expected violations
- Created the traslation files for
Greek
,Italian
,Simplified Chinese
,Taiwanese Mandarin
using
npm run build -- --lang=el
npm run build -- --lang=it
npm run build -- --lang=zh_CN
npm run build -- --lang=zh_TW
respectively.
6. I am able to the proper translations for Greek
and Italian
7. Unable to see the trnasaltions for Chinese and Taiwanese
Recording:
9c211487-230a-4604-9fe0-3ab00b3c9197.mp4
Found the problem. In our rule configure build script we generate the lang/locale from looking at the file name using a regex. The regex only looks at lowercase alpha characters of length 2 or 3, so a lang like pt
works but a lang of pt_BR
is not matched and so defaults to english as the locale.
Verified with the latest axe-core-dev branch code base, now with the fix able to translate Chinese and Taiwanese locale and getting the respective translated a11y issues.
Results for Simplified Chinese:
Results for Taiwanese Mandarin:
Environment:
Label | Value |
---|---|
Product | axe-core |
Version | 4.9.0(Dev Branch Code base |
OS-Details | _MAC- Intel Core i7 - 11.6.8 _ |
BrowserDetails | Chrome Version 124.0.6367.119 (Official Build) (64-bit) |