fix geoip chi not return chinese translation (#2335)
Some checks failed
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang, clang++, ubuntu-latest, linux) (push) Has been cancelled
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang-14, clang++-14, ubuntu-22.04, linux) (push) Has been cancelled
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (msvc, windows-latest, win) (push) Has been cancelled
hl2sdk-mock tests / mock (push) Has been cancelled

* fix geoip chi and zho not return chinese translation

* optimize code logic: chi and zho as the final return

* code optimization
This commit is contained in:
Lxeon 2025-08-17 00:16:03 +08:00 committed by GitHub
parent 392f0a92c7
commit 5c1a5e35b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -183,6 +183,10 @@ const char *getLang(int target)
if (translator->GetLanguageInfo(langid, &code, NULL))
{
if (strcmp(code, "chi") == 0)
{
code = "zh-CN";
}
for (size_t i = 0; i < mmdb.metadata.languages.count; i++)
{
if (strcmp(code, mmdb.metadata.languages.names[i]) == 0)
@ -206,4 +210,4 @@ std::string lookupString(const char *ip, const char **path)
}
return std::string(result.utf8_string, result.data_size);
}
}