Injects languages into (potentially) template strings.
972502
def _inject_language(self, src, strings):
    """"""
    if src not in self.sources:
      raise ValueError("Invalid source for '{0}': {1}".format(self.name, src))
    def _format_string(s):
      if "{0}" in s and "{1}" and "{src}" in s:
        return s.format(*sorted([src, self.target]), src=src)
      elif "{0}" in s and "{1}" in s:
        return s.format(*sorted([src, self.target]))
      elif "{src}" in s:
        return s.format(src=src)
      else:
        return s
    return [_format_string(s) for s in strings]
446087
def compile(self, values):
        
        def is_international(tag):
            return tag.endswith('_')

        def get_country_code(tag):
            return tag[-2:]

        def strip_country_code(tag):
            return tag[:-2]

        replacements = list(self.tagset.items())

        str = ""
        domestic = [t for t in replacements if not is_international(t[0])]
        for key, replacement in domestic:
            try:
                str = str + replacement % values[key]
            except KeyError as e:
                if self.mandatory:
                    raise e

        international = [t for t in replacements if is_international(t[0])]
        for key, replacement in international:
            try:
                x = [t for t in values.items() if strip_country_code(t[0]) == key]
                int_values_for_key = [(get_country_code(t[0]),t[1]) for t in x]
                for v in int_values_for_key:
                    str = str + replacement % v
            except KeyError as e:
                if self.mandatory:
                    raise e

        return str
387730
def template(basedir, text, vars, lookup_fatal=True, expand_lists=False):
    '''  '''

    try:
        text = text.decode('utf-8')
    except UnicodeEncodeError:
        pass # already unicode
    text = varReplace(basedir, unicode(text), vars, lookup_fatal=lookup_fatal, expand_lists=expand_lists)
    return text
1355057
@Inject
	public void setOutputLanguage(@Named(Constants.LANGUAGE_NAME) String outputLanguage) {
		if (!Strings.isNullOrEmpty(outputLanguage)) {
			final String[] parts = outputLanguage.split("\\.+"); //$NON-NLS-1$
			if (parts.length > 0) {
				final String simpleName = parts[parts.length - 1];
				if (!Strings.isNullOrEmpty(simpleName)) {
					this.languageName = simpleName;
					return;
				}
			}
		}
		this.languageName = null;
	}
169911
function compile(template, context) {
        for (var name in context) {
            template = template.replace('{{' + name + '}}', context[name])
        }
        return template
    }
296793
def register_languages():
    """"""
    for language in set(SUPPORTED_LANGUAGES) - {"en"}:
        language_stemmer = partial(nltk_stemmer, get_language_stemmer(language))
        Pipeline.register_function(language_stemmer, "stemmer-{}".format(language))
1109656
protected static function injectTranslatorValues(TranslatorInterface $translator, TemplateInterface $template): void
    {
        static::injectTranslatorValue($translator, $template, 'label');
        static::injectTranslatorValue($translator, $template, 'description');
        static::injectTranslatorValue($translator, $template, 'body');

        if ($template instanceof MailInterface) {
            static::injectTranslatorValue($translator, $template, 'subject');
            static::injectTranslatorValue($translator, $template, 'htmlBody');
        }
    }
186003
private static Templates initTemplates() {
		try {
			URL xsltURL = ThemeUtil.class.getResource(RESOURCE_NAME);
			if (xsltURL != null) {
				Source xsltSource = new StreamSource(xsltURL.openStream(), xsltURL.toExternalForm());
				TransformerFactory factory = new net.sf.saxon.TransformerFactoryImpl();
				Templates templates = factory.newTemplates(xsltSource);
				LOG.debug("Generated XSLT templates for: " + RESOURCE_NAME);
				return templates;
			} else {
				// Server-side XSLT enabled but theme resource not on classpath.
				throw new IllegalStateException(RESOURCE_NAME + " not on classpath");
			}
		} catch (IOException | TransformerConfigurationException ex) {
			throw new SystemException("Could not create transformer for " + RESOURCE_NAME, ex);
		}
	}
980647
function translateInLanguageFilter(key, locale) {
    for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
      args[_key - 2] = arguments[_key];
    }

    return translateInLanguage.apply(void 0, [locale, key].concat(args));
  }
1185035
function (name, languages) {
        var language = AddOnManager.language;

        if (language && AddOnManager.languageLoad !== false) {
          if (languages) {
            languages = ',' + languages + ',';

            // Load short form sv.js or long form sv_SE.js
            if (languages.indexOf(',' + language.substr(0, 2) + ',') != -1) {
              language = language.substr(0, 2);
            } else if (languages.indexOf(',' + language + ',') == -1) {
              return;
            }
          }

          ScriptLoader.ScriptLoader.add(this.urls[name] + '/langs/' + language + '.js');
        }
      }
648543
def expand(template, variables=None):
    
    if variables is None:
        variables = {}
    return patterns.sub(functools.partial(_replace, variables), template)
378862
private function withBuiltInTemplates(string $locale): ValidatorFactory
    {
        $templates = include(__DIR__ . '/../lang/' . $locale . '.php');

        return $this->withDefaultTemplates($templates);
    }
188780
public function addLanguageValues($values)
    {
        $this->_languageValues = array_unique(array_merge($this->getLanguageValues(true), $this->filterLanguageValues($values)));
    }
38916
def from_string(self, source, globals=None, template_class=None):
        
        globals = self.make_globals(globals)
        cls = template_class or self.template_class
        return cls.from_code(self, self.compile(source), globals, None)
1140477
function template(str, params){
  return str.replace(/%(\w*)%/g, function(m, key){
    return params[key];
  });
}
716822
private function _applyInjections()
    {
        foreach ($this->injections as $head)
        {
            $tags = $this->_getInjectionString($head);

        }

        $this->template_markup = str_replace('</head>', $tags, $this->template_markup);
    }
1060201
private void compileTemplateString(ComponentExposedTypeGenerator exposedTypeGenerator,
      TemplateParserResult templateParserResult) {
    VueTemplateCompilerResult compilerResult;
    try {
      VueTemplateCompiler vueTemplateCompiler = new VueTemplateCompiler();
      compilerResult = vueTemplateCompiler.compile(templateParserResult.getProcessedTemplate());
    } catch (VueTemplateCompilerException e) {
      e.printStackTrace();
      throw new RuntimeException();
    }

    generateGetRenderFunction(exposedTypeGenerator, compilerResult, templateParserResult);
    generateGetStaticRenderFunctions(exposedTypeGenerator, compilerResult);
  }