Exemple #1
0
 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for the attribute
  * @param array $options CKEditor configuration options
  */
 public function __construct($name, $flags = 0, $options = [])
 {
     $this->ckOptions['language'] = Language::getLanguage();
     $this->ckOptions['wsc_lang'] = $this->ckOptions['scayt_sLang'] = Tools::atktext('locale');
     $this->ckOptions = array_merge($this->ckOptions, Config::getGlobal('ck_options'), $options);
     parent::__construct($name, $flags);
 }
Exemple #2
0
 /**
  * Returns a piece of html code that can be used in a form to edit this
  * attribute's value.
  *
  * @param array $record The record that holds the value for this attribute.
  * @param string $fieldprefix The fieldprefix to put in front of the name
  *                            of any html form element for this attribute.
  * @param string $mode The mode we're in ('add' or 'edit')
  *
  * @return string A piece of htmlcode for editing this attribute
  */
 public function edit($record, $fieldprefix, $mode)
 {
     if ($this->m_defaulttocurrent && !$record[$this->fieldName()]) {
         $record[$this->fieldName()] = strtoupper(Language::getLanguage());
     }
     return parent::edit($record, $fieldprefix, $mode);
 }
Exemple #3
0
 /**
  * Get Country option, when current language doesn't exists
  * it will return the english language.
  *
  * @param string $iso_code 2 Letter iso code of the country
  *
  * @return string Country name
  */
 public function getCountryOption($iso_code)
 {
     $lng = Language::getLanguage();
     if (!array_key_exists($iso_code, $this->m_country)) {
         Tools::atkdebug('UNKNOWN ISO CODE: ' . $iso_code);
     }
     if (array_key_exists($lng, $this->m_country[$iso_code])) {
         return $this->m_country[$iso_code][$lng];
     } else {
         return $this->m_country[$iso_code]['en'];
     }
 }
Exemple #4
0
 /**
  * Replaces the [vars] with the values from the language files
  * Please note that it is important, for performance reasons,
  * that you pass along the module where the language files can be found.
  *
  * @param mixed $string string or array of strings containing the name(s) of the string to return
  *                               when an array of strings is passed, the second will be the fallback if
  *                               the first one isn't found, and so forth
  * @param string $module module in which the language file should be looked for,
  *                               defaults to core module with fallback to ATK
  * @param string $node the node to which the string belongs
  * @param string $lng ISO 639-1 language code, defaults to config variable
  * @param string $firstfallback the first module to check as part of the fallback
  * @param bool $nodefaulttext if true, then it doesn't return a default text when it can't find a translation
  * @param bool $modulefallback Wether or not to use all the modules of the application in the fallback,
  *                               when looking for strings
  *
  * @return string the string from the languagefile
  */
 public static function atktext($string, $module = '', $node = '', $lng = '', $firstfallback = '', $nodefaulttext = false, $modulefallback = false)
 {
     return Language::text($string, $module, $node, $lng, $firstfallback, $nodefaulttext, $modulefallback);
 }