use exhaustive switch instead of if statements

This commit is contained in:
Marco Antonio J. Costa
2026-07-21 18:39:50 -03:00
committed by majcosta
parent 30e5d8f91c
commit 433de0e67b
2 changed files with 26 additions and 13 deletions
+21 -13
View File
@@ -483,19 +483,27 @@ namespace Loc
}
bool Translate(vfs::String::char_t* str, int len, i18n::Lang lang)
{
if(lang == i18n::Lang::en || lang == i18n::Lang::de)
{
return true;
}
else if(lang == i18n::Lang::ru)
{
for(int i=0; i<len; i++) str[i] = ToRussian(str[i]);
return true;
}
else if(lang == i18n::Lang::pl)
{
for(int i=0; i<len; i++) str[i] = ToPolish(str[i]);
return true;
switch (lang) {
case i18n::Lang::en:
case i18n::Lang::de:
return true;
case i18n::Lang::ru:
for (int i = 0; i < len; i++)
{
str[i] = ToRussian(str[i]);
}
return true;
case i18n::Lang::pl:
for (int i = 0; i < len; i++)
{
str[i] = ToPolish(str[i]);
}
return true;
case i18n::Lang::nl:
case i18n::Lang::fr:
case i18n::Lang::it:
case i18n::Lang::zh:
return false;
}
return false;
}