Example #1
0
 /**
  * Returns a reference to the global JoomlaTuneLanguage object, only creating it
  * if it doesn't already exist.
  *
  * @param	string $language
  * @return	JoomlaTuneLanguage $instance
  */
 public static function getInstance($language = null)
 {
     /**
      * $instance JoomlaTuneLanguage
      */
     static $instance = null;
     if (!is_object($instance)) {
         $instance = new JoomlaTuneLanguage();
     }
     if (isset($language)) {
         $instance->load($language, '');
         $instance->setLanguage($language);
     }
     return $instance;
 }
Example #2
0
 function sprintf($string)
 {
     $lang =& JoomlaTuneLanguage::getInstance();
     $args = func_get_args();
     if (count($args) > 0) {
         $args[0] = $lang->_($args[0]);
         return call_user_func_array('sprintf', $args);
     }
     return '';
 }
Example #3
0
 public static function plural($string, $n)
 {
     $lang = JoomlaTuneLanguage::getInstance();
     $args = func_get_args();
     $count = count($args);
     if ($count > 1) {
         $suffix = JoomlaTuneLanguageTools::getPluralSuffix($lang->getLanguage(), $n);
         $key = $string . '_' . $suffix;
         if ($lang->hasKey($key)) {
             $args[0] = $lang->_($key);
         } else {
             $args[0] = $lang->_($string);
         }
     } elseif ($count > 0) {
         $args[0] = $lang->_($string);
     }
     return call_user_func_array('sprintf', $args);
 }
Example #4
0
 /**
  * Get a language object
  *
  * Returns the global {@link JLanguage} object, only creating it
  * if it doesn't already exist.
  *
  * @return JLanguage object
  */
 public static function getLanguage()
 {
     if (JCOMMENTS_JVERSION == '1.0') {
         $language = JoomlaTuneLanguage::getInstance();
     } else {
         $language = JFactory::getLanguage();
     }
     return $language;
 }
Example #5
0
 define('JCOMMENTS_JVERSION', '1.0');
 define('JCOMMENTS_BACKEND', $mosConfig_absolute_path . '/administrator/components/com_jcomments');
 require_once JCOMMENTS_LIBRARIES . '/joomlatune/language.php';
 require_once JCOMMENTS_LIBRARIES . '/joomlatune/joomla/jcache.php';
 require_once JCOMMENTS_LIBRARIES . '/joomlatune/joomla/jdocument.php';
 require_once JCOMMENTS_LIBRARIES . '/joomlatune/joomla/jdispatcher.php';
 require_once JCOMMENTS_LIBRARIES . '/joomlatune/joomla/jpluginhelper.php';
 $lang = $mosConfig_lang;
 if (!is_file(JCOMMENTS_BASE . '/languages/' . $lang . '.ini')) {
     $lang = 'english';
 }
 $languageRoot = JCOMMENTS_BASE . '/languages';
 if (isset($mainframe) && $mainframe->isAdmin()) {
     $languageRoot .= '/administrator';
 }
 $language = JoomlaTuneLanguage::getInstance();
 $language->load('com_jcomments', $languageRoot, $lang);
 $joomfish = $mosConfig_absolute_path . '/components/com_joomfish/joomfish.php';
 if (!class_exists('JText')) {
     $joomfish_class = $mosConfig_absolute_path . '/administrator/components/com_joomfish/joomfish.class.php';
     $joomfish_language = $mosConfig_absolute_path . '/administrator/components/com_joomfish/libraries/joomla/language.php';
     // small hack for JoomFish 1.8.2+ on Joomla 1.0.x
     if (is_file($joomfish) && is_file($joomfish_language)) {
         include_once $joomfish_class;
         include_once $joomfish_language;
         if (class_exists('JLanguageHelper')) {
             if (isset($mainframe) && $mainframe->isAdmin()) {
                 $jfm = new JoomFishManager($mosConfig_absolute_path . '/administrator/components/com_joomfish');
                 $adminLang = strtolower($jfm->getCfg('componentAdminLang'));
                 $lng = JLanguageHelper::getLanguage($adminLang);
             } else {