🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## lang - plsomo 支持多语言 支持一下路径 ``` /locales/{lang}/messages.json /assets/_locales/{lang}/messages.json /assets/locales/{lang}/messages.json ``` ## 示例 ## Sample locales/en/messages.json ``` { "extensionName": { "message": "with-locales-i18n-en", "description": "Name of the extension." }, "extensionDescription": { "message": "Example using locales + i18n!", "description": "Description of the extension." }, "popup": { "message": "Logic is the beginning of wisdom, not the end.", "description": "Popup message." } } ``` package.json ``` { "manifest": { "default_locale": "en" } } ``` 使用 ``` chrome.i18n.getMessage("popup") ``` ## 使用环境变量 locales/en/messages.json ``` { ... "popup": { "message": "Logic is the beginning of wisdom, not the end. - $PLASMO_PUBLIC_QUOTE_AUTHOR", "description": "Popup message." } } ``` .env ``` PLASMO_PUBLIC_QUOTE_AUTHOR=Spock ```