开发者

How to insert localized meta-tags from provided language files?

开发者 https://www.devze.com 2023-04-12 21:25 出处:网络
I wonder if there exists another solution, to insert localized extension meta-tags automatically without adding them manually to install.rdf, for example by using a language variable (see example belo

I wonder if there exists another solution, to insert localized extension meta-tags automatically without adding them manually to install.rdf, for example by using a language variable (see example below):

example: myextension/chrome/locale/ru-RU/install.dtd

mylang.description=example description

my install.rdf:

<em:localized>
  <Description>
    <em:locale>ru-RU</em:locale>
    <em:description>&mylang.description;</em:description> //<-- inpossible?
  </Description>
</em:localized>

or by a method, that automatically overwrites the standard install.rdf's <description>-tag with the user's language (from a file provided in myext开发者_如何学编程ension/chrome/locale/[LANG]/* ?


background:

so far, we've translated the <description>-tag (and sometimes the <name>-tag too) for more than 20 languages - i'm just looking for a way, to manage this tangle inside my install.rdf...


You can provide localized descriptions via a localized preference pointing to a .properties file in your locale directory, see Localizing before Gecko 1.9 (this approach is still supported despite the article title). However, this approach has the disadvantage that the descriptions are only available if the extension is enabled - if the user disables your extension only the description from install.rdf will show up. Which is why I prefer using build scripts that will generate localization info in install.rdf from files in the locale directory.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号