Attempt to get the multilingual value in the requested language.

@param  mixed $val  The multilingual value to lookup.
@param  mixed $lang The language to return the value in.
@return string|null
323839
protected function l10nVal($val, $lang = null)
    {
        if (!is_string($lang)) {
            if (is_array($lang) && isset($lang['lang'])) {
                $lang = $lang['lang'];
            } else {
                $lang = $this->translator()->getLocale();
            }
        }

        if (isset($val[$lang])) {
            return $val[$lang];
        } else {
            return null;
        }
    }
450922
public static function filterLanguage($value)
    {
        $uri = self::getExistingLanguageUri($value);
        /** @noinspection NullPointerExceptionInspection */
        return $uri !== null
            ? $uri
            : self::singleton()->getLanguageByCode(DEFAULT_LANG)->getUri();
    }
926270
public function getCurrency($lang = null)
    {
        if (!is_null($lang)) {
            $original_lang = $this->getLanguage();
            $this->setLanguage($lang);
        }
        $formatter = new NumberFormatter($this->getLocale(), NumberFormatter::CURRENCY);
        $currency = $formatter->getTextAttribute(NumberFormatter::CURRENCY_CODE);
        if (!empty($original_lang)) {
            $this->setLanguage($original_lang);
        }
        return $currency;
    }
250541
public static function fromCode($val)
    {
        $val = strtoupper($val);
        if (strlen($val) === 3) {
            if (self::$_tlcFlip === array()) {
                self::$_tlcFlip = array_flip(self::$_tlcMap);
            }
            if (!array_key_exists($val, self::$_tlcFlip)) {
                return null;
            }
            $val = self::$_tlcFlip[$val];
        }
        if (array_key_exists($val, self::$_countries)) {
            return self::$_countries[$val];
        }
        return null;
    }
982031
public function getKeyword($keyword, $lang = null)
    {
        $parts = $this->_callInternalLocale('getKeywords', null, $lang, false);
        return isset($parts[$keyword]) ? $parts[$keyword] : null;
    }
157689
private function translateWithLang($key, $lang) {
        if (!isset($this->translations[$lang]) || !isset($this->translations[$lang][$key])) {
            return null;
        }

        return $this->translations[$lang][$key];
    }
37152
public function storageVal($val)
    {
        if ($val === null) {
            // Do not json_encode NULL values
            return null;
        }

        if (!$this->l10n() && $val instanceof Translation) {
            $val = (string)$val;
        }

        if ($this->multiple()) {
            if (is_array($val)) {
                $val = implode($this->multipleSeparator(), $val);
            }
        }

        if (!is_scalar($val)) {
            return json_encode($val, JSON_UNESCAPED_UNICODE);
        }

        return $val;
    }
273800
public static function isLuhn($val = null)
    {
        if (is_null($val)) {
            return null;
        }
        $_num = substr($val, 0, strlen($val)-1);
        return (bool) (intval($val) == intval($_num.self::getLuhnKey($_num)));
    }
1237270
public function parsedVal()
    {
        if (!isset($this->parsedVal[$this->lang()])) {
            $val = $this->propertyVal();

            if ($val === null) {
                return null;
            }
            $val = $this->p()->parseVal($val);

            // Could be Translation instance
            // Could be array
            if (isset($val[$this->lang()])) {
                $val = $val[$this->lang()];
            }

            // Doing this in the parseVal method of abstract property
            // was causing multiple && l10n properties not to save.
            if (!is_array($val) && $this->p()->multiple()) {
                $val = explode($this->p()->multipleSeparator(), $val);
            }

            $this->parsedVal[$this->lang()] = $val;
        }
        return $this->parsedVal[$this->lang()];
    }
1279308
private function loadLang($lang) {
        $locale = preg_replace_callback('/\b([a-z]{2})[-_](?:([a-z]{4})[-_])?([a-z]{2})\b/', function ($matches) {
            return $matches[1].'_'.(!empty($matches[2]) ? ucfirst($matches[2]).'_' : '').strtoupper($matches[3]);
        }, strtolower($lang));

        if (file_exists($filename = __DIR__.'/Lang/'.$locale.'.php')) {
            $this->lang = $locale;

            $this->number_word = include __DIR__.'/Lang/'.$locale.'.php';
            $this->currency = $this->number_word['currency'];

            return true;
        }
        throw new InvalidArgumentException('Unknown language ('.$lang.')');
    }
618821
public function getField($field, $language = null)
    {
        $language = $language ?: $this->language;

        return $this->getTree()->getField($this, $field, $language);
    }
1332261
public static Locale makeLocale(final String val) throws Throwable {
    String lang = null;
    String country = ""; // NOT null for Locale
    String variant = "";

    if (val == null) {
      throw new Exception("Bad Locale: NULL");
    }

    if (val.length() == 2) {
      lang = val;
    } else {
      int pos = val.indexOf('_');
      if (pos != 2) {
        throw new Exception("Bad Locale: " + val);
      }

      lang = val.substring(0, 2);
      pos = val.indexOf("_", 3);
      if (pos < 0) {
        if (val.length() != 5) {
          throw new Exception("Bad Locale: " + val);
        }

        country = val.substring(3);
      } else {
        country = val.substring(3, 5);

        if (val.length() > 6) {
          variant = val.substring(6);
        }
      }
    }

    return new Locale(lang, country, variant);
  }
356350
public function getValue($key)
    {
        return isset($this->langstrings[$key]) ? $this->langstrings[$key] : null;
    }
1107840
public function getNodeTranslationsQueryBuilder($lang = null)
    {
        $queryBuilder = $this->createQueryBuilder('nt')
            ->select('nt,n,v')
            ->innerJoin('nt.node', 'n')
            ->leftJoin(
                'nt.publicNodeVersion',
                'v',
                'WITH',
                'nt.publicNodeVersion = v.id'
            )
            ->where('n.deleted = false')
            ->orderBy('nt.weight')
            ->addOrderBy('nt.weight');

        if (!empty($lang)) {
            $queryBuilder
                ->andWhere('nt.lang = :lang')
                ->setParameter('lang', $lang);
        }

        return $queryBuilder;
    }
579515
protected static function createLanguage(array $values, &$lang)
    {
        // If this is an alternate values list
        if (isset($values['lang'])) {
            if (is_string($values['lang'])) {
                $lang = trim($values['lang']) ?: null;
            }
            unset($values['lang']);
        }

        return $values;
    }
978216
private static Set<String>  parseSystemLanguage(String val)
   {
      TextScanner      scan = new TextScanner(val);
      HashSet<String>  result = new HashSet<>();

      while (!scan.empty())
      {
         String language = scan.nextToken();
         int  hyphenPos = language.indexOf('-'); 
         if (hyphenPos != -1) {
            language = language.substring(0, hyphenPos);
         }
         // Get canonical version of language code in case it has changed (see the JavaDoc for Locale.getLanguage())
         language = new Locale(language, "", "").getLanguage();
         result.add(language);
         scan.skipWhitespace();
      }
      return result;
   }
28683
function i18n_value($val_key, $params = NULL){
        if(isset($this->i18nContent)){
            if(isset($this->i18nContent[$val_key])){
                $mensaje= $this->i18nContent[$val_key];
                
                //Analiza si se pasaron parametros y si se pasaron cambia los valores correspondientes
                if($params != NULL){
                    foreach ($params as $key => $valor) {
                        $mensaje= str_replace(":$key", $valor, $mensaje);
                    }
                }                
                return $mensaje;
            }
        }
        else{
            \Enola\Error::general_error('I18n Error', 'Not specified any I18n file to make it run the i18n function');
        }
    }