Prevent adding extra `/` when concatenating locale paths (#2665)

* Formatting the locales pathname to be more accurate

Before this change, the URL would refer
`https://localhost//static/locales/${locale}.json`
which technically works in most web browsers,
but it does not work in Cordova at all, so this
changes the links to be more accurately:
`https://localhost/static/locales/${locale}.json`

* Removing usage of `path` because it requires a polyfill/shim

* Linting the code
This commit is contained in:
Emma 2022-10-02 19:38:01 -04:00 committed by GitHub
parent a621c83a90
commit f722340962
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class CustomVueI18n extends VueI18n {
}
if (url.pathname) {
url.pathname += `/static/locales/${locale}.json`
url.pathname += `${!url.pathname.endsWith('/') ? '/' : ''}static/locales/${locale}.json`
} else {
url.pathname = `/static/locales/${locale}.json`
}