Skip to content

Commit 092ea91

Browse files
Lxeonpsychonic
authored andcommitted
fix geoip chi not return chinese translation (#2335)
* 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 5c1a5e3)
1 parent 8b47633 commit 092ea91

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

extensions/geoip/geoip_util.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ const char *getLang(int target)
183183

184184
if (translator->GetLanguageInfo(langid, &code, NULL))
185185
{
186+
if (strcmp(code, "chi") == 0)
187+
{
188+
code = "zh-CN";
189+
}
186190
for (size_t i = 0; i < mmdb.metadata.languages.count; i++)
187191
{
188192
if (strcmp(code, mmdb.metadata.languages.names[i]) == 0)
@@ -206,4 +210,4 @@ std::string lookupString(const char *ip, const char **path)
206210
}
207211

208212
return std::string(result.utf8_string, result.data_size);
209-
}
213+
}

0 commit comments

Comments
 (0)