Skip to content

Commit

Permalink
Revert "fix: remove not required check"
Browse files Browse the repository at this point in the history
This reverts commit 78f498e.
  • Loading branch information
marco-prontera committed Aug 22, 2023
1 parent 78f498e commit faad607
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions modules/core/src/GVL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,37 +442,41 @@ export class GVL extends Cloneable<GVL> implements VendorList {

const cacheLang = lang.toUpperCase();

this.lang_ = parsedLanguage;
if (parsedLanguage !== this.lang_) {

if (GVL.LANGUAGE_CACHE.has(cacheLang)) {
this.lang_ = parsedLanguage;

const cached: Declarations = GVL.LANGUAGE_CACHE.get(cacheLang) as Declarations;
if (GVL.LANGUAGE_CACHE.has(cacheLang)) {

for (const prop in cached) {
const cached: Declarations = GVL.LANGUAGE_CACHE.get(cacheLang) as Declarations;

if (cached.hasOwnProperty(prop)) {
for (const prop in cached) {

this[prop] = cached[prop];
if (cached.hasOwnProperty(prop)) {

this[prop] = cached[prop];

}

}

}
} else {

} else {
// load Language specified
const url = GVL.baseUrl + GVL.languageFilename.replace('[LANG]', this.lang_.toLowerCase());

// load Language specified
const url = GVL.baseUrl + GVL.languageFilename.replace('[LANG]', this.lang_.toLowerCase());
try {

try {
await this.fetchJson(url);

await this.fetchJson(url);
this.cacheLang_ = cacheLang;
this.cacheLanguage();

this.cacheLang_ = cacheLang;
this.cacheLanguage();
} catch (err) {

} catch (err) {
throw new GVLError('unable to load language: ' + err.message);

throw new GVLError('unable to load language: ' + err.message);
}

}

Expand Down

0 comments on commit faad607

Please sign in to comment.