经典引导程序
在经典的引导插件中,您不需要设置默认值。 Firefox 会自动找出用户浏览器和插件所具有的任何区域设置之间最接近的区域设置。
JPM
您正在开发 JPM/SDK 插件吗?如果要本地化首选项,则必须首先在package.json
:
"preferences": [
{
"name": "imagePath",
"type": "file",
"value": "",
"title": "Image File Path",
"description": "A path to an image on your computer that the dock icon should be set to"
},
{
"name": "restoreDefault",
"type": "control",
"title": "default locale:Restore Default",
"description": "this is from package.json:: If you have changed your icon, and want to restore the default Firefox icon, click this button",
"label": "this is from package.json:: Restore"
}
]
所以默认值就是您在那里设置的任何内容。如果 Firefox 找不到与所提供的区域设置匹配的内容,它将使用 package.json 中的字符串。
例如,要本地化restoreDefault
您将创建一个字符串en-US.properties
文件并将其放入名为的文件夹中locale
像这样:
restoreDefault_title=blah Restore Default blah
restoreDefault_description=blahIf you have changed your icon, and want to restore the default Firefox icon, click this buttonblah
restoreDefault_label=blahRestoreblah
因此,现在通过 about:config 将浏览器区域设置设置为英语,然后更改首选项general.useragent.locale
然后到其他的东西en-US
(将其更改为es
)对于此示例,然后加载您的首选项页面(更改后可能需要重新启动浏览器general.useragent.locale
)。现在因为你的插件没有es.properties
您将看到 package.json 中的字符串。设置你的general.useragent.locale
返回 en-us,然后重新启动浏览器,然后返回插件首选项页面,您将看到属性文件中的字符串。