Fix english (#7)

* Fix english

* Add cat picture credit to the help command in portuguese.json

---------

Co-authored-by: GiovaniFZ <giovanifinazzi@gmail.com>
This commit is contained in:
mthlma 2024-07-29 20:08:29 -03:00 committed by GitHub
parent ac11b53619
commit 679cc423f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 6 deletions

View file

@ -1,8 +1,16 @@
const languageFiles = {
'pt': '../locales/portuguese.json',
'pt-br': '../locales/portuguese.json',
'en': '../locales/english.json'
};
function getStrings(languageCode) {
if (languageCode === 'pt' || 'pt-br') {
return require('../locales/portuguese.json');
} else {
return require('../locales/english.json');
const filePath = languageFiles[languageCode] || languageFiles['en'];
try {
return require(filePath);
} catch (error) {
console.error(`Error loading language file for code ${languageCode}:`, error);
return require(languageFiles['en']);
}
}