Can you rename the “Option” label ? ( Chrome-Extension )

感情迁移 提交于 2019-12-20 04:33:06

问题


I tried this : https://developer.chrome.com/extensions/options.html and made an option page.

So a selection has been added under my extension icon with the name of Option.

My question is that is there a way to rename Option and change it something like Setting or some words in other languages ?


回答1:


The "Options" label at chrome://extensions is automatically adapted to the user's language. Extensions cannot change the value of this label.

The value of the "Options" option at the dropdown menu at the extension's button cannot be customized either, but you can create a new context menu item under the button as of Chrome 38. E.g.

chrome.contextMenus.create({
    id: 'show-settings', // or any other name
    title: 'Settings',
    contexts: ['page_action', 'browser_action']
});
chrome.contextMenus.onClicked.addListener(function(info, tab) {
    if (info.menuItemId == 'show-settings') {
        chrome.tabs.create({
            url: chrome.runtime.getURL('settings.html')
        });
    }
});

I suggest to just stick to "Options" though, because users do already know what the option does. Consistency in UI/UX is important, imagine how you productive you'd be if every application had a different way of (e.g.) closing/quiting the application.

manifest.json to test the previous script:

{
    "name": "Contextmenu on browserAction button",
    "version": "1",
    "manifest_version": 2,
    "background": {
        "scripts": ["background.js"]
    },
    "browser_action": {
        "default_title": "Right-click to see a context menu"
    },
    "permissions": [
        "contextMenus"
    ]
}


来源:https://stackoverflow.com/questions/25784901/can-you-rename-the-option-label-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!