feat: i18n on web (#1750)

* feat: add i18n to web

* chore: enable es features
This commit is contained in:
Juan Picado @jotadeveloper 2020-03-14 07:16:47 +01:00 committed by GitHub
parent 981efa5571
commit c493b316b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 12 deletions

View File

@ -1,3 +1,7 @@
{
"presets": [["@verdaccio"]]
"presets": [["@verdaccio"]],
"plugins": [
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator"
]
}

View File

@ -71,3 +71,7 @@ logs:
#experiments:
# # support for npm token command
# token: false
# This affect the web and api (not developed yet)
#i18n:
#web: en-US

View File

@ -24,7 +24,7 @@
"@verdaccio/local-storage": "^9.3.4",
"@verdaccio/readme": "^9.3.3",
"@verdaccio/streams": "^9.3.2",
"@verdaccio/ui-theme": "^0.3.13",
"@verdaccio/ui-theme": "^1.0.0",
"JSONStream": "1.3.5",
"async": "3.1.1",
"body-parser": "1.19.0",

View File

@ -80,10 +80,11 @@ export default function(config, auth, storage) {
const { url_prefix } = config;
const uri = `${protocol}://${host}`;
const base = combineBaseUrl(protocol, host, url_prefix);
const languageWeb = config?.i18n?.web ?? 'es-US';
const primaryColor = _.get(config, 'web.primary_color') ? config.web.primary_color : '';
const title = _.get(config, 'web.title') ? config.web.title : WEB_TITLE;
const scope = _.get(config, 'web.scope') ? config.web.scope : '';
const options = { uri, protocol, host, url_prefix, base, primaryColor, title, scope };
const options = { uri, protocol, host, url_prefix, base, primaryColor, title, scope, language: languageWeb };
const webPage = template
.replace(/ToReplaceByVerdaccioUI/g, JSON.stringify(options))

View File

@ -1969,10 +1969,10 @@
resolved "https://registry.verdaccio.org/@verdaccio%2fui-theme/-/ui-theme-0.3.9.tgz#6ff0f05315912b4ba39e29eb589ecc8833640990"
integrity sha512-InTpEowYo6M9TjpQh4cVh/HZH1DW9oyhy8UpC1H4FOwvyknctN0dMavOseKWSrPAj+gPDzUw0IKAvwDI4OcPEg==
"@verdaccio/ui-theme@^0.3.13":
version "0.3.13"
resolved "https://registry.verdaccio.org/@verdaccio%2fui-theme/-/ui-theme-0.3.13.tgz#e6f06907b0940c47883f35861723012437b7b958"
integrity sha512-3nDT5iJvmIYJe8UwirJbHexy21HU0YUkwvKygVe2KCPUTQu8u23/w6JyOB8reqj8w0xFfJMHI0dArnPsKxYM3Q==
"@verdaccio/ui-theme@^1.0.0":
version "1.0.0"
resolved "https://registry.verdaccio.org/@verdaccio%2fui-theme/-/ui-theme-1.0.0.tgz#53706449fdb2e66e06a22867deb3efedf6ddc9d2"
integrity sha512-gUggtAV9lOa2SmhYZmRRd/AGR5HmZ+N3uGoXnZXVjPckTetE/fsB8mqkSYZCk0SrO767j82JGhyU8O/JVKM8jw==
"@yarnpkg/lockfile@^1.1.0":
version "1.1.0"
@ -6578,11 +6578,6 @@ mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
dependencies:
minimist "0.0.8"
mkdirp@1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.3.tgz#4cf2e30ad45959dddea53ad97d518b6c8205e1ea"
integrity sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==
mkdirp@1.0.3:
version "1.0.3"
resolved "https://registry.verdaccio.org/mkdirp/-/mkdirp-1.0.3.tgz#4cf2e30ad45959dddea53ad97d518b6c8205e1ea"