Chrome Extension localization issue when adding it -- says i didnt specify default locale even though i did

时间:2015-12-14 18:05:16

标签: javascript json google-chrome google-chrome-extension manifest

Error Message: "Package is invalid. Details: 'Localization used, but default_locale wasn't specified in the manifest.'.

Problem: I have created a custom extension and specified a default locale, but chrome wont allow me to add it to the extension bar and throws the above message. i also have the _locales folder in my directory as necessary. Might it have something to do with that folder or its location?

Manifest:

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

1 个答案:

答案 0 :(得分:1)

您的清单似乎完全无效:"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"
    },