Merge pull request #3557 from jitendrapurohit/CRM-14880
[civicrm-core.git] / CRM / Core / I18n.php
index f34f5f3dc82ed5ae1af027de838b86b513bdfbe4..2328e89a4014845277ea5e12e852d59ab66964ba 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -57,7 +57,7 @@ class CRM_Core_I18n {
    *
    * @param  $locale string  the base of this certain object's existence
    *
-   * @return         void
+   * @return \CRM_Core_I18n
    */
   function __construct($locale) {
     if ($locale != '' and $locale != 'en_US') {
@@ -251,7 +251,7 @@ class CRM_Core_I18n {
 
     // gettext domain for extensions
     $domain_changed = FALSE;
-    if (! empty($params['domain'])) {
+    if (! empty($params['domain']) && $this->_phpgettext) {
       if ($this->setGettextDomain($params['domain'])) {
         $domain_changed = TRUE;
       }
@@ -400,6 +400,11 @@ class CRM_Core_I18n {
    * @return Boolean True if the domain was changed for an extension.
    */
   function setGettextDomain($key) {
+    /* No domain changes for en_US */
+    if (! $this->_phpgettext) {
+      return FALSE;
+    }
+
     // It's only necessary to find/bind once
     if (! isset($this->_extensioncache[$key])) {
       $config = CRM_Core_Config::singleton();