Skip to content

Commit

Permalink
Cleanup translator.js
Browse files Browse the repository at this point in the history
wrong sectioned comments
  • Loading branch information
Vairgrys authored Nov 27, 2023
1 parent 453e7b3 commit 48e4efe
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/lang/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export class TranslatorError extends Error {
constructor(msg) {
super('Translator: ' + msg);
this.name = 'TranslatorError';

}
}

Expand All @@ -34,11 +33,9 @@ class Translator extends Class {
* @example setLang('zh-CN')
*/
setLang(lang) {

const newLanguageNodes = this.languages[lang];
if (!newLanguageNodes) throw new TranslatorError('Setted Lang does not exist');
this.nodes = newLanguageNodes;

}

_validateNestedProps(nestedProps) {
Expand Down Expand Up @@ -76,14 +73,11 @@ class Translator extends Class {
} catch (err) {
throw new TranslatorError('Unable to find the text translated in lang json' + err.message);
}

} else {
translatedText = this.nodes[textNode];
return translatedText;
}

} else {
// what to do if textnode has no dot on string
throw new TranslatorError('Param passed has to be a String');
}
}
Expand Down

0 comments on commit 48e4efe

Please sign in to comment.