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:
parent
981efa5571
commit
c493b316b1
5 changed files with 12 additions and 3 deletions
6
.babelrc
6
.babelrc
|
@ -1,3 +1,7 @@
|
||||||
{
|
{
|
||||||
"presets": [["@verdaccio"]]
|
"presets": [["@verdaccio"]],
|
||||||
|
"plugins": [
|
||||||
|
"@babel/plugin-proposal-optional-chaining",
|
||||||
|
"@babel/plugin-proposal-nullish-coalescing-operator"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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
BIN
yarn.lock
Binary file not shown.
Loading…
Reference in a new issue