你可以重新命名“选项”标签 ? (Chrome扩展程序) [英] Can you rename the "Option" label ? ( Chrome-Extension )

查看:154
本文介绍了你可以重新命名“选项”标签 ? (Chrome扩展程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过这个: https://developer.chrome.com/extensions/options.html 并创建一个选项页面。

因此,在我的扩展名图标下添加了一个名称为 Option 的选择。



我的问题是,有没有办法重命名 Option 并将其改为设置或其他语言的单词?

解决方案

chrome:// extensions 会自动适应用户的语言。扩展程序无法更改此标签的值。



扩展程序按钮下拉菜单中的选项选项的值不能自定义,但您可以创建在Chrome 38之后的按钮下的 new 上下文菜单项。例如

  chrome.contextMenus.create({
id:'show-settings',//或任何其他名称
title:'设置',
上下文:['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')
});
}
});

我建议只坚持使用Options,因为用户已经知道该选项的作用。 UI / UX中的一致性很重要,想象一下,如果每个应用程序都有不同的方式(例如)关闭/退出应用程序,那么您的生产效率如何。



清单。 json测试前面的脚本:
$ b

  {
name:Contextmenu on browserAction button,
version:1,
manifest_version:2,
background:{
scripts:[background.js]

browser_action:{
default_title:右键单击以查看上下文菜单

permissions:[
contextMenus

}


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 ?

解决方案

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

这篇关于你可以重新命名“选项”标签 ? (Chrome扩展程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆