diff --git a/ui/Dockerfile b/ui/Dockerfile index 8ee2d4399..8621518eb 100644 --- a/ui/Dockerfile +++ b/ui/Dockerfile @@ -6,7 +6,7 @@ WORKDIR /app # Install some useful utils for debug/test RUN \ apt-get update && \ - apt -y install python3 make gcc g++ && \ + apt -y install python3 make gcc g++ vim && \ rm -rf /var/lib/apt/lists/* # Install app dependencies @@ -19,8 +19,7 @@ COPY package*.json ./ RUN \ npm config list && \ - npm config delete proxy && \ - npm install --loglevel silly + npm install # Bundle app source COPY . . diff --git a/ui/container-files/etc/nginx/conf.d/default.conf b/ui/container-files/etc/nginx/conf.d/default.conf index c46b77f33..f8c8a1bd9 100644 --- a/ui/container-files/etc/nginx/conf.d/default.conf +++ b/ui/container-files/etc/nginx/conf.d/default.conf @@ -1,14 +1,25 @@ +map $ccokie_locale $langCode { + default en; + ~*^cs cs; + ~*^de de; + ~*^es es; + ~*^fr fr; + ~*^it it; + ~*^ja ja; + ~*^ko ko; + ~*^pt pt; + ~*^ru ru; + ~*^ui ui; + ~*^zh-CN zh-CN; + ~*^zh-TW zh-TW; +} + server { listen 8090; server_name localhost; #access_log /var/log/nginx/host.access.log main; - # Fallback to default language if no preference defined by browser - if ($accept_language ~ "^$") { - set $accept_language "en"; - } - location / { root /usr/share/nginx/html; index index.html index.htm; @@ -16,11 +27,11 @@ server { location ~ ^/ui/(.*) { # Redirect requests for `/ui/(.*)` to the Angular application in the preferred language of the browser # For reference on multi language support see: https://angular.io/guide/i18n-common-deploy#configure-a-server - rewrite ^/ui/(.*)$ /$accept_language/$1 break; + rewrite ^/ui/(.*)$ /${langCode}/$1 break; # Configure a fallback route in the NGinX server to serve the index.html when requests arrive for `/ui/login` # Requires static html content to have a `base-href=./` entry - try_files $uri $uri/ /$accept_language/index.html?$args; + try_files $uri $uri/ /${langCode}/index.html?$args; # Or use the following line instead # auto-index on; diff --git a/ui/container-files/etc/nginx/nginx.conf b/ui/container-files/etc/nginx/nginx.conf index 22027e11c..7b7dbe13c 100644 --- a/ui/container-files/etc/nginx/nginx.conf +++ b/ui/container-files/etc/nginx/nginx.conf @@ -25,24 +25,6 @@ http { #gzip on; - # Browser preferred language detection (does NOT require AcceptLanguageModule) - # For reference on multi language support see: https://angular.io/guide/i18n-common-deploy#configure-a-server - map $http_accept_language $accept_language { - default en; - ~*^cs cs; - ~*^de de; - ~*^es es; - ~*^fr fr; - ~*^it it; - ~*^ja ja; - ~*^ko ko; - ~*^pt pt; - ~*^ru ru; - ~*^ui ui; - ~*^zh-CN zh-CN; - ~*^zh-TW zh-TW; - } - include /etc/nginx/conf.d/*.conf; }