Skip to content

Commit 978a3fb

Browse files
authored
optimize code logic: chi and zho as the final return
1 parent 3081e31 commit 978a3fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

extensions/geoip/geoip_util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,16 @@ const char *getLang(int target)
183183

184184
if (translator->GetLanguageInfo(langid, &code, NULL))
185185
{
186-
if (strcmp(code, "chi") == 0 || strcmp(code, "zho") == 0) {
187-
code = "zh-CN";
188-
}
189186
for (size_t i = 0; i < mmdb.metadata.languages.count; i++)
190187
{
191188
if (strcmp(code, mmdb.metadata.languages.names[i]) == 0)
192189
{
193190
return code;
194191
}
195192
}
193+
if (strcmp(code, "chi") == 0 || strcmp(code, "zho") == 0) {
194+
return "zh-CN";
195+
}
196196
}
197197
}
198198

0 commit comments

Comments
 (0)