編譯messages.po文件
pybabel compile -d translations
修改config文件
# --------------------------------------------------- # Babel config for translations # --------------------------------------------------- # Setup default language BABEL_DEFAULT_LOCALE = 'zh' # Your application default translation path BABEL_DEFAULT_FOLDER = 'babel/translations' # The allowed translation for you app LANGUAGES = { 'en': {'flag': 'us', 'name': 'English'}, #'it': {'flag': 'it', 'name': 'Italian'}, # 'fr': {'flag': 'fr', 'name': 'French'}, 'zh': {'flag': 'cn', 'name': 'Chinese'}, }
可詳見Flask AppBuilder文檔
http://flask-appbuilder.readthedocs.io/en/latest/_modules/flask_appbuilder/baseviews.html?highlight=description_columns
Sqlalchemy文檔
http://docs.sqlalchemy.org/en/latest/core/tutorial.html
SuperSet深度漢化
SuperSet前段修改需要重新打包需要npm run build或者npm run dev
因為在\superset\static\assets路徑下package.json "test": "mocha --require ignore-styles --compilers js:babel-core/register --require spec/helpers/browser.js --recursive spec/**/*_spec.*", "cover": "babel-node node_modules/.bin/babel-istanbul cover _mocha -- --require spec/helpers/browser.js --recursive spec/**/*_spec.*", "dev": "NODE_ENV=dev webpack --watch --colors --progress --debug --output-pathinfo --devtool inline-source-map", "dev-fast": "NODE_ENV=dev webpack --watch --colors --progress --debug --output-pathinfo --devtool eval-cheap-source-map", "prod": "NODE_ENV=production node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js -p --colors --progress", "build": "NODE_ENV=production webpack --colors --progress", "lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx .", "sync-backend": "babel-node --presets es2015 javascripts/syncBackend.js"
npm run xxx:執行package.json,xxx可以在”scripts”中找到,build、prod之類的都是自己配的。每當執行npm run,就會自動新建一個 Shell,在這個 Shell 里面執行指定的腳本命令。會生成dist目錄,即壓縮之后的js文件目錄,其中webpack –watch為監聽頁面變動並自動打包
sync-backend方式打包
$ node --version v7.9.0 $ npm --version 4.2.0 $ cd superset/assets/ $ yarn --version 0.27.5 $ yarn $ npm run sync-backend $ npm run prod $ npm run dev