MFEs aren't changing html lang attribute

未关闭 适合新手
#745 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
javascript

调研方向

从 src/i18n/lib.js 中第 262 行附近的 i18n configure 函数开始,将现有的 handleRtl 行为与 issue 建议的 HTML 更新进行比较。验证加载非 en-us 语言后,MFE 文档的 html lang 属性会更改为配置的 locale;当该属性反映 getLocale() 时即表示完成。

由索引模型根据 Issue 内容生成。

描述

a11y

When loading MFE using a language different than en-us. Eg: change the preferred language on the account MFE.

When we reload any MFE page, the lang html attribute didn't change even the application is translated to that new different language.

I think the MFEs should change the html lang attribute when it has been loaded with different language.

<html lang="en-us" dir="ltr">

Suggested change:

I think that the i18n configure function should change that value.
https://github.com/openedx/frontend-platform/blob/07ee86cf54d26dd1a8a98e24cf1a402e98157f61/src/i18n/lib.js#L262

Create a similar Should have a handleHTMLLang similar to handleRtl function, with code:

globalThis.document.getElementsByTagName('html')[0].setAttribute('lang', getLocale());
主要语言
JavaScript
星标
38
派生
90
平均合并
3 分钟
30 天内合并 PR
4

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openedx/frontend-platform 的其他 Issue

查看 openedx/frontend-platform 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。