diff --git a/src/internationalization/locales/PhutilCzechLocale.php b/src/internationalization/locales/PhutilCzechLocale.php --- a/src/internationalization/locales/PhutilCzechLocale.php +++ b/src/internationalization/locales/PhutilCzechLocale.php @@ -27,4 +27,8 @@ return $plural; } + public function getFallbackLocaleCode() { + return 'en_US'; + } + } diff --git a/src/internationalization/locales/PhutilFrenchLocale.php b/src/internationalization/locales/PhutilFrenchLocale.php --- a/src/internationalization/locales/PhutilFrenchLocale.php +++ b/src/internationalization/locales/PhutilFrenchLocale.php @@ -13,4 +13,9 @@ return pht('French (France)'); } + + public function getFallbackLocaleCode() { + return 'en_US'; + } + } diff --git a/src/internationalization/locales/PhutilGermanLocale.php b/src/internationalization/locales/PhutilGermanLocale.php --- a/src/internationalization/locales/PhutilGermanLocale.php +++ b/src/internationalization/locales/PhutilGermanLocale.php @@ -13,4 +13,8 @@ return pht('German (Germany)'); } + public function getFallbackLocaleCode() { + return 'en_US'; + } + } diff --git a/src/internationalization/locales/PhutilKoreanLocale.php b/src/internationalization/locales/PhutilKoreanLocale.php --- a/src/internationalization/locales/PhutilKoreanLocale.php +++ b/src/internationalization/locales/PhutilKoreanLocale.php @@ -13,4 +13,8 @@ return pht('Korean (Republic of Korea)'); } + public function getFallbackLocaleCode() { + return 'en_US'; + } + } diff --git a/src/internationalization/locales/PhutilPortugueseBrazilLocale.php b/src/internationalization/locales/PhutilPortugueseBrazilLocale.php --- a/src/internationalization/locales/PhutilPortugueseBrazilLocale.php +++ b/src/internationalization/locales/PhutilPortugueseBrazilLocale.php @@ -13,4 +13,13 @@ return pht('Portuguese (Brazil)'); } + public function getFallbackLocaleCode() { + // Phabricator does not support bidirectional + // fallbacks (pt_BR -> pt and pt -> pt_BR simultaneously) + // since Translatewiki calls this locale "Portugese" without a country + // it makes slightly more sense to fall back in this direction + // than the other one + return 'pt_PT'; + } + } diff --git a/src/internationalization/locales/PhutilPortuguesePortugalLocale.php b/src/internationalization/locales/PhutilPortuguesePortugalLocale.php --- a/src/internationalization/locales/PhutilPortuguesePortugalLocale.php +++ b/src/internationalization/locales/PhutilPortuguesePortugalLocale.php @@ -13,4 +13,14 @@ return pht('Portuguese (Portugal)'); } + public function getFallbackLocaleCode() { + // Ideally this would be pt_BR but Phabricator does not support + // bidirectional fallbacks (pt_BR -> pt and pt -> pt_BR simultaneously) + // since Translatewiki calls pt_PT "Portugese" without a country + // it makes slightly more sense to fall back in the other direction + // In the mean time return `en_US` so users don't see Proto-English + // unncecessarily + return 'en_US'; + } + } diff --git a/src/internationalization/locales/PhutilSimplifiedChineseLocale.php b/src/internationalization/locales/PhutilSimplifiedChineseLocale.php --- a/src/internationalization/locales/PhutilSimplifiedChineseLocale.php +++ b/src/internationalization/locales/PhutilSimplifiedChineseLocale.php @@ -13,4 +13,13 @@ return pht('Chinese (Simplified)'); } + public function getFallbackLocaleCode() { + // Ideally this would be zh_Hant but Phabricator does not support + // bidirectional fallbacks + // (zh_Hant -> zh_Hans and zh_Hans -> zh_Hant simultaneously) + // arbitrarily choose to fall back in the other direction instead + // In the mean time return `en_US` so users don't see Proto-English + return 'en_US'; + } + } diff --git a/src/internationalization/locales/PhutilSpanishSpainLocale.php b/src/internationalization/locales/PhutilSpanishSpainLocale.php --- a/src/internationalization/locales/PhutilSpanishSpainLocale.php +++ b/src/internationalization/locales/PhutilSpanishSpainLocale.php @@ -13,4 +13,8 @@ return pht('Spanish (Spain)'); } + public function getFallbackLocaleCode() { + return 'en_US'; + } + } diff --git a/src/internationalization/locales/PhutilTraditionalChineseLocale.php b/src/internationalization/locales/PhutilTraditionalChineseLocale.php --- a/src/internationalization/locales/PhutilTraditionalChineseLocale.php +++ b/src/internationalization/locales/PhutilTraditionalChineseLocale.php @@ -13,4 +13,8 @@ return pht('Chinese (Traditional)'); } + public function getFallbackLocaleCode() { + return 'zh_Hans'; + } + }