在 ARIA 中使用 l10n(本地化语言)字符串

Using l10n (language localized) strings with ARIA

我正在尝试让我的扩展通过本地化字符串使用 aria 标签,如 MDN 中所述。所以,我有一个属性文件,内容如下:

new_file=New file
new_file.ariaLabel=Creates a new file

然后,我尝试在侧边栏中使用它 html 代码:

<button type="button" class="btn ui-button">
  <span class="glyphicon glyphicon-plus" 
        data-l10n-id="new_file" 
        aria-label="new_file.ariaValueText"/>
</button>

new_file在span中有效,我能读懂它,但读不懂aria标签。我尝试在 html 中不指定 aria-label 也写任何东西,但它不起作用。我错过了什么?提前致谢!

将侧边栏设为 xhtml 文件。然后使用 l10n xhtml 本地化:https://github.com/Noitidart/l10n/tree/xhtml-xul 您可以使用此技术填充您的 aria- 标签。

这里有一份很棒的 MDN 指南,正是我给你的 github link:https://developer.mozilla.org/en-US/Add-ons/Bootstrapped_extensions#Localization_%28L10n%29

这是一个 link 到 l10n html 选项页面(xhtml 只是 html 带有本地化文件)https://github.com/Noitidart/l10n/tree/html-options