javascript – 添加它时Chrome扩展程序本地化问题 – 说我没有指定默认语言环境,即使我这样做了

错误信息:

“包无效.详细信息:’使用了本地化,但未在清单中指定default_locale.’.

问题:
我创建了一个自定义扩展并指定了默认语言环境,但chrome不允许我将其添加到扩展栏并抛出上述消息.我根据需要在我的目录中也有_locales文件夹.它可能与该文件夹或其位置有关吗?

表现:

{
    "name": "NAMENAMENAMENAME",
    "short_name": "xxx",
    "version": "0.0.3",
    "manifest_version": 2,
    "description": "This does something or other.",
        "browser_action": {
            "default_icon": {
            "16": "icons/yokel16.jpg",
            "48": "icons/yokel48.jpg",
            "default_title": "CCJ",
            "default_popup": "popup.html"
            }
        },
   "icons": {
       "16": "icons/yokel16.jpg",
       "19": "icons/yokel19.jpg",
       "48": "icons/yokel48.jpg",
       "128": "icons/yokel128.jpg"
       },
   "default_locale": "en",
       "background": {
           "page": "popup.js",
           "persistent": false
        },
  "permissions": [
     "cookies",
     "history",
     "tabs",
     "{{some URL}}"
     ]
}

最佳答案 您的清单似乎完全无效:“browser_action”键溢出到“default_icon”.

这可能会导致Chrome关闭,并且它会给出错误的错误消息(抱怨在抱怨格式错误的清单之前缺少default_locale).

你有:

    "browser_action": {
        "default_icon": {
        "16": "icons/yokel16.jpg",
        "48": "icons/yokel48.jpg",
        "default_title": "CCJ",
        "default_popup": "popup.html"
        }
    },

应该是(生成适当的图标大小,16和48不是Chrome所期望的):

    "browser_action": {
        "default_icon": {
            "19": "icons/yokel48.jpg",
            "38": "icons/yokel48.jpg"
        },
        "default_title": "CCJ",
        "default_popup": "popup.html"
    },
点赞