From 3a55aa6b4e18e36e451fa0d508e6535db5e2d3e9 Mon Sep 17 00:00:00 2001 From: Mathieu Lutfy Date: Sun, 31 Jan 2016 17:39:38 -0500 Subject: [PATCH] CRM-17914: Support right-to-left languages in the CiviCRM installer. --- CRM/Core/I18n.php | 15 +++++++++++++++ CRM/Core/I18n/PseudoConstant.php | 16 ++++++++++++++++ install/index.php | 5 +++++ install/template.css | 4 ++++ install/template.html | 16 ++++++++++------ 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/CRM/Core/I18n.php b/CRM/Core/I18n.php index 59a5f7b2c7..61a932ef56 100644 --- a/CRM/Core/I18n.php +++ b/CRM/Core/I18n.php @@ -542,6 +542,21 @@ class CRM_Core_I18n { return (bool) $domain->locales; } + /** + * Is the language written "right-to-left"? + * + * @param $language + * Language (for example 'en_US', or 'fr_CA'). + * + * @return Bool + * True if it is an RTL language. + */ + public static function isLanguageRTL($language) { + $rtl = CRM_Core_I18n_PseudoConstant::getRTLlanguages(); + $short = CRM_Core_I18n_PseudoConstant::shortForLong($language); + + return (in_array($short, $rtl)); + } /** * Change the processing language without changing the current user language diff --git a/CRM/Core/I18n/PseudoConstant.php b/CRM/Core/I18n/PseudoConstant.php index 555f2ec237..91d850fef0 100644 --- a/CRM/Core/I18n/PseudoConstant.php +++ b/CRM/Core/I18n/PseudoConstant.php @@ -78,4 +78,20 @@ class CRM_Core_I18n_PseudoConstant { return substr($long, 0, 2); } + /** + * Returns a list of ISO 639-1 "right-to-left" language codes. + * + * @return array + */ + public static function getRTLlanguages() { + $rtl = array( + 'ar', + 'fa', + 'he', + 'ur', + ); + + return $rtl; + } + } diff --git a/install/index.php b/install/index.php index adc88051ae..1cfaf0b35e 100644 --- a/install/index.php +++ b/install/index.php @@ -185,6 +185,11 @@ $GLOBALS['civicrm_default_error_scope'] = NULL; // The translation files are in the parent directory (l10n) $i18n = CRM_Core_I18n::singleton(); +// Support for Arabic, Hebrew, Farsi, etc. +// Used in the template.html +$short_lang_code = CRM_Core_I18n_PseudoConstant::shortForLong($tsLocale); +$text_direction = (CRM_Core_I18n::isLanguageRTL($tsLocale) ? 'rtl' : 'ltr'); + global $cmsPath; if ($installType == 'drupal') { //CRM-6840 -don't force to install in sites/all/modules/ diff --git a/install/template.css b/install/template.css index ff81f26af3..7c96816e54 100644 --- a/install/template.css +++ b/install/template.css @@ -13,6 +13,10 @@ body { max-width: 1200px; } +.civicrm-logo { + float: right; +} + form { margin: 0; } diff --git a/install/template.html b/install/template.html index d63821166c..7fcd53e4cb 100644 --- a/install/template.html +++ b/install/template.html @@ -1,15 +1,19 @@ - + - -<?php echo ts('CiviCRM Installer'); ?> - /> + + <?php echo ts('CiviCRM Installer'); ?> + /> +\n"; +} +?> -
-
"{$civicrm_version['version']} {$civicrm_version['cms']}")); ?>
+ -- 2.25.1