Translate given text into the target language. If not in the target language,
look in english, and then finally just return back the value itself

@param val
@param scope
@param status
@returns {string}
491449
function translate(val, scope, status) {
        var app = (scope && scope.appName) || context.get('app') || '';
        var lang = (scope && scope.lang) || context.get('lang') || 'en';
        var translated;

        // if just one character or is a number, don't do translation
        if (!val || val.length < 2 || !isNaN(val)) {
            return val;
        }

        // translations could be either nested (on the server) or at the root (on the client)
        translated = (translations[app] && translations[app][lang] && translations[app][lang][val]) ||
            (_.isString(translations[val]) && translations[val]);

        // if no transation AND caller passed in status object AND lang is not default (i.e. not english),
        // set the status object values which the caller can use to record some info
        // note: this is kind of hacky, but we want the caller (i.e. jng.directives.js) to handle
        // it because jng.directives has more info about the translation than we do at this level
        if (!translated && config.i18nDebug && status && lang !== config.lang.default) {
            status.app = app;
            status.lang = lang;
            status.missing = true;
        }

        // attempt to interpolate and return the resulting value (val if no translation found)
        return interpolate(translated || val, scope);
    }
214728
function (text, scope, attrKey, bindingDefinitions) {
            if (!_.isString(text)) {
                return text;
            }

            bindingDefinitions = bindingDefinitions || this.parse(text);

            var binding,
                bindings = [],
                ret = [];

            for (var i = 0; i < bindingDefinitions.length; i++) {
                var bindingDef = bindingDefinitions[i];
                if (bindingDef.length) {
                    ret.push(bindingDef);
                } else {
                    try {
                        binding = this.create(bindingDef, scope, attrKey, ret);
                    } catch (e) {
                        throw new Error("Create binding for '" + text + "'. " + e.message);
                    }

                    if (binding instanceof Binding) {
                        bindings.push(binding);
                        scope.$bindings[attrKey] = scope.$bindings[attrKey] || [];
                        scope.$bindings[attrKey].push(binding);
                    }
                    ret.push(binding);
                }

            }

            if (bindings.length > 0) {
                return bindings[0].getContextValue();
            } else if (ret.length > 0) {
                if (ret.length === 1) {
                    return ret[0];
                }
                return Binding.contextToString(ret);
            } else {
                return text;
            }

        }
926342
function forLocale( locale, trackingProperty ) {
      assert( trackingProperty ).hasType( String ).isNotNull();
      const localize = strict ? localizeStrict : localizeRelaxed;

      /**
       * @constructor
       * @name AxI18nHandler
       */
      return {
         format,
         languageTag,

         /**
          * Localize the given internationalized object using the given languageTag.
          *
          * If i18n is configured to be _strict_, the currently active language tag is used to lookup a
          * translation.
          * If nothing is found, the `languageTag` argument is tried.
          * If still nothing is found, `undefined` is returned.
          *
          * In the case _strict_ is set to `false`, the behavior is the same as in _strict_ mode if an exact
          * localization is available.
          * If not, the language tag is successively generalized by stripping off the rightmost sub-tags
          * until a localization is found.
          * Eventually, a fallback (default: 'en') is used.
          * This behavior is especially useful for controls (such as a datepicker), where we cannot
          * anticipate all required language tags, as they may be app-specific.
          *
          * @param {*} i18nValue
          *    a possibly internationalized value:
          *    - when passing a primitive value, it is returned as-is
          *    - when passing an object, the languageTag is used as a key within that object
          * @param {*} [optionalFallbackValue]
          *    a value to use if no localization is available for the given language tag
          * @param {String} [languageTag]
          *    a language tag to override the current locale tag. Only available in _strict_ mode
          *
          * @return {*}
          *    the localized value if found, the fallback (or `undefined`) otherwise
          *
          * @memberof AxI18nHandler
          * @name localize
          */
         localize,
         track,
         update,
         whenLocaleChanged
      };

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      /**
       * Updates the language tag for the configured locale by emitting the according `changeLocaleRequest`
       * event.
       *
       * @param {String} languageTag
       *    the language tag to propagate
       *
       * @return {Promise}
       *    the promise of the event cycle
       *
       * @memberof AxI18nHandler
       */
      function update( languageTag ) {
         return eventBus.publishAndGatherReplies( `changeLocaleRequest.${locale}`, {
            locale,
            languageTag
         }, noDeliveryToSender ).then( () => {
            tags[ locale ] = languageTag;
         } );
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      /**
       * Returns the language tag set for the configured locale.
       * If no tag is available, `undefined` is returned.
       *
       * @return {String}
       *    the active language tag or `undefined`
       *
       * @memberof AxI18nHandler
       */
      function languageTag() {
         return tags[ locale ];
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      /**
       * References the current i18n state as an object under the given property of the context.
       *
       * If this method is not used, changes to the locale are still observed by the handler, but not
       * tracked on the context object. Use this to react to locale-changes in a data-driven fashion, for
       * example by using an AngularJS watcher.
       *
       * By default, the i18n state is stored under the feature path used to create this i18n handler ("i18n"
       * for the default handler provided by the "axI18n" widget service injection).
       *
       * The tracking structure stored under the property is an object that has two properties:
       *
       *   - `locale` is the constant locale topic that was configured for the tracked feature
       *   - `tags` is an object mapping all locale names to their normalized current language tag
       *
       * Note that tracked language tags are *normalized*, i.e. converted to lowercase with underscores (`_`)
       * replaced by dashes (`-`).
       *
       * @param {String} [property=trackingProperty]
       *    name of the context property to store the state under, defaults to the feature path
       *
       * @memberof AxI18nHandler
       */
      function track( property = trackingProperty ) {
         setPath( context, property, { locale, tags } );
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      /**
       * Format an i18n value, by first localizing it and then applying substitutions.
       *
       * These are equivalent:
       * - `string.format( axI18n.localize( i18nValue ), numericArgs, namedArgs )`
       * - `axI18n.format( i18nValue, numericArgs, namedArgs )`.
       *
       * @param {String} i18nValue
       *    the value to localize and then format
       * @param {Array} [optionalIndexedReplacements]
       *    replacements for any numeric placeholders in the localized value
       * @param {Object} [optionalNamedReplacements]
       *    replacements for any named placeholders in the localized value
       *
       * @return {String}
       *    the formatted string after localization
       *
       * @memberof AxI18nHandler
       */
      function format( i18nValue, optionalIndexedReplacements, optionalNamedReplacements ) {
         const formatString = localize( i18nValue );
         return formatString && stringFormat(
            formatString, optionalIndexedReplacements, optionalNamedReplacements
         );
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      /**
       * Registers a callback that is called whenever the new valid locale was received via event.
       *
       * @param {Function} callback
       *    the function to call on locale change
       *
       * @memberof AxI18nHandler
       */
      function whenLocaleChanged( callback ) {
         callbacks[ locale ] = callbacks[ locale ] || [];
         callbacks[ locale ].push( callback );
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      function localizeRelaxed( i18nValue, optionalFallbackValue ) {
         if( !i18nValue || primitives[ typeof i18nValue ] ) {
            // value is not internationalized
            return i18nValue;
         }

         const tag = tags[ locale ];
         const tagParts = tag ? tag.replace( /-/g, '_' ).split( '_' ) : [];
         while( tagParts.length > 0 ) {
            const currentLocaleTag = tagParts.join( '-' );
            const value = localizeStrict( i18nValue, undefined, currentLocaleTag );
            if( value !== undefined ) {
               return value;
            }
            tagParts.pop();
         }

         return fallback ?
            localizeStrict( i18nValue, optionalFallbackValue, fallback ) :
            optionalFallbackValue;
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      function localizeStrict( i18nValue, optionalFallbackValue, languageTag = tags[ locale ] ) {
         if( !i18nValue || primitives[ typeof i18nValue ] ) {
            // value is not internationalized
            return i18nValue;
         }
         if( !languageTag ) {
            return optionalFallbackValue;
         }

         // Try one direct lookup before scanning the input keys,
         // assuming that language-tags are written in consistent style.
         const value = i18nValue[ languageTag ];
         if( value !== undefined ) {
            return value;
         }

         const lookupKey = normalize( languageTag );
         const availableTags = Object.keys( i18nValue );
         const n = availableTags.length;
         for( let i = 0; i < n; ++i ) {
            const t = availableTags[ i ];
            if( normalize( t ) === lookupKey ) {
               return i18nValue[ t ];
            }
         }

         return optionalFallbackValue;
      }

   }
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');
        }
    }
1280528
private static Style.TextAnchor  parseTextAnchor(String val)
   {
      switch (val)
      {
         case "start":  return Style.TextAnchor.Start;
         case "middle": return Style.TextAnchor.Middle;
         case "end":    return Style.TextAnchor.End;
         default:       return null;
      }
   }
955456
function(val)
    {
      var numberOptions =
      {
        style: "currency",
        currency: currency,
        minimumFractionDigits: 0,
        maximumFractionDigits: 0
      }

      return formatNumber(val == null || val === "" || isNaN(val) ? 0 : val, numberOptions)
    }
509341
function(string) {
    var translated = Documentation.TRANSLATIONS[string];
    if (typeof translated == 'undefined')
      return string;
    return (typeof translated == 'string') ? translated : translated[0];
  }
692437
public function displayVal($val, array $options = [])
    {
        if ($val === null || $val === '') {
            return '';
        }

        /** Parse multilingual values */
        if ($this->l10n()) {
            $propertyValue = $this->l10nVal($val, $options);
            if ($propertyValue === null) {
                return '';
            }
        } elseif ($val instanceof Translation) {
            $propertyValue = strval($val);
        } else {
            $propertyValue = $val;
        }

        $separator = $this->multipleSeparator();

        /** Parse multiple values / ensure they are of array type. */
        if ($this->multiple()) {
            if (!is_array($propertyValue)) {
                $propertyValue = explode($separator, $propertyValue);
            }
        }

        if ($separator === ',') {
            $separator = ', ';
        }

        if (is_array($propertyValue)) {
            foreach ($propertyValue as &$value) {
                $value = strval($this->valLabel($value, $options));
            }
            $propertyValue = implode($separator, $propertyValue);
        } else {
            $propertyValue = strval($this->valLabel($propertyValue, $options));
        }

        return $propertyValue;
    }
414589
private Context translateVariableDeclaration(WyilFile.Decl.Variable stmt, Context context) {
		if (stmt.hasInitialiser()) {
			Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getInitialiser(), null, context);
			context = p.second();
			generateTypeInvariantCheck(stmt.getType(), p.first(), context);
			context = context.write(stmt, p.first());
		}
		//
		return context;
	}
393196
def translated_value(self):
        
        if self.typeof in self:
            return NATValue(self.get(self.typeof, {}).get(
                'translated_value'))
1297388
def translate(self):
        """"""

        value = super().translate()
        if value is None or (isinstance(value, str) and value.strip() == ''):
            return None

        return int(value)
229106
function translate(content, langFile) {
  return content.replace(templateRegEx, function (match, capture) {
    return (0, _lodash2.default)(langMap.get(langFile), capture);
  });
}
688078
def translate(self) -> Optional[str]:
        """"""

        fallbacks = getattr(settings, 'LOCALIZED_FIELDS_FALLBACKS', {})

        language = translation.get_language() or settings.LANGUAGE_CODE
        languages = fallbacks.get(language, [settings.LANGUAGE_CODE])[:]
        languages.insert(0, language)

        for lang_code in languages:
            value = self.get(lang_code)
            if value:
                return value or None

        return None
1023763
function localizeRelaxed( i18nValue, optionalFallbackValue ) {
         if( !i18nValue || primitives[ typeof i18nValue ] ) {
            // value is not internationalized
            return i18nValue;
         }

         const tag = tags[ locale ];
         const tagParts = tag ? tag.replace( /-/g, '_' ).split( '_' ) : [];
         while( tagParts.length > 0 ) {
            const currentLocaleTag = tagParts.join( '-' );
            const value = localizeStrict( i18nValue, undefined, currentLocaleTag );
            if( value !== undefined ) {
               return value;
            }
            tagParts.pop();
         }

         return fallback ?
            localizeStrict( i18nValue, optionalFallbackValue, fallback ) :
            optionalFallbackValue;
      }
394976
function c($val) {
		$locale=setlocale(LC_NUMERIC,0);
		setlocale(LC_NUMERIC,'C');
		$out=(string)(float)$val;
		$locale=setlocale(LC_NUMERIC,$locale);
		return $out;
	}
237442
def localized_scope
      langs = ::I18n.available_locales.join('|')
      scope '(:locale)', locale: Regexp.new(langs) do
        yield
      end
    end
804715
function getText(locale, ...args) {
    const key = args[0];
    if (!key) return null;

    // try locale
    let resource = ebLocales[locale] || {};
    let text = resource[key];
    if (text === undefined && locale !== 'en-us') {
      // try en-us
      resource = ebLocales['en-us'] || {};
      text = resource[key];
    }
    // equal key
    if (text === undefined) {
      text = key;
    }
    // format
    args[0] = text;
    return localeutil.getText.apply(localeutil, args);
  }