fix: vue3 language switcher (#2712)

This commit is contained in:
dni ⚡
2024-09-25 12:09:00 +02:00
committed by GitHub
parent 04882e05a3
commit 3ac6bc3c3b
12 changed files with 269 additions and 372 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+12 -12
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -23,10 +23,10 @@ window.app = Vue.createApp({
},
methods: {
activeLanguage: function (lang) {
return window.i18n.locale === lang
return window.i18n.global.locale === lang
},
changeLanguage: function (newValue) {
window.i18n.locale = newValue
window.i18n.global.locale = newValue
this.$q.localStorage.set('lnbits.lang', newValue)
},
toggleDarkMode: function () {
+1 -1
View File
@@ -615,7 +615,7 @@ window.windowMixin = {
let locale = this.$q.localStorage.getItem('lnbits.lang')
if (locale) {
window.LOCALE = locale
window.i18n.locale = locale
window.i18n.global.locale = locale
}
this.g.langs = window.langs ?? []
+3 -2
View File
@@ -3190,13 +3190,13 @@ body.platform-ios .q-layout--containerized {
position: fixed !important;
display: inline-block;
max-width: 95vw;
max-height: 65vh;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2), 0 2px 2px rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.12);
background: #fff;
border-radius: 4px;
overflow-y: auto;
overflow-x: hidden;
outline: 0;
max-height: 65vh;
z-index: 6000;
}
.q-menu--square {
@@ -5619,6 +5619,8 @@ body.desktop .q-toggle--dense:not(.disabled):focus .q-toggle__thumb:before, body
overflow-y: auto;
overflow-x: hidden;
padding: 6px 10px;
max-width: 95vw;
max-height: 65vh;
}
@media (max-width: 599.98px) {
.q-tooltip {
@@ -5900,7 +5902,6 @@ body.desktop .q-toggle--dense:not(.disabled):focus .q-toggle__thumb:before, body
height: 200px;
min-width: 200px;
background-position: 50% 50%;
background-size: cover;
background-repeat: no-repeat;
}
.q-uploader__file--img:before {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+40 -22
View File
@@ -1,5 +1,5 @@
/*!
* vue-router v4.4.3
* vue-router v4.4.5
* (c) 2024 Eduardo San Martin Morote
* @license MIT
*/
@@ -8,8 +8,24 @@ var VueRouter = (function (exports, vue) {
const isBrowser = typeof document !== 'undefined';
/**
* Allows differentiating lazy components from functional components and vue-class-component
* @internal
*
* @param component
*/
function isRouteComponent(component) {
return (typeof component === 'object' ||
'displayName' in component ||
'props' in component ||
'__vccOpts' in component);
}
function isESModule(obj) {
return obj.__esModule || obj[Symbol.toStringTag] === 'Module';
return (obj.__esModule ||
obj[Symbol.toStringTag] === 'Module' ||
// support CF with dynamic imports that do not
// add the Module string tag
(obj.default && isRouteComponent(obj.default)));
}
const assign = Object.assign;
function applyToParams(fn, params) {
@@ -1412,13 +1428,14 @@ var VueRouter = (function (exports, vue) {
mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record;
const options = mergeOptions(globalOptions, record);
// generate an array of records to correctly handle aliases
const normalizedRecords = [
mainNormalizedRecord,
];
const normalizedRecords = [mainNormalizedRecord];
if ('alias' in record) {
const aliases = typeof record.alias === 'string' ? [record.alias] : record.alias;
for (const alias of aliases) {
normalizedRecords.push(assign({}, mainNormalizedRecord, {
normalizedRecords.push(
// we need to normalize again to ensure the `mods` property
// being non enumerable
normalizeRouteRecord(assign({}, mainNormalizedRecord, {
// this allows us to hold a copy of the `components` option
// so that async components cache is hold on the original record
components: originalRecord
@@ -1431,7 +1448,7 @@ var VueRouter = (function (exports, vue) {
: mainNormalizedRecord,
// the aliases are always of the same kind as the original since they
// are defined on the same record
}));
})));
}
}
let matcher;
@@ -1642,12 +1659,12 @@ var VueRouter = (function (exports, vue) {
* @returns the normalized version
*/
function normalizeRouteRecord(record) {
return {
const normalized = {
path: record.path,
redirect: record.redirect,
name: record.name,
meta: record.meta || {},
aliasOf: undefined,
aliasOf: record.aliasOf,
beforeEnter: record.beforeEnter,
props: normalizeRecordProps(record),
children: record.children || [],
@@ -1655,10 +1672,19 @@ var VueRouter = (function (exports, vue) {
leaveGuards: new Set(),
updateGuards: new Set(),
enterCallbacks: {},
// must be declared afterwards
// mods: {},
components: 'components' in record
? record.components || null
: record.component && { default: record.component },
};
// mods contain modules and shouldn't be copied,
// logged or anything. It's just used for internal
// advanced use cases like data loaders
Object.defineProperty(normalized, 'mods', {
value: {},
});
return normalized;
}
/**
* Normalize the optional `props` in a record to always be an object similar to
@@ -2148,10 +2174,12 @@ var VueRouter = (function (exports, vue) {
}
guards.push(() => componentPromise.then(resolved => {
if (!resolved)
return Promise.reject(new Error(`Couldn't resolve component "${name}" at "${record.path}"`));
throw new Error(`Couldn't resolve component "${name}" at "${record.path}"`);
const resolvedComponent = isESModule(resolved)
? resolved.default
: resolved;
// keep the resolved module for plugins like data loaders
record.mods[name] = resolved;
// replace the function with the resolved component
// cannot be null or undefined because we went into the for loop
record.components[name] = resolvedComponent;
@@ -2166,18 +2194,6 @@ var VueRouter = (function (exports, vue) {
}
return guards;
}
/**
* Allows differentiating lazy components from functional components and vue-class-component
* @internal
*
* @param component
*/
function isRouteComponent(component) {
return (typeof component === 'object' ||
'displayName' in component ||
'props' in component ||
'__vccOpts' in component);
}
/**
* Ensures a route is loaded, so it can be passed as o prop to `<RouterView>`.
*
@@ -2197,6 +2213,8 @@ var VueRouter = (function (exports, vue) {
const resolvedComponent = isESModule(resolved)
? resolved.default
: resolved;
// keep the resolved module for plugins like data loaders
record.mods[name] = resolved;
// replace the function with the resolved component
// cannot be null or undefined because we went into the for loop
record.components[name] = resolvedComponent;
File diff suppressed because one or more lines are too long