mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-06 18:08:36 +00:00
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
SourcePawn scripting / build (ubuntu-latest, linux) (push) Has been cancelled
SourcePawn scripting / build (windows-latest, win) (push) Has been cancelled
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
SourcePawn scripting / build (ubuntu-latest, linux) (push) Has been cancelled
SourcePawn scripting / build (windows-latest, win) (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
(cherry picked from commit 5c1a5e35b9)
This commit is contained in:
parent
8b476330ed
commit
092ea91f0d
@ -183,6 +183,10 @@ const char *getLang(int target)
|
|||||||
|
|
||||||
if (translator->GetLanguageInfo(langid, &code, NULL))
|
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++)
|
for (size_t i = 0; i < mmdb.metadata.languages.count; i++)
|
||||||
{
|
{
|
||||||
if (strcmp(code, mmdb.metadata.languages.names[i]) == 0)
|
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);
|
return std::string(result.utf8_string, result.data_size);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user