Merge pull request #10540 from colemanw/CRM-20091
[civicrm-core.git] / CRM / Core / I18n.php
index fef2bed8523dcbff69d38fbb79f47558473f7b5a..ca7706cd9d5caf7f5c428b7b35fc1df71ebef29f 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
  */
 class CRM_Core_I18n {
 
@@ -97,7 +97,11 @@ class CRM_Core_I18n {
     return $this->_nativegettext;
   }
 
-
+  /**
+   * Set native locale for getText.
+   *
+   * @param string $locale
+   */
   protected function setNativeGettextLocale($locale) {
 
     $locale .= '.utf8';
@@ -117,6 +121,11 @@ class CRM_Core_I18n {
 
   }
 
+  /**
+   * Set getText locale.
+   *
+   * @param string $locale
+   */
   protected function setPhpGettextLocale($locale) {
 
     // we support both the old file hierarchy format and the new:
@@ -138,7 +147,6 @@ class CRM_Core_I18n {
 
   }
 
-
   /**
    * Return languages available in this instance of CiviCRM.
    *
@@ -221,6 +229,11 @@ class CRM_Core_I18n {
     return strtr($str, $tr);
   }
 
+  /**
+   * Get the directory for l10n resources.
+   *
+   * @return string
+   */
   public static function getResourceDir() {
     static $dir = NULL;
     if ($dir === NULL) {
@@ -669,7 +682,7 @@ class CRM_Core_I18n {
    */
   public static function getLocale() {
     global $tsLocale;
-    return $tsLocale;
+    return $tsLocale ? $tsLocale : 'en_US';
   }
 
 }