Skip to content

Commit 5c1a5e3

Browse files
authored
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
1 parent 392f0a9 commit 5c1a5e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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)