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

后端 未结 2 556
故里飘歌
故里飘歌 2021-01-25 15:01

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

2条回答
  •  抹茶落季
    2021-01-25 15:56

    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"
        ]
    }
    

提交回复
热议问题