0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00

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 12 additions and 3 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: #experiments:
# # support for npm token command # # support for npm token command
# token: false # 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/local-storage": "^9.3.4",
"@verdaccio/readme": "^9.3.3", "@verdaccio/readme": "^9.3.3",
"@verdaccio/streams": "^9.3.2", "@verdaccio/streams": "^9.3.2",
"@verdaccio/ui-theme": "^0.3.13", "@verdaccio/ui-theme": "^1.0.0",
"JSONStream": "1.3.5", "JSONStream": "1.3.5",
"async": "3.1.1", "async": "3.1.1",
"body-parser": "1.19.0", "body-parser": "1.19.0",

View file

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

BIN
yarn.lock

Binary file not shown.