如何本地化Firefox SDK附加组件名称和描述?

时间:2022-05-19 07:22:52

I'm developing an add-on for Firefox and I now wish to localize the name and description of the add-on itself, as visible to the user in the Add-ons Manager menu.

我正在为Firefox开发一个附加组件,我现在希望本地化附加组件本身的名称和描述,这对于Add-ons Manager菜单中的用户是可见的。

However, the guides I've seen online only seem to mention preferences in package.json and nothing about the name of the add-on or its description. I have tried to apply the suggestions for preferences to the name/description fields and haven't had any success - it will always appear in English.

但是,我在网上看到的指南似乎只提到了package.json中的首选项,而没有提及附加组件的名称或其描述。我试图将偏好建议应用于名称/描述字段并且没有取得任何成功 - 它将始终以英语显示。

Is localization of these fields even possible?

这些领域的本地化是否可能?

2 个解决方案

#1


4  

There is currently no way to do this from package.json. Read bug 661083 for more details.

目前无法从package.json执行此操作。阅读错误661083以获取更多详细信息。

However, there is a workaround: Manually edit install.rdf to add em:localized properties.

但是,有一种解决方法:手动编辑install.rdf以添加em:local properties。

To do this you'll need to use the SDK to package your app into an xpi file. Then open the xpi (it is a zip file) and you'll see install.rdf in the root of the directory.

为此,您需要使用SDK将应用程序打包成xpi文件。然后打开xpi(它是一个zip文件),你会在目录的根目录中看到install.rdf。

The MDN article Localizing extension descriptions describes what structure the em:localized properties needs to have.

MDN文章本地化扩展描述描述了em:本地化属性需要具有的结构。

#2


0  

This functionality has been added to the jpm tool recently (February 2016, see issue 495). Make sure that you use a recent jpm version, then the following code in package.json will work:

此功能最近已添加到jpm工具中(2016年2月,请参阅问题495)。确保使用最近的jpm版本,然后package.json中的以下代码将起作用:

"title": "Default add-on name",
"description": "Default add-on description",
"locales": {
  "de": {
    "title": "Add-on name in German",
    "description": "Add-on description in German"
  },
  "ru": {
    "title": "Add-on name in Russian",
    "description": "Add-on description in Russian"
  },
}

#1


4  

There is currently no way to do this from package.json. Read bug 661083 for more details.

目前无法从package.json执行此操作。阅读错误661083以获取更多详细信息。

However, there is a workaround: Manually edit install.rdf to add em:localized properties.

但是,有一种解决方法:手动编辑install.rdf以添加em:local properties。

To do this you'll need to use the SDK to package your app into an xpi file. Then open the xpi (it is a zip file) and you'll see install.rdf in the root of the directory.

为此,您需要使用SDK将应用程序打包成xpi文件。然后打开xpi(它是一个zip文件),你会在目录的根目录中看到install.rdf。

The MDN article Localizing extension descriptions describes what structure the em:localized properties needs to have.

MDN文章本地化扩展描述描述了em:本地化属性需要具有的结构。

#2


0  

This functionality has been added to the jpm tool recently (February 2016, see issue 495). Make sure that you use a recent jpm version, then the following code in package.json will work:

此功能最近已添加到jpm工具中(2016年2月,请参阅问题495)。确保使用最近的jpm版本,然后package.json中的以下代码将起作用:

"title": "Default add-on name",
"description": "Default add-on description",
"locales": {
  "de": {
    "title": "Add-on name in German",
    "description": "Add-on description in German"
  },
  "ru": {
    "title": "Add-on name in Russian",
    "description": "Add-on description in Russian"
  },
}