firefox addon webextensions - Web extension `messages.json` translation include other translation from same file - Stack Overflo

For a web extension messages.json translation file, is it possible that a translation includes another

For a web extension messages.json translation file, is it possible that a translation includes another translation? That would be useful when you want to avoid duplication.

For example something like:

{
  "greeting": {
    "message": "Hello, $NAME$!",
    "placeholders": {
      "name": {
        "content": "$first_name$"
      }
    }
  },
  "first_name": {
    "message": "John"
  }
}

Neither the above approach of referring to another message using $<name>$ nor using __MSG_<name>__ within messages.json seem to work. I am looking for something which ideally works for Chrome and Firefox.

A workaround might be to nest getMessage calls and use $1 as placeholder in the message, but that is rather verbose and error-prone because every caller which wants to obtain the translation has to do this:

browser.i18n.getMessage('greeting', browser.i18n.getMessage('first_name'))

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744584358a4582225.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信