@afixt/test-utils 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +13 -0
- package/.eslintrc +78 -0
- package/.gitattributes +5 -0
- package/.nvmrc +1 -0
- package/CLAUDE.md +33 -0
- package/README.md +72 -0
- package/docs/arrayUtils.js.html +69 -0
- package/docs/data/search.json +1 -0
- package/docs/domUtils.js.html +182 -0
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/getAccessibleName.js.html +456 -0
- package/docs/getAccessibleText.js.html +65 -0
- package/docs/getAriaAttributesByElement.js.html +22 -0
- package/docs/getCSSGeneratedContent.js.html +62 -0
- package/docs/getComputedRole.js.html +172 -0
- package/docs/getFocusableElements.js.html +29 -0
- package/docs/getGeneratedContent.js.html +18 -0
- package/docs/getImageText.js.html +28 -0
- package/docs/getStyleObject.js.html +48 -0
- package/docs/global.html +3 -0
- package/docs/hasAccessibleName.js.html +30 -0
- package/docs/hasAttribute.js.html +18 -0
- package/docs/hasCSSGeneratedContent.js.html +23 -0
- package/docs/hasHiddenParent.js.html +32 -0
- package/docs/hasParent.js.html +57 -0
- package/docs/hasValidAriaAttributes.js.html +33 -0
- package/docs/hasValidAriaRole.js.html +32 -0
- package/docs/index.html +3 -0
- package/docs/index.js.html +66 -0
- package/docs/isAriaAttributesValid.js.html +76 -0
- package/docs/isComplexTable.js.html +112 -0
- package/docs/isDataTable.js.html +241 -0
- package/docs/isFocusable.js.html +37 -0
- package/docs/isHidden.js.html +20 -0
- package/docs/isOffScreen.js.html +19 -0
- package/docs/isValidUrl.js.html +16 -0
- package/docs/isVisible.js.html +65 -0
- package/docs/module-afixt-test-utils.html +3 -0
- package/docs/scripts/core.js +726 -0
- package/docs/scripts/core.min.js +23 -0
- package/docs/scripts/resize.js +90 -0
- package/docs/scripts/search.js +265 -0
- package/docs/scripts/search.min.js +6 -0
- package/docs/scripts/third-party/Apache-License-2.0.txt +202 -0
- package/docs/scripts/third-party/fuse.js +9 -0
- package/docs/scripts/third-party/hljs-line-num-original.js +369 -0
- package/docs/scripts/third-party/hljs-line-num.js +1 -0
- package/docs/scripts/third-party/hljs-original.js +5171 -0
- package/docs/scripts/third-party/hljs.js +1 -0
- package/docs/scripts/third-party/popper.js +5 -0
- package/docs/scripts/third-party/tippy.js +1 -0
- package/docs/scripts/third-party/tocbot.js +672 -0
- package/docs/scripts/third-party/tocbot.min.js +1 -0
- package/docs/styles/clean-jsdoc-theme-base.css +1159 -0
- package/docs/styles/clean-jsdoc-theme-dark.css +412 -0
- package/docs/styles/clean-jsdoc-theme-light.css +482 -0
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +30 -0
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
- package/docs/styles/clean-jsdoc-theme.min.css +1 -0
- package/docs/testContrast.js.html +236 -0
- package/docs/testLang.js.html +578 -0
- package/docs/testOrder.js.html +93 -0
- package/jsdoc.json +67 -0
- package/package.json +32 -0
- package/src/arrayUtils.js +67 -0
- package/src/domUtils.js +179 -0
- package/src/getAccessibleName.js +454 -0
- package/src/getAccessibleText.js +63 -0
- package/src/getAriaAttributesByElement.js +19 -0
- package/src/getCSSGeneratedContent.js +60 -0
- package/src/getComputedRole.js +169 -0
- package/src/getFocusableElements.js +26 -0
- package/src/getGeneratedContent.js +15 -0
- package/src/getImageText.js +25 -0
- package/src/getStyleObject.js +45 -0
- package/src/hasAccessibleName.js +28 -0
- package/src/hasAttribute.js +15 -0
- package/src/hasCSSGeneratedContent.js +20 -0
- package/src/hasHiddenParent.js +29 -0
- package/src/hasParent.js +54 -0
- package/src/hasValidAriaAttributes.js +30 -0
- package/src/hasValidAriaRole.js +29 -0
- package/src/index.js +64 -0
- package/src/interactiveRoles.js +20 -0
- package/src/isAriaAttributesValid.js +74 -0
- package/src/isComplexTable.js +109 -0
- package/src/isDataTable.js +239 -0
- package/src/isFocusable.js +34 -0
- package/src/isHidden.js +17 -0
- package/src/isOffScreen.js +16 -0
- package/src/isValidUrl.js +13 -0
- package/src/isVisible.js +62 -0
- package/src/stringUtils.js +150 -0
- package/src/testContrast.js +233 -0
- package/src/testLang.js +575 -0
- package/src/testOrder.js +90 -0
- package/test/_template.test.js +21 -0
- package/test/arrayUtils.test.js +84 -0
- package/test/domUtils.test.js +147 -0
- package/test/generate-test-stubs.js +37 -0
- package/test/getAccessibleName.test.js +113 -0
- package/test/getAccessibleText.test.js +94 -0
- package/test/getAriaAttributesByElement.test.js +112 -0
- package/test/getCSSGeneratedContent.test.js +102 -0
- package/test/getComputedRole.test.js +180 -0
- package/test/getFocusableElements.test.js +134 -0
- package/test/getGeneratedContent.test.js +321 -0
- package/test/getImageText.test.js +21 -0
- package/test/getStyleObject.test.js +134 -0
- package/test/hasAccessibleName.test.js +59 -0
- package/test/hasAttribute.test.js +132 -0
- package/test/hasCSSGeneratedContent.test.js +143 -0
- package/test/hasHiddenParent.test.js +176 -0
- package/test/hasParent.test.js +266 -0
- package/test/hasValidAriaAttributes.test.js +79 -0
- package/test/hasValidAriaRole.test.js +98 -0
- package/test/isAriaAttributesValid.test.js +83 -0
- package/test/isComplexTable.test.js +363 -0
- package/test/isDataTable.test.js +948 -0
- package/test/isFocusable.test.js +182 -0
- package/test/isHidden.test.js +157 -0
- package/test/isOffScreen.test.js +249 -0
- package/test/isValidUrl.test.js +63 -0
- package/test/isVisible.test.js +104 -0
- package/test/setup.js +11 -0
- package/test/stringUtils.test.js +106 -0
- package/test/testContrast.test.js +77 -0
- package/test/testLang.test.js +21 -0
- package/test/testOrder.test.js +157 -0
- package/vitest.config.js +25 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Source: testLang.js</title><!--[if lt IE 9]>
|
|
2
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
3
|
+
<![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="";baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body data-theme="dark"><div class="sidebar-container"><div class="sidebar" id="sidebar"><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-afixt-test-utils.html">afixt-test-utils</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#arrayCount">arrayCount</a></div><div class="sidebar-section-children"><a href="global.html#arrayRemoveByValue">arrayRemoveByValue</a></div><div class="sidebar-section-children"><a href="global.html#arrayUnique">arrayUnique</a></div><div class="sidebar-section-children"><a href="global.html#cellColorDiffs">cellColorDiffs</a></div><div class="sidebar-section-children"><a href="global.html#cellCount">cellCount</a></div><div class="sidebar-section-children"><a href="global.html#checkInconsistent">checkInconsistent</a></div><div class="sidebar-section-children"><a href="global.html#checkMultiRowsInHeader">checkMultiRowsInHeader</a></div><div class="sidebar-section-children"><a href="global.html#checkMultiRowsWithColspan">checkMultiRowsWithColspan</a></div><div class="sidebar-section-children"><a href="global.html#cleanBlank">cleanBlank</a></div><div class="sidebar-section-children"><a href="global.html#colCount">colCount</a></div><div class="sidebar-section-children"><a href="global.html#countBordersPct">countBordersPct</a></div><div class="sidebar-section-children"><a href="global.html#getAccessibleName">getAccessibleName</a></div><div class="sidebar-section-children"><a href="global.html#getAccessibleText">getAccessibleText</a></div><div class="sidebar-section-children"><a href="global.html#getAriaAttributes">getAriaAttributes</a></div><div class="sidebar-section-children"><a href="global.html#getCSSGeneratedContent">getCSSGeneratedContent</a></div><div class="sidebar-section-children"><a href="global.html#getColorContrast">getColorContrast</a></div><div class="sidebar-section-children"><a href="global.html#getComputedBackgroundColor">getComputedBackgroundColor</a></div><div class="sidebar-section-children"><a href="global.html#getComputedRole">getComputedRole</a></div><div class="sidebar-section-children"><a href="global.html#getFocusableElements">getFocusableElements</a></div><div class="sidebar-section-children"><a href="global.html#getGeneratedContent">getGeneratedContent</a></div><div class="sidebar-section-children"><a href="global.html#getImageText">getImageText</a></div><div class="sidebar-section-children"><a href="global.html#getStyleObject">getStyleObject</a></div><div class="sidebar-section-children"><a href="global.html#getTwoLetterCode">getTwoLetterCode</a></div><div class="sidebar-section-children"><a href="global.html#hasAccessibleName">hasAccessibleName</a></div><div class="sidebar-section-children"><a href="global.html#hasAttribute">hasAttribute</a></div><div class="sidebar-section-children"><a href="global.html#hasCSSGeneratedContent">hasCSSGeneratedContent</a></div><div class="sidebar-section-children"><a href="global.html#hasHiddenParent">hasHiddenParent</a></div><div class="sidebar-section-children"><a href="global.html#hasParent">hasParent</a></div><div class="sidebar-section-children"><a href="global.html#hasValidAriaAttributes">hasValidAriaAttributes</a></div><div class="sidebar-section-children"><a href="global.html#hasValidAriaRole">hasValidAriaRole</a></div><div class="sidebar-section-children"><a href="global.html#isAriaAttributeValid">isAriaAttributeValid</a></div><div class="sidebar-section-children"><a href="global.html#isComplexTable">isComplexTable</a></div><div class="sidebar-section-children"><a href="global.html#isDataTable">isDataTable</a></div><div class="sidebar-section-children"><a href="global.html#isFocusable">isFocusable</a></div><div class="sidebar-section-children"><a href="global.html#isHidden">isHidden</a></div><div class="sidebar-section-children"><a href="global.html#isNotVisible">isNotVisible</a></div><div class="sidebar-section-children"><a href="global.html#isOffScreen">isOffScreen</a></div><div class="sidebar-section-children"><a href="global.html#isValidUrl">isValidUrl</a></div><div class="sidebar-section-children"><a href="global.html#isVisible">isVisible</a></div><div class="sidebar-section-children"><a href="global.html#langCodes">langCodes</a></div><div class="sidebar-section-children"><a href="global.html#luminance">luminance</a></div><div class="sidebar-section-children"><a href="global.html#matchesSelector">matchesSelector</a></div><div class="sidebar-section-children"><a href="global.html#parseRGB">parseRGB</a></div><div class="sidebar-section-children"><a href="global.html#rowCount">rowCount</a></div><div class="sidebar-section-children"><a href="global.html#rtls">rtls</a></div><div class="sidebar-section-children"><a href="global.html#sortByVisualOrder">sortByVisualOrder</a></div><div class="sidebar-section-children"><a href="global.html#strlen">strlen</a></div><div class="sidebar-section-children"><a href="global.html#testContrast">testContrast</a></div><div class="sidebar-section-children"><a href="global.html#testLang">testLang</a></div><div class="sidebar-section-children"><a href="global.html#testOrder">testOrder</a></div><div class="sidebar-section-children"><a href="global.html#validAriaAttributes">validAriaAttributes</a></div><div class="sidebar-section-children"><a href="global.html#validLangCodes">validLangCodes</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section id="source-page" class="source-page"><header><h1 id="title" class="has-anchor">testLang.js</h1></header><article><pre class="prettyprint source lang-js"><code>/**
|
|
4
|
+
* An array of language codes and their corresponding details.
|
|
5
|
+
* Each object in the array represents a language and contains the following properties:
|
|
6
|
+
*
|
|
7
|
+
* @property {string} alpha3 - The ISO 639-2 three-letter code for the language.
|
|
8
|
+
* @property {string} alpha2 - The ISO 639-1 two-letter code for the language.
|
|
9
|
+
* @property {string} English - The English name of the language.
|
|
10
|
+
* @property {string|null} [franc3] - The three-letter code used by the franc library, if available.
|
|
11
|
+
*/
|
|
12
|
+
export const langCodes = [
|
|
13
|
+
{ alpha3: "aar", alpha2: "aa", English: "Afar", franc3: null },
|
|
14
|
+
{ alpha3: "abk", alpha2: "ab", English: "Abkhazian", franc3: null },
|
|
15
|
+
{ alpha3: "afr", alpha2: "af", English: "Afrikaans" },
|
|
16
|
+
{ alpha3: "aka", alpha2: "ak", English: "Akan" },
|
|
17
|
+
{ alpha3: "alb", alpha2: "sq", English: "Albanian", franc3: "als" },
|
|
18
|
+
{ alpha3: "amh", alpha2: "am", English: "Amharic" },
|
|
19
|
+
{ alpha3: "ara", alpha2: "ar", English: "Arabic", franc3: "arb" },
|
|
20
|
+
{ alpha3: "arg", alpha2: "an", English: "Aragonese", franc3: null },
|
|
21
|
+
{ alpha3: "arm", alpha2: "hy", English: "Armenian", franc3: "hye" },
|
|
22
|
+
{ alpha3: "asm", alpha2: "as", English: "Assamese", franc3: null },
|
|
23
|
+
{ alpha3: "ava", alpha2: "av", English: "Avaric", franc3: null },
|
|
24
|
+
{ alpha3: "ave", alpha2: "ae", English: "Avestan", franc3: null },
|
|
25
|
+
{ alpha3: "aym", alpha2: "ay", English: "Aymara", franc3: "ayr" },
|
|
26
|
+
{ alpha3: "aze", alpha2: "az", English: "Azerbaijani", franc3: "azj" },
|
|
27
|
+
{ alpha3: "bak", alpha2: "ba", English: "Bashkir", franc3: null },
|
|
28
|
+
{ alpha3: "bam", alpha2: "bm", English: "Bambara" },
|
|
29
|
+
{ alpha3: "baq", alpha2: "eu", English: "Basque", franc3: null },
|
|
30
|
+
{ alpha3: "bel", alpha2: "be", English: "Belarusian" },
|
|
31
|
+
{ alpha3: "ben", alpha2: "bn", English: "Bengali" },
|
|
32
|
+
{ alpha3: "bih", alpha2: "bh", English: "Bihari languages", franc3: null },
|
|
33
|
+
{ alpha3: "bis", alpha2: "bi", English: "Bislama", franc3: null },
|
|
34
|
+
{ alpha3: "bos", alpha2: "bs", English: "Bosnian" },
|
|
35
|
+
{ alpha3: "bre", alpha2: "br", English: "Breton", franc3: null },
|
|
36
|
+
{ alpha3: "bul", alpha2: "bg", English: "Bulgarian" },
|
|
37
|
+
{ alpha3: "bur", alpha2: "my", English: "Burmese", franc3: "mya" },
|
|
38
|
+
{ alpha3: "cat", alpha2: "ca", English: "Catalan; Valencian" },
|
|
39
|
+
{ alpha3: "cha", alpha2: "ch", English: "Chamorro", franc3: null },
|
|
40
|
+
{ alpha3: "che", alpha2: "ce", English: "Chechen", franc3: null },
|
|
41
|
+
{ alpha3: "chi", alpha2: "zh", English: "Chinese", franc3: "cmn" },
|
|
42
|
+
{
|
|
43
|
+
alpha3: "chu",
|
|
44
|
+
alpha2: "cu",
|
|
45
|
+
English:
|
|
46
|
+
"Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic",
|
|
47
|
+
franc3: null,
|
|
48
|
+
},
|
|
49
|
+
{ alpha3: "chv", alpha2: "cv", English: "Chuvash", franc3: null },
|
|
50
|
+
{ alpha3: "cor", alpha2: "kw", English: "Cornish", franc3: null },
|
|
51
|
+
{ alpha3: "cos", alpha2: "co", English: "Corsican", franc3: null },
|
|
52
|
+
{ alpha3: "cre", alpha2: "cr", English: "Cree", franc3: null },
|
|
53
|
+
{ alpha3: "cze", alpha2: "cs", English: "Czech", franc3: "ces" },
|
|
54
|
+
{ alpha3: "dan", alpha2: "da", English: "Danish" },
|
|
55
|
+
{
|
|
56
|
+
alpha3: "div",
|
|
57
|
+
alpha2: "dv",
|
|
58
|
+
English: "Divehi; Dhivehi; Maldivian",
|
|
59
|
+
franc3: null,
|
|
60
|
+
},
|
|
61
|
+
{ alpha3: "dut", alpha2: "nl", English: "Dutch; Flemish", franc3: "nld" },
|
|
62
|
+
{ alpha3: "dzo", alpha2: "dz", English: "Dzongkha", franc3: null },
|
|
63
|
+
{ alpha3: "eng", alpha2: "en", English: "English" },
|
|
64
|
+
{ alpha3: "epo", alpha2: "eo", English: "Esperanto" },
|
|
65
|
+
{ alpha3: "est", alpha2: "et", English: "Estonian" },
|
|
66
|
+
{ alpha3: "ewe", alpha2: "ee", English: "Ewe" },
|
|
67
|
+
{ alpha3: "fao", alpha2: "fo", English: "Faroese", franc3: null },
|
|
68
|
+
{ alpha3: "fij", alpha2: "fj", English: "Fijian", franc3: null },
|
|
69
|
+
{ alpha3: "fin", alpha2: "fi", English: "Finnish" },
|
|
70
|
+
{ alpha3: "fre", alpha2: "fr", English: "French", franc3: "fra" },
|
|
71
|
+
{ alpha3: "fry", alpha2: "fy", English: "Western Frisian", franc3: null },
|
|
72
|
+
{ alpha3: "ful", alpha2: "ff", English: "Fulah", franc3: null },
|
|
73
|
+
{ alpha3: "geo", alpha2: "ka", English: "Georgian", franc3: "kat" },
|
|
74
|
+
{ alpha3: "ger", alpha2: "de", English: "German", franc3: "deu" },
|
|
75
|
+
{
|
|
76
|
+
alpha3: "gla",
|
|
77
|
+
alpha2: "gd",
|
|
78
|
+
English: "Gaelic; Scottish Gaelic",
|
|
79
|
+
franc3: null,
|
|
80
|
+
},
|
|
81
|
+
{ alpha3: "gle", alpha2: "ga", English: "Irish", franc3: null },
|
|
82
|
+
{ alpha3: "glg", alpha2: "gl", English: "Galician" },
|
|
83
|
+
{ alpha3: "glv", alpha2: "gv", English: "Manx", franc3: null },
|
|
84
|
+
{
|
|
85
|
+
alpha3: "gre",
|
|
86
|
+
alpha2: "el",
|
|
87
|
+
English: "Greek, Modern (1453-)",
|
|
88
|
+
franc3: "ell",
|
|
89
|
+
},
|
|
90
|
+
{ alpha3: "grn", alpha2: "gn", English: "Guarani", franc3: null },
|
|
91
|
+
{ alpha3: "guj", alpha2: "gu", English: "Gujarati" },
|
|
92
|
+
{ alpha3: "hat", alpha2: "ht", English: "Haitian; Haitian Creole" },
|
|
93
|
+
{ alpha3: "hau", alpha2: "ha", English: "Hausa" },
|
|
94
|
+
{ alpha3: "heb", alpha2: "he", English: "Hebrew" },
|
|
95
|
+
{ alpha3: "her", alpha2: "hz", English: "Herero", franc3: null },
|
|
96
|
+
{ alpha3: "hin", alpha2: "hi", English: "Hindi" },
|
|
97
|
+
{ alpha3: "hmo", alpha2: "ho", English: "Hiri Motu", franc3: null },
|
|
98
|
+
{ alpha3: "hrv", alpha2: "hr", English: "Croatian" },
|
|
99
|
+
{ alpha3: "hun", alpha2: "hu", English: "Hungarian" },
|
|
100
|
+
{ alpha3: "ibo", alpha2: "ig", English: "Igbo" },
|
|
101
|
+
{ alpha3: "ice", alpha2: "is", English: "Icelandic", franc3: null },
|
|
102
|
+
{ alpha3: "ido", alpha2: "io", English: "Ido", franc3: null },
|
|
103
|
+
{ alpha3: "iii", alpha2: "ii", English: "Sichuan Yi; Nuosu" },
|
|
104
|
+
{ alpha3: "iku", alpha2: "iu", English: "Inuktitut", franc3: null },
|
|
105
|
+
{
|
|
106
|
+
alpha3: "ile",
|
|
107
|
+
alpha2: "ie",
|
|
108
|
+
English: "Interlingue; Occidental",
|
|
109
|
+
franc3: null,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
alpha3: "ina",
|
|
113
|
+
alpha2: "ia",
|
|
114
|
+
English: "Interlingua (International Auxiliary Language Association)",
|
|
115
|
+
franc3: null,
|
|
116
|
+
},
|
|
117
|
+
{ alpha3: "ind", alpha2: "id", English: "Indonesian" },
|
|
118
|
+
{ alpha3: "ipk", alpha2: "ik", English: "Inupiaq", franc3: null },
|
|
119
|
+
{ alpha3: "ita", alpha2: "it", English: "Italian" },
|
|
120
|
+
{ alpha3: "jav", alpha2: "jv", English: "Javanese" },
|
|
121
|
+
{ alpha3: "jpn", alpha2: "ja", English: "Japanese" },
|
|
122
|
+
{
|
|
123
|
+
alpha3: "kal",
|
|
124
|
+
alpha2: "kl",
|
|
125
|
+
English: "Kalaallisut; Greenlandic",
|
|
126
|
+
franc3: null,
|
|
127
|
+
},
|
|
128
|
+
{ alpha3: "kan", alpha2: "kn", English: "Kannada" },
|
|
129
|
+
{ alpha3: "kas", alpha2: "ks", English: "Kashmiri", franc3: null },
|
|
130
|
+
{ alpha3: "kau", alpha2: "kr", English: "Kanuri", franc3: "knc" },
|
|
131
|
+
{ alpha3: "kaz", alpha2: "kk", English: "Kazakh" },
|
|
132
|
+
{ alpha3: "khm", alpha2: "km", English: "Central Khmer" },
|
|
133
|
+
{ alpha3: "kik", alpha2: "ki", English: "Kikuyu; Gikuyu", franc3: null },
|
|
134
|
+
{ alpha3: "kin", alpha2: "rw", English: "Kinyarwanda" },
|
|
135
|
+
{ alpha3: "kir", alpha2: "ky", English: "Kirghiz; Kyrgyz" },
|
|
136
|
+
{ alpha3: "kom", alpha2: "kv", English: "Komi", franc3: "koi" },
|
|
137
|
+
{ alpha3: "kon", alpha2: "kg", English: "Kongo", franc3: null },
|
|
138
|
+
{ alpha3: "kor", alpha2: "ko", English: "Korean" },
|
|
139
|
+
{
|
|
140
|
+
alpha3: "kua",
|
|
141
|
+
alpha2: "kj",
|
|
142
|
+
English: "Kuanyama; Kwanyama",
|
|
143
|
+
franc3: null,
|
|
144
|
+
},
|
|
145
|
+
{ alpha3: "kur", alpha2: "ku", English: "Kurdish", franc3: "ckb" },
|
|
146
|
+
{ alpha3: "lao", alpha2: "lo", English: "Lao" },
|
|
147
|
+
{ alpha3: "lat", alpha2: "la", English: "Latin", franc3: null },
|
|
148
|
+
{ alpha3: "lav", alpha2: "lv", English: "Latvian" },
|
|
149
|
+
{
|
|
150
|
+
alpha3: "lim",
|
|
151
|
+
alpha2: "li",
|
|
152
|
+
English: "Limburgan; Limburger; Limburgish",
|
|
153
|
+
franc3: null,
|
|
154
|
+
},
|
|
155
|
+
{ alpha3: "lin", alpha2: "ln", English: "Lingala" },
|
|
156
|
+
{ alpha3: "lit", alpha2: "lt", English: "Lithuanian" },
|
|
157
|
+
{
|
|
158
|
+
alpha3: "ltz",
|
|
159
|
+
alpha2: "lb",
|
|
160
|
+
English: "Luxembourgish; Letzeburgesch",
|
|
161
|
+
franc3: null,
|
|
162
|
+
},
|
|
163
|
+
{ alpha3: "lub", alpha2: "lu", English: "Luba-Katanga", franc3: null },
|
|
164
|
+
{ alpha3: "lug", alpha2: "lg", English: "Ganda" },
|
|
165
|
+
{ alpha3: "mac", alpha2: "mk", English: "Macedonian", franc3: "mkd" },
|
|
166
|
+
{ alpha3: "mah", alpha2: "mh", English: "Marshallese", franc3: null },
|
|
167
|
+
{ alpha3: "mal", alpha2: "ml", English: "Malayalam" },
|
|
168
|
+
{ alpha3: "mao", alpha2: "mi", English: "Maori", franc3: null },
|
|
169
|
+
{ alpha3: "mar", alpha2: "mr", English: "Marathi" },
|
|
170
|
+
{ alpha3: "may", alpha2: "ms", English: "Malay", franc3: null },
|
|
171
|
+
{ alpha3: "mlg", alpha2: "mg", English: "Malagasy", franc3: "plt" },
|
|
172
|
+
{ alpha3: "mlt", alpha2: "mt", English: "Maltese", franc3: null },
|
|
173
|
+
{ alpha3: "mon", alpha2: "mn", English: "Mongolian", franc3: "khk" },
|
|
174
|
+
{ alpha3: "nau", alpha2: "na", English: "Nauru", franc3: null },
|
|
175
|
+
{ alpha3: "nav", alpha2: "nv", English: "Navajo; Navaho", franc3: null },
|
|
176
|
+
{
|
|
177
|
+
alpha3: "nbl",
|
|
178
|
+
alpha2: "nr",
|
|
179
|
+
English: "Ndebele, South; South Ndebele",
|
|
180
|
+
franc3: null,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
alpha3: "nde",
|
|
184
|
+
alpha2: "nd",
|
|
185
|
+
English: "Ndebele, North; North Ndebele",
|
|
186
|
+
franc3: null,
|
|
187
|
+
},
|
|
188
|
+
{ alpha3: "ndo", alpha2: "ng", English: "Ndonga" },
|
|
189
|
+
{ alpha3: "nep", alpha2: "ne", English: "Nepali" },
|
|
190
|
+
{
|
|
191
|
+
alpha3: "nno",
|
|
192
|
+
alpha2: "nn",
|
|
193
|
+
English: "Norwegian Nynorsk; Nynorsk, Norwegian",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
alpha3: "nob",
|
|
197
|
+
alpha2: "nb",
|
|
198
|
+
English: "Bokmål, Norwegian; Norwegian Bokmål",
|
|
199
|
+
},
|
|
200
|
+
{ alpha3: "nor", alpha2: "no", English: "Norwegian", franc3: "nob" },
|
|
201
|
+
{ alpha3: "nya", alpha2: "ny", English: "Chichewa; Chewa; Nyanja" },
|
|
202
|
+
{
|
|
203
|
+
alpha3: "oci",
|
|
204
|
+
alpha2: "oc",
|
|
205
|
+
English: "Occitan (post 1500); Provençal",
|
|
206
|
+
franc3: null,
|
|
207
|
+
},
|
|
208
|
+
{ alpha3: "oji", alpha2: "oj", English: "Ojibwa", franc3: null },
|
|
209
|
+
{ alpha3: "ori", alpha2: "or", English: "Oriya" },
|
|
210
|
+
{ alpha3: "orm", alpha2: "om", English: "Oromo", franc3: "gax" },
|
|
211
|
+
{ alpha3: "oss", alpha2: "os", English: "Ossetian; Ossetic", franc3: null },
|
|
212
|
+
{ alpha3: "pan", alpha2: "pa", English: "Panjabi; Punjabi" },
|
|
213
|
+
{ alpha3: "per", alpha2: "fa", English: "Persian", franc3: "fas" },
|
|
214
|
+
{ alpha3: "pli", alpha2: "pi", English: "Pali", franc3: null },
|
|
215
|
+
{ alpha3: "pol", alpha2: "pl", English: "Polish" },
|
|
216
|
+
{ alpha3: "por", alpha2: "pt", English: "Portuguese" },
|
|
217
|
+
{ alpha3: "pus", alpha2: "ps", English: "Pushto; Pashto", franc3: null },
|
|
218
|
+
{ alpha3: "que", alpha2: "qu", English: "Quechua", franc3: "quz" },
|
|
219
|
+
{ alpha3: "roh", alpha2: "rm", English: "Romansh", franc3: null },
|
|
220
|
+
{
|
|
221
|
+
alpha3: "rum",
|
|
222
|
+
alpha2: "ro",
|
|
223
|
+
English: "Romanian; Moldavian; Moldovan",
|
|
224
|
+
franc3: "ron",
|
|
225
|
+
},
|
|
226
|
+
{ alpha3: "run", alpha2: "rn", English: "Rundi" },
|
|
227
|
+
{ alpha3: "rus", alpha2: "ru", English: "Russian" },
|
|
228
|
+
{ alpha3: "sag", alpha2: "sg", English: "Sango" },
|
|
229
|
+
{ alpha3: "san", alpha2: "sa", English: "Sanskrit", franc3: null },
|
|
230
|
+
{ alpha3: "sin", alpha2: "si", English: "Sinhala; Sinhalese" },
|
|
231
|
+
{ alpha3: "slo", alpha2: "sk", English: "Slovak", franc3: "slk" },
|
|
232
|
+
{ alpha3: "slv", alpha2: "sl", English: "Slovenian" },
|
|
233
|
+
{ alpha3: "sme", alpha2: "se", English: "Northern Sami", franc3: null },
|
|
234
|
+
{ alpha3: "smo", alpha2: "sm", English: "Samoan", franc3: null },
|
|
235
|
+
{ alpha3: "sna", alpha2: "sn", English: "Shona" },
|
|
236
|
+
{ alpha3: "snd", alpha2: "sd", English: "Sindhi", franc3: null },
|
|
237
|
+
{ alpha3: "som", alpha2: "so", English: "Somali" },
|
|
238
|
+
{ alpha3: "sot", alpha2: "st", English: "Sotho, Southern" },
|
|
239
|
+
{ alpha3: "spa", alpha2: "es", English: "Spanish; Castilian" },
|
|
240
|
+
{ alpha3: "srd", alpha2: "sc", English: "Sardinian", franc3: "src" },
|
|
241
|
+
{ alpha3: "srp", alpha2: "sr", English: "Serbian" },
|
|
242
|
+
{ alpha3: "ssw", alpha2: "ss", English: "Swati" },
|
|
243
|
+
{ alpha3: "sun", alpha2: "su", English: "Sundanese" },
|
|
244
|
+
{ alpha3: "swa", alpha2: "sw", English: "Swahili", franc3: "swh" },
|
|
245
|
+
{ alpha3: "swe", alpha2: "sv", English: "Swedish" },
|
|
246
|
+
{ alpha3: "tah", alpha2: "ty", English: "Tahitian", franc3: null },
|
|
247
|
+
{ alpha3: "tam", alpha2: "ta", English: "Tamil" },
|
|
248
|
+
{ alpha3: "tat", alpha2: "tt", English: "Tatar" },
|
|
249
|
+
{ alpha3: "tel", alpha2: "te", English: "Telugu" },
|
|
250
|
+
{ alpha3: "tgk", alpha2: "tg", English: "Tajik" },
|
|
251
|
+
{ alpha3: "tgl", alpha2: "tl", English: "Tagalog" },
|
|
252
|
+
{ alpha3: "tha", alpha2: "th", English: "Thai" },
|
|
253
|
+
{ alpha3: "tib", alpha2: "bo", English: "Tibetan", franc3: "bod" },
|
|
254
|
+
{ alpha3: "tir", alpha2: "ti", English: "Tigrinya" },
|
|
255
|
+
{
|
|
256
|
+
alpha3: "ton",
|
|
257
|
+
alpha2: "to",
|
|
258
|
+
English: "Tonga (Tonga Islands)",
|
|
259
|
+
franc3: "toi",
|
|
260
|
+
},
|
|
261
|
+
{ alpha3: "tsn", alpha2: "tn", English: "Tswana" },
|
|
262
|
+
{ alpha3: "tso", alpha2: "ts", English: "Tsonga" },
|
|
263
|
+
{ alpha3: "tuk", alpha2: "tk", English: "Turkmen" },
|
|
264
|
+
{ alpha3: "tur", alpha2: "tr", English: "Turkish" },
|
|
265
|
+
{ alpha3: "twi", alpha2: "tw", English: "Twi", franc3: null },
|
|
266
|
+
{ alpha3: "uig", alpha2: "ug", English: "Uighur; Uyghur" },
|
|
267
|
+
{ alpha3: "ukr", alpha2: "uk", English: "Ukrainian" },
|
|
268
|
+
{ alpha3: "urd", alpha2: "ur", English: "Urdu" },
|
|
269
|
+
{ alpha3: "uzb", alpha2: "uz", English: "Uzbek", franc3: "uzn" },
|
|
270
|
+
{ alpha3: "ven", alpha2: "ve", English: "Venda" },
|
|
271
|
+
{ alpha3: "vie", alpha2: "vi", English: "Vietnamese" },
|
|
272
|
+
{ alpha3: "vol", alpha2: "vo", English: "Volapük", franc3: null },
|
|
273
|
+
{ alpha3: "wel", alpha2: "cy", English: "Welsh", franc3: null },
|
|
274
|
+
{ alpha3: "wln", alpha2: "wa", English: "Walloon", franc3: null },
|
|
275
|
+
{ alpha3: "wol", alpha2: "wo", English: "Wolof" },
|
|
276
|
+
{ alpha3: "xho", alpha2: "xh", English: "Xhosa" },
|
|
277
|
+
{ alpha3: "yid", alpha2: "yi", English: "Yiddish", franc3: "ydd" },
|
|
278
|
+
{ alpha3: "yor", alpha2: "yo", English: "Yoruba" },
|
|
279
|
+
{ alpha3: "zha", alpha2: "za", English: "Zhuang; Chuang", franc3: "zyb" },
|
|
280
|
+
{ alpha3: "zul", alpha2: "zu", English: "Zulu" },
|
|
281
|
+
];
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* An array of valid language codes.
|
|
285
|
+
*
|
|
286
|
+
* This array contains ISO 639-1 language codes that are used to identify languages.
|
|
287
|
+
*
|
|
288
|
+
* @constant {string[]}
|
|
289
|
+
*/
|
|
290
|
+
export const validLangCodes = [
|
|
291
|
+
"af",
|
|
292
|
+
"agq",
|
|
293
|
+
"ak",
|
|
294
|
+
"am",
|
|
295
|
+
"ar",
|
|
296
|
+
"as",
|
|
297
|
+
"asa",
|
|
298
|
+
"ast",
|
|
299
|
+
"az",
|
|
300
|
+
"bas",
|
|
301
|
+
"be",
|
|
302
|
+
"bem",
|
|
303
|
+
"bez",
|
|
304
|
+
"bg",
|
|
305
|
+
"bm",
|
|
306
|
+
"bn",
|
|
307
|
+
"bo",
|
|
308
|
+
"br",
|
|
309
|
+
"brx",
|
|
310
|
+
"bs",
|
|
311
|
+
"ca",
|
|
312
|
+
"ce",
|
|
313
|
+
"cgg",
|
|
314
|
+
"chr",
|
|
315
|
+
"ckb",
|
|
316
|
+
"cs",
|
|
317
|
+
"cu",
|
|
318
|
+
"cy",
|
|
319
|
+
"da",
|
|
320
|
+
"dav",
|
|
321
|
+
"de",
|
|
322
|
+
"dje",
|
|
323
|
+
"dsb",
|
|
324
|
+
"dua",
|
|
325
|
+
"dyo",
|
|
326
|
+
"dz",
|
|
327
|
+
"ebu",
|
|
328
|
+
"ee",
|
|
329
|
+
"el",
|
|
330
|
+
"en",
|
|
331
|
+
"eo",
|
|
332
|
+
"es",
|
|
333
|
+
"et",
|
|
334
|
+
"eu",
|
|
335
|
+
"ewo",
|
|
336
|
+
"fa",
|
|
337
|
+
"ff",
|
|
338
|
+
"fi",
|
|
339
|
+
"fil",
|
|
340
|
+
"fo",
|
|
341
|
+
"fr",
|
|
342
|
+
"fur",
|
|
343
|
+
"fy",
|
|
344
|
+
"ga",
|
|
345
|
+
"gd",
|
|
346
|
+
"gl",
|
|
347
|
+
"gsw",
|
|
348
|
+
"gu",
|
|
349
|
+
"guz",
|
|
350
|
+
"gv",
|
|
351
|
+
"ha",
|
|
352
|
+
"haw",
|
|
353
|
+
"he",
|
|
354
|
+
"hi",
|
|
355
|
+
"hr",
|
|
356
|
+
"hsb",
|
|
357
|
+
"hu",
|
|
358
|
+
"hy",
|
|
359
|
+
"id",
|
|
360
|
+
"ig",
|
|
361
|
+
"ii",
|
|
362
|
+
"is",
|
|
363
|
+
"it",
|
|
364
|
+
"ja",
|
|
365
|
+
"jgo",
|
|
366
|
+
"jmc",
|
|
367
|
+
"ka",
|
|
368
|
+
"kab",
|
|
369
|
+
"kam",
|
|
370
|
+
"kde",
|
|
371
|
+
"kea",
|
|
372
|
+
"khq",
|
|
373
|
+
"ki",
|
|
374
|
+
"kk",
|
|
375
|
+
"kkj",
|
|
376
|
+
"kl",
|
|
377
|
+
"kln",
|
|
378
|
+
"km",
|
|
379
|
+
"kn",
|
|
380
|
+
"ko",
|
|
381
|
+
"kok",
|
|
382
|
+
"ks",
|
|
383
|
+
"ksb",
|
|
384
|
+
"ksf",
|
|
385
|
+
"ksh",
|
|
386
|
+
"kw",
|
|
387
|
+
"ky",
|
|
388
|
+
"lag",
|
|
389
|
+
"lb",
|
|
390
|
+
"lg",
|
|
391
|
+
"lkt",
|
|
392
|
+
"ln",
|
|
393
|
+
"lo",
|
|
394
|
+
"lrc",
|
|
395
|
+
"lt",
|
|
396
|
+
"lu",
|
|
397
|
+
"luo",
|
|
398
|
+
"luy",
|
|
399
|
+
"lv",
|
|
400
|
+
"mas",
|
|
401
|
+
"mer",
|
|
402
|
+
"mfe",
|
|
403
|
+
"mg",
|
|
404
|
+
"mgh",
|
|
405
|
+
"mgo",
|
|
406
|
+
"mk",
|
|
407
|
+
"ml",
|
|
408
|
+
"mn",
|
|
409
|
+
"mr",
|
|
410
|
+
"ms",
|
|
411
|
+
"mt",
|
|
412
|
+
"mua",
|
|
413
|
+
"my",
|
|
414
|
+
"mzn",
|
|
415
|
+
"naq",
|
|
416
|
+
"nb",
|
|
417
|
+
"nd",
|
|
418
|
+
"nds",
|
|
419
|
+
"ne",
|
|
420
|
+
"nl",
|
|
421
|
+
"nmg",
|
|
422
|
+
"nn",
|
|
423
|
+
"nnh",
|
|
424
|
+
"nus",
|
|
425
|
+
"nyn",
|
|
426
|
+
"om",
|
|
427
|
+
"or",
|
|
428
|
+
"os",
|
|
429
|
+
"pa",
|
|
430
|
+
"pl",
|
|
431
|
+
"prg",
|
|
432
|
+
"ps",
|
|
433
|
+
"pt",
|
|
434
|
+
"qu",
|
|
435
|
+
"rm",
|
|
436
|
+
"rn",
|
|
437
|
+
"ro",
|
|
438
|
+
"rof",
|
|
439
|
+
"ru",
|
|
440
|
+
"rw",
|
|
441
|
+
"rwk",
|
|
442
|
+
"sah",
|
|
443
|
+
"saq",
|
|
444
|
+
"sbp",
|
|
445
|
+
"se",
|
|
446
|
+
"seh",
|
|
447
|
+
"ses",
|
|
448
|
+
"sg",
|
|
449
|
+
"shi",
|
|
450
|
+
"si",
|
|
451
|
+
"sk",
|
|
452
|
+
"sl",
|
|
453
|
+
"smn",
|
|
454
|
+
"sn",
|
|
455
|
+
"so",
|
|
456
|
+
"sq",
|
|
457
|
+
"sr",
|
|
458
|
+
"sv",
|
|
459
|
+
"sw",
|
|
460
|
+
"ta",
|
|
461
|
+
"te",
|
|
462
|
+
"teo",
|
|
463
|
+
"th",
|
|
464
|
+
"ti",
|
|
465
|
+
"tk",
|
|
466
|
+
"to",
|
|
467
|
+
"tr",
|
|
468
|
+
"twq",
|
|
469
|
+
"tzm",
|
|
470
|
+
"ug",
|
|
471
|
+
"uk",
|
|
472
|
+
"ur",
|
|
473
|
+
"uz",
|
|
474
|
+
"vai",
|
|
475
|
+
"vi",
|
|
476
|
+
"vo",
|
|
477
|
+
"vun",
|
|
478
|
+
"wae",
|
|
479
|
+
"xog",
|
|
480
|
+
"yav",
|
|
481
|
+
"yi",
|
|
482
|
+
"yo",
|
|
483
|
+
"yue",
|
|
484
|
+
"zgh",
|
|
485
|
+
"zh",
|
|
486
|
+
"zu",
|
|
487
|
+
];
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* An array of language codes that are written from right to left.
|
|
491
|
+
*
|
|
492
|
+
* @constant {string[]}
|
|
493
|
+
*/
|
|
494
|
+
export const rtls = ["ar", "az", "dv", "he", "ku", "fa", "ur"];
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Converts a three-letter language code to a two-letter language code.
|
|
499
|
+
*
|
|
500
|
+
* @param {string} threeLetterCode - The three-letter language code to convert.
|
|
501
|
+
* @returns {string|boolean} The corresponding two-letter language code, or false if not found.
|
|
502
|
+
*/
|
|
503
|
+
export function getTwoLetterCode(threeLetterCode) {
|
|
504
|
+
if (threeLetterCode === "cmn") {
|
|
505
|
+
threeLetterCode = "chi";
|
|
506
|
+
}
|
|
507
|
+
const result = langCodes.find(
|
|
508
|
+
(value) =>
|
|
509
|
+
value.alpha3 === threeLetterCode || value.franc3 === threeLetterCode
|
|
510
|
+
);
|
|
511
|
+
return result ? result.alpha2 : false;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Tests the language of an HTML element against its content.
|
|
516
|
+
*
|
|
517
|
+
* This function checks the `lang` or `xml:lang` attribute of the given element
|
|
518
|
+
* and its ancestors to determine the language. It then uses the `franc` library
|
|
519
|
+
* to detect the language of the element's text content and compares it to the
|
|
520
|
+
* language attribute.
|
|
521
|
+
*
|
|
522
|
+
* @param {HTMLElement} element - The HTML element to test.
|
|
523
|
+
* @returns {boolean} - Returns `true` if the detected language matches the
|
|
524
|
+
* language attribute or if the detected language is
|
|
525
|
+
* undefined ("und"). Otherwise, returns `false`.
|
|
526
|
+
*/
|
|
527
|
+
export function testLang(element) {
|
|
528
|
+
let selfLang =
|
|
529
|
+
element.getAttribute("lang") || element.getAttribute("xml:lang");
|
|
530
|
+
if (!selfLang) {
|
|
531
|
+
let parent = element.parentElement;
|
|
532
|
+
while (parent && !selfLang) {
|
|
533
|
+
selfLang =
|
|
534
|
+
parent.getAttribute("lang") || parent.getAttribute("xml:lang");
|
|
535
|
+
parent = parent.parentElement;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
if (!selfLang || selfLang.length < 2) return false;
|
|
539
|
+
selfLang = selfLang.split("-")[0].toLowerCase();
|
|
540
|
+
const threeLetterCode = franc(element.textContent.trim());
|
|
541
|
+
if (threeLetterCode === "und") return true;
|
|
542
|
+
return getTwoLetterCode(threeLetterCode) === selfLang;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export function getLang(element) {
|
|
546
|
+
let selfLang =
|
|
547
|
+
element.getAttribute("lang") || element.getAttribute("xml:lang");
|
|
548
|
+
if (!selfLang) {
|
|
549
|
+
let parent = element.parentElement;
|
|
550
|
+
while (parent && !selfLang) {
|
|
551
|
+
selfLang =
|
|
552
|
+
parent.getAttribute("lang") || parent.getAttribute("xml:lang");
|
|
553
|
+
parent = parent.parentElement;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (!selfLang || selfLang.length < 2) return false;
|
|
557
|
+
selfLang = selfLang.split("-")[0].toLowerCase();
|
|
558
|
+
const result = langCodes.find(
|
|
559
|
+
(value) => value.alpha2 === selfLang || value.alpha3 === selfLang
|
|
560
|
+
);
|
|
561
|
+
if (result) {
|
|
562
|
+
return result.alpha2;
|
|
563
|
+
} else if (validLangCodes.includes(selfLang)) {
|
|
564
|
+
return selfLang;
|
|
565
|
+
} else {
|
|
566
|
+
return false;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export function isDirValid(element) {
|
|
571
|
+
const lang = getLang(element);
|
|
572
|
+
if (element.hasAttribute("dir")) {
|
|
573
|
+
const dir = element.getAttribute("dir");
|
|
574
|
+
return rtls.includes(lang) ? dir === "rtl" : dir !== "rtl";
|
|
575
|
+
}
|
|
576
|
+
return !rtls.includes(lang);
|
|
577
|
+
}
|
|
578
|
+
</code></pre></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-afixt-test-utils.html">afixt-test-utils</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#arrayCount">arrayCount</a></div><div class="sidebar-section-children"><a href="global.html#arrayRemoveByValue">arrayRemoveByValue</a></div><div class="sidebar-section-children"><a href="global.html#arrayUnique">arrayUnique</a></div><div class="sidebar-section-children"><a href="global.html#cellColorDiffs">cellColorDiffs</a></div><div class="sidebar-section-children"><a href="global.html#cellCount">cellCount</a></div><div class="sidebar-section-children"><a href="global.html#checkInconsistent">checkInconsistent</a></div><div class="sidebar-section-children"><a href="global.html#checkMultiRowsInHeader">checkMultiRowsInHeader</a></div><div class="sidebar-section-children"><a href="global.html#checkMultiRowsWithColspan">checkMultiRowsWithColspan</a></div><div class="sidebar-section-children"><a href="global.html#cleanBlank">cleanBlank</a></div><div class="sidebar-section-children"><a href="global.html#colCount">colCount</a></div><div class="sidebar-section-children"><a href="global.html#countBordersPct">countBordersPct</a></div><div class="sidebar-section-children"><a href="global.html#getAccessibleName">getAccessibleName</a></div><div class="sidebar-section-children"><a href="global.html#getAccessibleText">getAccessibleText</a></div><div class="sidebar-section-children"><a href="global.html#getAriaAttributes">getAriaAttributes</a></div><div class="sidebar-section-children"><a href="global.html#getCSSGeneratedContent">getCSSGeneratedContent</a></div><div class="sidebar-section-children"><a href="global.html#getColorContrast">getColorContrast</a></div><div class="sidebar-section-children"><a href="global.html#getComputedBackgroundColor">getComputedBackgroundColor</a></div><div class="sidebar-section-children"><a href="global.html#getComputedRole">getComputedRole</a></div><div class="sidebar-section-children"><a href="global.html#getFocusableElements">getFocusableElements</a></div><div class="sidebar-section-children"><a href="global.html#getGeneratedContent">getGeneratedContent</a></div><div class="sidebar-section-children"><a href="global.html#getImageText">getImageText</a></div><div class="sidebar-section-children"><a href="global.html#getStyleObject">getStyleObject</a></div><div class="sidebar-section-children"><a href="global.html#getTwoLetterCode">getTwoLetterCode</a></div><div class="sidebar-section-children"><a href="global.html#hasAccessibleName">hasAccessibleName</a></div><div class="sidebar-section-children"><a href="global.html#hasAttribute">hasAttribute</a></div><div class="sidebar-section-children"><a href="global.html#hasCSSGeneratedContent">hasCSSGeneratedContent</a></div><div class="sidebar-section-children"><a href="global.html#hasHiddenParent">hasHiddenParent</a></div><div class="sidebar-section-children"><a href="global.html#hasParent">hasParent</a></div><div class="sidebar-section-children"><a href="global.html#hasValidAriaAttributes">hasValidAriaAttributes</a></div><div class="sidebar-section-children"><a href="global.html#hasValidAriaRole">hasValidAriaRole</a></div><div class="sidebar-section-children"><a href="global.html#isAriaAttributeValid">isAriaAttributeValid</a></div><div class="sidebar-section-children"><a href="global.html#isComplexTable">isComplexTable</a></div><div class="sidebar-section-children"><a href="global.html#isDataTable">isDataTable</a></div><div class="sidebar-section-children"><a href="global.html#isFocusable">isFocusable</a></div><div class="sidebar-section-children"><a href="global.html#isHidden">isHidden</a></div><div class="sidebar-section-children"><a href="global.html#isNotVisible">isNotVisible</a></div><div class="sidebar-section-children"><a href="global.html#isOffScreen">isOffScreen</a></div><div class="sidebar-section-children"><a href="global.html#isValidUrl">isValidUrl</a></div><div class="sidebar-section-children"><a href="global.html#isVisible">isVisible</a></div><div class="sidebar-section-children"><a href="global.html#langCodes">langCodes</a></div><div class="sidebar-section-children"><a href="global.html#luminance">luminance</a></div><div class="sidebar-section-children"><a href="global.html#matchesSelector">matchesSelector</a></div><div class="sidebar-section-children"><a href="global.html#parseRGB">parseRGB</a></div><div class="sidebar-section-children"><a href="global.html#rowCount">rowCount</a></div><div class="sidebar-section-children"><a href="global.html#rtls">rtls</a></div><div class="sidebar-section-children"><a href="global.html#sortByVisualOrder">sortByVisualOrder</a></div><div class="sidebar-section-children"><a href="global.html#strlen">strlen</a></div><div class="sidebar-section-children"><a href="global.html#testContrast">testContrast</a></div><div class="sidebar-section-children"><a href="global.html#testLang">testLang</a></div><div class="sidebar-section-children"><a href="global.html#testOrder">testOrder</a></div><div class="sidebar-section-children"><a href="global.html#validAriaAttributes">validAriaAttributes</a></div><div class="sidebar-section-children"><a href="global.html#validLangCodes">validLangCodes</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
|