Skip to content

Commit

Permalink
Fix CA error
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-englert committed Mar 15, 2018
1 parent 993e579 commit f40d4df
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ResXManager.Translators/GoogleTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,18 @@ public override void Translate(ITranslationSession translationSession)
}
}

private static string GoogleLangCode(CultureInfo ci)
[NotNull]
private static string GoogleLangCode([NotNull] CultureInfo cultureInfo)
{
var iso1 = ci.TwoLetterISOLanguageName;
var ms = ci.Name.ToLowerInvariant();
var iso1 = cultureInfo.TwoLetterISOLanguageName;
var name = cultureInfo.Name;

if (string.Equals(iso1, "zh", StringComparison.OrdinalIgnoreCase))
return new[] {"zh-hant", "zh-cht", "zh-hk", "zh-mo", "zh-tw"}.Contains(name, StringComparer.OrdinalIgnoreCase) ? "zh-TW" : "zh-CN";

if (iso1 == "zh")
return new[] {"zh-hant", "zh-cht", "zh-hk", "zh-mo", "zh-tw"}.Contains(ms) ? "zh-TW" : "zh-CN";
if (ms == "haw-us")
if (string.Equals(name, "haw-us", StringComparison.OrdinalIgnoreCase))
return "haw";

return iso1;
}

Expand Down

0 comments on commit f40d4df

Please sign in to comment.