Docker+Nginx部署Angular国际化i18n
在Angular项目中添加default.conf文件
default.conf
为了支持局域网,增加一个域名,即本地的局域网ip地址。
server {listen 80;server_name localhost;server_name 192.168.2.172;location / {root /usr/share/nginx/html;location ~* /([a-z\-)]+)/ {try_files $uri /$1/index.html /index.html;}try_files $uri $uri/index.html /index.html;}
}
package.json
...
"build-i18n:zh": "ng build --prod --outputPath=dist/zh --i18nFile=src/locale/messages.zh.xlf --i18nFormat=xlf --locale=zh-Hans",
"build-i18n:en": "ng build --prod --outputPath=dist/en --i18nFile=src/locale/messages.en.xlf --i18nFormat=xlf --locale=en-US",
"build-i18n": "npm run build-i18n:zh; npm run build-i18n:en",
"sta