Skip to content

Commit

Permalink
Lang: fix typo and show which key is missing on database
Browse files Browse the repository at this point in the history
  • Loading branch information
themitosan committed Dec 11, 2024
1 parent e2760ad commit c2175d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"unableSetLang_fileNotFound": "Não foi possível localizar arquivo de idioma: %VAR_0%",
"errorUnableLoadLang": "ERRO - Não foi possível carregar idioma %VAR_0%!\nMotivo: %VAR_1%",
"errorUnableLoadLang_fileNotFound": "Não foi possível carregar idioma \"%VAR_0%\" por que o arquivo não foi encontrado ou não é um arquivo válido.",
"errorUnableLoadLang_keyMismatch": "Número de itens / chaves difere do banco de dados! Repare o arquivo de idioma ou restaure o idioma para \"en-us\" nas configurações de usuário.",
"errorUnableLoadLang_keyMismatch": "Número de itens / chaves difere do banco de dados!\n\"%VAR_0%\" não está presente no arquivo de idimoa.\n\nRepare o arquivo de idioma ou restaure o idioma para \"en-us\" nas configurações de usuário.",
"displayLangList": "==> Veja a lista de todos os idiomas que podem ser escolhidos:\n\n%VAR_0%\n\nPara aplicar, basta usar a opção \"grpp --setLang=[LANG]\". (Sem aspas)\n"
}

Expand Down
14 changes: 7 additions & 7 deletions src/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export var langDatabase:any = {
"errorConfigFileNotExists": "Unable to read data from %VAR_0%.git because config file doesn't exists!\nGRPP will remove this repo entry from database...",
"pushErrorWarn": "WARN - %VAR_0%",

"warnDbVersionMismatch": "WARN - It seems that your database version is from another grpp version!\nMake sure to run grpp on repair mode to prevent any possible issues."
"warnDbVersinoMismatch": "WARN - It seems that your database version is from another grpp version!\nMake sure to run grpp on repair mode to prevent any possible issues."

},

Expand Down Expand Up @@ -209,7 +209,7 @@ export var langDatabase:any = {
"unableSetLang_fileNotFound": "Unable to locate lang file: %VAR_0%",
"errorUnableLoadLang": "ERROR - Unable to load lang %VAR_0%!\nReason: %VAR_1%",
"errorUnableLoadLang_fileNotFound": "Unable to load lang \"%VAR_0%\" because it was not found or is not a valid file.",
"errorUnableLoadLang_keyMismatch": "Key counter mismatch from main lang database! Please fix lang file or reset user settings lang to \"en-us\".",
"errorUnableLoadLang_keyMismatch": "Key counter mismatch from main lang database!\n\"%VAR_0%\" is not present on lang file!\n\nPlease fix lang file or reset user settings lang to \"en-us\".",
"displayLangList": "==> Here is the list of all available languages you can pick:\n\n%VAR_0%\n\nTo set, run \"grpp --setLang=[LANG]\". (Without quotes)\n"
}

Expand Down Expand Up @@ -284,8 +284,8 @@ export async function grpp_loadLang(){
async function checkLangKeys(langKeys:any){
return new Promise<void>(function(resolve){

// Create isValidLang var and check object function
var isValidLang = !0;
// Create missingKeys var and check object function
const missingKeys:string[] = [];
const checkObject = function(currentObject:any, sampleObject:any){

// Create object array and start check process
Expand All @@ -295,7 +295,7 @@ async function checkLangKeys(langKeys:any){
// Get current key and check if sample object contains it
const currentKey = objectArray[keyIndex];
if (sampleObject[currentKey] === void 0){
isValidLang = !1;
missingKeys.push(currentKey);
break;
}

Expand All @@ -308,11 +308,11 @@ async function checkLangKeys(langKeys:any){

// Start check process and check if current lang file is valid
checkObject(langKeys, langDatabase);
if (isValidLang === !0){
if (missingKeys.length === 0){
langDatabase = structuredClone(langKeys);
resolve();
} else {
throw langDatabase.lang.errorUnableLoadLang_keyMismatch;
throw grpp_convertLangVar(langDatabase.lang.errorUnableLoadLang_keyMismatch, [missingKeys]);
}

});
Expand Down

0 comments on commit c2175d4

Please sign in to comment.