From 8a61528e89f0a2c4ac1707c9b5a9fa53fb5fa10b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sat, 5 Sep 2015 18:01:18 -0700 Subject: [PATCH] CRM-16373 - Localization - Save through settings instead of domain --- CRM/Admin/Form/Setting.php | 21 +++- CRM/Admin/Form/Setting/Localization.php | 160 ++++++++++++------------ CRM/Core/Config.php | 1 + CRM/Core/Config/Defaults.php | 5 + CRM/Core/Config/Variables.php | 8 +- settings/Localization.setting.php | 108 +++++++++------- 6 files changed, 168 insertions(+), 135 deletions(-) diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index 7e570dcd10..6122a15454 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -132,22 +132,33 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { $settingMetaData = civicrm_api('setting', 'getfields', array('version' => 3, 'name' => $setting)); $props = $settingMetaData['values'][$setting]; if (isset($props['quick_form_type'])) { + if (isset($props['pseudoconstant'])) { + $options = civicrm_api3('Setting', 'getoptions', array( + 'field' => $setting, + )); + } + else { + $options = NULL; + } + $add = 'add' . $props['quick_form_type']; if ($add == 'addElement') { $this->$add( $props['html_type'], $setting, ts($props['title']), - CRM_Utils_Array::value($props['html_type'] == 'select' ? 'option_values' : 'html_attributes', $props, array()), - $props['html_type'] == 'select' ? CRM_Utils_Array::value('html_attributes', $props) : NULL + ($options !== NULL) ? $options['values'] : CRM_Utils_Array::value('html_attributes', $props, array()), + ($options !== NULL) ? CRM_Utils_Array::value('html_attributes', $props, array()) : NULL ); } elseif ($add == 'addSelect') { - $options = civicrm_api3('Setting', 'getoptions', array( - 'field' => $setting, - )); $this->addElement('select', $setting, ts($props['title']), $options['values'], CRM_Utils_Array::value('html_attributes', $props)); } + elseif ($add == 'addChainSelect') { + $this->addChainSelect($setting, array( + 'label' => ts($props['title']), + )); + } else { $this->$add($setting, ts($props['title'])); } diff --git a/CRM/Admin/Form/Setting/Localization.php b/CRM/Admin/Form/Setting/Localization.php index 0d4f06e9e0..d8e9e29cd2 100644 --- a/CRM/Admin/Form/Setting/Localization.php +++ b/CRM/Admin/Form/Setting/Localization.php @@ -35,9 +35,23 @@ * This class generates form components for Localization. */ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { - // use this variable to store mappings that we compute in buildForm and also - // use in postProcess (CRM-1496) - protected $_currencySymbols; + + protected $_settings = array( + 'countryLimit' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'customTranslateFunction' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'defaultContactCountry' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'defaultContactStateProvince' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'defaultCurrency' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'fieldSeparator' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'inheritLocale' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'lcMessages' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'legacyEncoding' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'monetaryThousandSeparator' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'monetaryDecimalPoint' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'moneyformat' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'moneyvalueformat' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + 'provinceLimit' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, + ); /** * Build the form object. @@ -45,26 +59,18 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { public function buildQuickForm() { $config = CRM_Core_Config::singleton(); - $i18n = CRM_Core_I18n::singleton(); CRM_Utils_System::setTitle(ts('Settings - Localization')); - $locales = CRM_Core_I18n::languages(); $warningTitle = json_encode(ts("Warning")); + $lcMessages = CRM_Admin_Form_Setting_Localization::getDefaultLocaleOptions(); + $domain = new CRM_Core_DAO_Domain(); $domain->find(TRUE); - if ($domain->locales) { - // for multi-lingual sites, populate default language drop-down with available languages - $lcMessages = array(); - foreach ($locales as $loc => $lang) { - if (substr_count($domain->locales, $loc)) { - $lcMessages[$loc] = $lang; - } - } - $this->addElement('select', 'lcMessages', ts('Default Language'), $lcMessages); + if ($domain->locales) { // add language limiter and language adder $this->addCheckBox('languageLimit', ts('Available Languages'), array_flip($lcMessages), NULL, NULL, NULL, NULL, '   '); - $this->addElement('select', 'addLanguage', ts('Add Language'), array_merge(array('' => ts('- select -')), array_diff($locales, $lcMessages))); + $this->addElement('select', 'addLanguage', ts('Add Language'), array_merge(array('' => ts('- select -')), array_diff(CRM_Core_I18n::languages(), $lcMessages))); // add the ability to return to single language $warning = ts('This will make your CiviCRM installation a single-language one again. THIS WILL DELETE ALL DATA RELATED TO LANGUAGES OTHER THAN THE DEFAULT ONE SELECTED ABOVE (and only that language will be preserved).'); @@ -75,9 +81,6 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { ); } else { - // for single-lingual sites, populate default language drop-down with all languages - $this->addElement('select', 'lcMessages', ts('Default Language'), $locales); - $warning = ts('Enabling multiple languages changes the schema of your database, so make sure you know what you are doing when enabling this function; making a database backup is strongly recommended.'); $this->assign('warning', $warning); $warning = json_encode($warning); @@ -96,58 +99,9 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { 'undefined' => ts('Leave undefined'), 'current_site_language' => ts('Use language in use at the time'), )); - $this->addElement('checkbox', 'inheritLocale', ts('Inherit CMS Language')); - $this->addElement('text', 'monetaryThousandSeparator', ts('Thousands Separator'), array('size' => 2)); - $this->addElement('text', 'monetaryDecimalPoint', ts('Decimal Delimiter'), array('size' => 2)); - $this->addElement('text', 'moneyformat', ts('Monetary Amount Display')); - $this->addElement('text', 'moneyvalueformat', ts('Monetary Value Display')); - - $country = array(); - CRM_Core_PseudoConstant::populate($country, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active'); - $i18n->localizeArray($country, array('context' => 'country')); - asort($country); - - $includeCountry = &$this->addElement('advmultiselect', 'countryLimit', - ts('Available Countries') . ' ', $country, - array( - 'size' => 5, - 'style' => 'width:150px', - 'class' => 'advmultiselect', - ) - ); - - $includeCountry->setButtonAttributes('add', array('value' => ts('Add >>'))); - $includeCountry->setButtonAttributes('remove', array('value' => ts('<< Remove'))); - - $includeState = &$this->addElement('advmultiselect', 'provinceLimit', - ts('Available States and Provinces') . ' ', $country, - array( - 'size' => 5, - 'style' => 'width:150px', - 'class' => 'advmultiselect', - ) - ); - - $includeState->setButtonAttributes('add', array('value' => ts('Add >>'))); - $includeState->setButtonAttributes('remove', array('value' => ts('<< Remove'))); - - $this->addElement('select', 'defaultContactCountry', ts('Default Country'), array('' => ts('- select -')) + $country); - $this->addChainSelect('defaultContactStateProvince', array('label' => ts('Default State/Province'))); - - // we do this only to initialize currencySymbols, kinda hackish but works! - $config->defaultCurrencySymbol(); - - $symbol = $config->currencySymbols; - foreach ($symbol as $key => $value) { - $this->_currencySymbols[$key] = "$key"; - if ($value) { - $this->_currencySymbols[$key] .= " ($value)"; - } - } - $this->addElement('select', 'defaultCurrency', ts('Default Currency'), $this->_currencySymbols); $includeCurrency = &$this->addElement('advmultiselect', 'currencyLimit', - ts('Available Currencies') . ' ', $this->_currencySymbols, + ts('Available Currencies') . ' ', self::getCurrencySymbols(), array( 'size' => 5, 'style' => 'width:150px', @@ -158,10 +112,6 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { $includeCurrency->setButtonAttributes('add', array('value' => ts('Add >>'))); $includeCurrency->setButtonAttributes('remove', array('value' => ts('<< Remove'))); - $this->addElement('text', 'legacyEncoding', ts('Legacy Encoding')); - $this->addElement('text', 'customTranslateFunction', ts('Custom Translate Function')); - $this->addElement('text', 'fieldSeparator', ts('Import / Export Field Separator'), array('size' => 2)); - $this->addFormRule(array('CRM_Admin_Form_Setting_Localization', 'formRule')); parent::buildQuickForm(); @@ -226,11 +176,6 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { public function postProcess() { $values = $this->exportValues(); - // FIXME: stupid QF not submitting unchecked checkboxen… - if (!isset($values['inheritLocale'])) { - $values['inheritLocale'] = 0; - } - //cache contact fields retaining localized titles //though we changed localization, so reseting cache. CRM_Core_BAO_Cache::deleteGroup('contact fields'); @@ -241,9 +186,6 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { // we do this only to initialize monetary decimal point and thousand separator $config = CRM_Core_Config::singleton(); - // set default Currency Symbol - $values['defaultCurrencySymbol'] = $config->defaultCurrencySymbol($values['defaultCurrency']); - // save enabled currencies and defaul currency in option group 'currencies_enabled' // CRM-1496 if (empty($values['currencyLimit'])) { @@ -262,9 +204,10 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { // get labels for all the currencies $options = array(); + $currencySymbols = self::getCurrencySymbols(); for ($i = 0; $i < count($values['currencyLimit']); $i++) { $options[] = array( - 'label' => $this->_currencySymbols[$values['currencyLimit'][$i]], + 'label' => $currencySymbols[$values['currencyLimit'][$i]], 'value' => $values['currencyLimit'][$i], 'weight' => $i + 1, 'is_active' => 1, @@ -313,4 +256,59 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { } } + /** + * @return array + */ + public static function getAvailableCountries() { + $i18n = CRM_Core_I18n::singleton(); + $country = array(); + CRM_Core_PseudoConstant::populate($country, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active'); + $i18n->localizeArray($country, array('context' => 'country')); + asort($country); + return $country; + } + + /** + * @return array + */ + public static function getDefaultLocaleOptions() { + $domain = new CRM_Core_DAO_Domain(); + $domain->find(TRUE); + $locales = CRM_Core_I18n::languages(); + if ($domain->locales) { + // for multi-lingual sites, populate default language drop-down with available languages + $lcMessages = array(); + foreach ($locales as $loc => $lang) { + if (substr_count($domain->locales, $loc)) { + $lcMessages[$loc] = $lang; + } + } + } + else { + $lcMessages = $locales; + } + return $lcMessages; + } + + /** + * Get a list of currencies (with their symbols). + * + * @return array + * Array('USD' => 'USD ($)'). + */ + public static function getCurrencySymbols() { + $symbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array( + 'labelColumn' => 'symbol', + 'orderColumn' => TRUE, + )); + $_currencySymbols = array(); + foreach ($symbols as $key => $value) { + $_currencySymbols[$key] = "$key"; + if ($value) { + $_currencySymbols[$key] .= " ($value)"; + } + } + return $_currencySymbols; + } + } diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index 624e0e9afe..8fd55569f7 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -304,6 +304,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables { $this->imageUploadURL = CRM_Core_Config_Defaults::getImageUploadUrl(); $this->geocodeMethod = CRM_Utils_Geocode::getProviderClass(); + $this->defaultCurrencySymbol = CRM_Core_Config_Defaults::getDefaultCurrencySymbol(); } /** diff --git a/CRM/Core/Config/Defaults.php b/CRM/Core/Config/Defaults.php index bceb196509..9c468daf3f 100644 --- a/CRM/Core/Config/Defaults.php +++ b/CRM/Core/Config/Defaults.php @@ -143,4 +143,9 @@ class CRM_Core_Config_Defaults { return $url; } + public static function getDefaultCurrencySymbol() { + $config = CRM_Core_Config::singleton(); + return $config->defaultCurrencySymbol(Civi::settings()->get('defaultCurrency')); + } + } diff --git a/CRM/Core/Config/Variables.php b/CRM/Core/Config/Variables.php index cce398e767..7cb80b9ea9 100644 --- a/CRM/Core/Config/Variables.php +++ b/CRM/Core/Config/Variables.php @@ -417,13 +417,13 @@ class CRM_Core_Config_Variables extends CRM_Core_Config_Defaults { public function defaultCurrencySymbol($defaultCurrency = NULL) { static $cachedSymbol = NULL; if (!$cachedSymbol || $defaultCurrency) { - if ($this->defaultCurrency || $defaultCurrency) { - $this->currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array( + $currency = $defaultCurrency ? $defaultCurrency : $this->defaultCurrency; + if ($currency) { + $currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array( 'labelColumn' => 'symbol', 'orderColumn' => TRUE, )); - $currency = $defaultCurrency ? $defaultCurrency : $this->defaultCurrency; - $cachedSymbol = CRM_Utils_Array::value($currency, $this->currencySymbols, ''); + $cachedSymbol = CRM_Utils_Array::value($currency, $currencySymbols, ''); } else { $cachedSymbol = '$'; diff --git a/settings/Localization.setting.php b/settings/Localization.setting.php index bd8f4322fd..6e13256108 100644 --- a/settings/Localization.setting.php +++ b/settings/Localization.setting.php @@ -37,14 +37,32 @@ */ return array( + 'customTranslateFunction' => array( + 'add' => '4.7', + 'prefetch' => 1, + 'help_text' => NULL, + 'is_domain' => 1, + 'is_contact' => 0, + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'customTranslateFunction', + 'type' => 'String', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => array( + 'size' => '30', + 'maxlength' => '100', + ), + 'default' => NULL, + 'title' => 'Custom Translate Function', + 'description' => '', + ), 'monetaryThousandSeparator' => array( 'group_name' => 'Localization Preferences', 'group' => 'localization', 'name' => 'monetaryThousandSeparator', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', @@ -65,8 +83,6 @@ return array( 'name' => 'monetaryDecimalPoint', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', @@ -87,8 +103,6 @@ return array( 'name' => 'moneyformat', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', @@ -106,14 +120,12 @@ return array( 'name' => 'moneyvalueformat', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'String', 'quick_form_type' => 'Element', 'html_type' => 'text', 'default' => '%!i', 'add' => '4.3', - 'title' => 'Monetary Amount Display', + 'title' => 'Monetary Value Display', 'is_domain' => 1, 'is_contact' => 0, 'description' => NULL, @@ -125,13 +137,11 @@ return array( 'name' => 'defaultCurrency', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', 'html_attributes' => array( - 'size' => 2, + 'class' => 'crm-select2', ), 'default' => 'USD', 'add' => '4.3', @@ -140,6 +150,9 @@ return array( 'is_contact' => 0, 'description' => 'Default currency assigned to contributions and other monetary transactions.', 'help_text' => NULL, + 'pseudoconstant' => array( + 'callback' => 'CRM_Admin_Form_Setting_Localization::getCurrencySymbols', + ), ), 'defaultContactCountry' => array( 'group_name' => 'Localization Preferences', @@ -147,13 +160,11 @@ return array( 'name' => 'defaultContactCountry', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', 'html_attributes' => array( - 'size' => 4, + //'class' => 'crm-select2', ), 'default' => '1228', 'add' => '4.4', @@ -162,11 +173,13 @@ return array( 'is_contact' => 0, 'description' => 'This value is selected by default when adding a new contact address.', 'help_text' => NULL, + 'pseudoconstant' => array( + 'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries', + ), ), 'defaultContactStateProvince' => array( 'add' => '4.7', 'prefetch' => 1, - 'config_only' => 1, 'help_text' => NULL, 'is_domain' => 1, 'is_contact' => 0, @@ -174,12 +187,13 @@ return array( 'group' => 'localization', 'name' => 'defaultContactStateProvince', 'type' => 'Integer', - 'quick_form_type' => 'Select', - 'html_type' => 'Select', - 'pseudoconstant' => array( - 'callback' => 'CRM_Core_PseudoConstant::stateProvince', - ), - 'default' => '', + 'quick_form_type' => 'ChainSelect', + 'html_type' => 'ChainSelect', + //'pseudoconstant' => array( + // 'callback' => 'CRM_Core_PseudoConstant::stateProvince', + //), + //'html_attributes', + 'default' => NULL, 'title' => 'Default State/Province', 'description' => 'This value is selected by default when adding a new contact address.', ), @@ -189,15 +203,12 @@ return array( 'name' => 'countryLimit', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Array', - 'quick_form_type' => 'Element', - 'html_type' => 'advmultiselect', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', 'html_attributes' => array( - 'size' => 5, - 'style' => 'width:150px', - 'class' => 'advmultiselect', + 'multiple' => 1, + 'class' => 'crm-select2', ), 'default' => 'null', 'add' => '4.3', @@ -206,6 +217,9 @@ return array( 'is_contact' => 0, 'description' => '', 'help_text' => NULL, + 'pseudoconstant' => array( + 'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries', + ), ), 'provinceLimit' => array( 'group_name' => 'Localization Preferences', @@ -213,15 +227,12 @@ return array( 'name' => 'provinceLimit', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Array', - 'quick_form_type' => 'Element', - 'html_type' => 'advmultiselect', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', 'html_attributes' => array( - 'size' => 5, - 'style' => 'width:150px', - 'class' => 'advmultiselect', + 'multiple' => 1, + 'class' => 'crm-select2', ), 'default' => 'null', 'add' => '4.3', @@ -230,6 +241,9 @@ return array( 'is_contact' => 0, 'description' => '', 'help_text' => NULL, + 'pseudoconstant' => array( + 'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries', + ), ), 'inheritLocale' => array( 'group_name' => 'Localization Preferences', @@ -237,8 +251,6 @@ return array( 'name' => 'inheritLocale', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, - //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'Boolean', 'quick_form_type' => 'YesNo', 'default' => '0', @@ -364,7 +376,6 @@ return array( 'fieldSeparator' => array( 'add' => '4.7', 'prefetch' => 1, - 'config_only' => 1, 'help_text' => NULL, 'is_domain' => 1, 'is_contact' => 0, @@ -404,9 +415,14 @@ return array( 'name' => 'lcMessages', 'prefetch' => 1, // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent - 'config_only' => 1, + //'config_only' => 1, //@todo - see https://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference#SettingsReference-Convertingaconfigobjecttoasetting on removing this deprecated value 'type' => 'String', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => array( + 'class' => 'crm-select2', + ), 'default' => 'en_US', 'add' => '4.3', 'title' => 'Default Language', @@ -414,11 +430,13 @@ return array( 'is_contact' => 0, 'description' => '', 'help_text' => NULL, + 'pseudoconstant' => array( + 'callback' => 'CRM_Admin_Form_Setting_Localization::getDefaultLocaleOptions', + ), ), 'legacyEncoding' => array( 'add' => '4.7', 'prefetch' => 1, - 'config_only' => 1, 'help_text' => NULL, 'is_domain' => 1, 'is_contact' => 0, -- 2.25.1