From 2f93ce4c25be997ce862247a58038f9a196843f2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 6 Nov 2016 09:14:22 -0800 Subject: [PATCH] Don't show "Limited" or "Test" translations unless an install is in developer mode Summary: Ref T5267. Although translations with very few strings are already put into a "Limited Translations" group, this isn't necessarily clear and was empirically confusing to at least one user, who was surprised that selecting "Spanish" had no UI effect. Instead, hide limited and test translations entirely unless the install is in developer mode. Test Plan: In a non-developer-mode install, viewed translations menu. No longer saw translations with very few strings. Reviewers: chad Reviewed By: chad Maniphest Tasks: T5267 Differential Revision: https://secure.phabricator.com/D16807 --- .../setting/PhabricatorTranslationSetting.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/applications/settings/setting/PhabricatorTranslationSetting.php b/src/applications/settings/setting/PhabricatorTranslationSetting.php index a30ded554d..6c0bec8799 100644 --- a/src/applications/settings/setting/PhabricatorTranslationSetting.php +++ b/src/applications/settings/setting/PhabricatorTranslationSetting.php @@ -32,7 +32,6 @@ final class PhabricatorTranslationSetting } protected function getSelectOptionGroups() { - $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); $locales = PhutilLocale::loadAllLocales(); $group_labels = array( @@ -56,10 +55,6 @@ final class PhabricatorTranslationSetting unset($raw_scope); if ($locale->isSillyLocale()) { - if ($is_serious) { - // Omit silly locales on serious business installs. - continue; - } $groups['silly'][$code] = $name; continue; } @@ -89,6 +84,20 @@ final class PhabricatorTranslationSetting $groups[$type][$code] = $name; } + // Omit silly locales on serious business installs. + $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); + if ($is_serious) { + unset($groups['silly']); + } + + // Omit limited and test translations if Phabricator is not in developer + // mode. + $is_dev = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); + if (!$is_dev) { + unset($groups['limited']); + unset($groups['test']); + } + $results = array(); foreach ($groups as $key => $group) { $label = $group_labels[$key];