/monaco-editor-chinese-plugin

A webpack plugin for monaco-editor locales setting

Primary LanguageJavaScriptMIT LicenseMIT

monaco-editor-chinese-plugin

npm install --save-dev monaco-editor-chinese-plugin

Usage

webpack config

const MonacoChinesePlugin = require('monaco-editor-chinese-plugin');

module.exports = {
    ...
    plugins: [
        new MonacoChinesePlugin({
            //defaultLanguage: "getLanguageSetting()",
            /**
             * log on console if unmatched
             */
            logUnmatched: false,
            /**
             * self languages map, .eg {"zh-cn": {"Find": "查找", "Search": "搜索"}, "de":{}, ... }
             */
            mapLanguages: {},
        })
    ]
}

HzeroJs Usage

webpack config

const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const MonacoChinesePlugin = require('monaco-editor-chinese-plugin');

const config: IConfig = {
  chainWebpack: (c) => {
    c.plugin('monaco-editor-webpack-plugin').use(new MonacoWebpackPlugin({
      languages: ['javascript', 'typescript', 'sql', 'json'],
    }));
    c.plugin('monaco-editor-chinese-plugin').use(new MonacoChinesePlugin({
      logUnmatched: true,
    }));
    // ......
  },
  // 其余配置 ......
};
export default config;