How to use the @ngx-translate/core.TranslateDefaultParser function in @ngx-translate/core

To help you get started, we’ve selected a few @ngx-translate/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rucken / core / libs / rucken / core / src / lib / utils / interpolate.ts View on Github external
export function interpolate(value: string, words?: any) {
  const newArgs: any = {};
  for (const key in words) {
    if (words[key]) {
      if (typeof words[key] === 'string') {
        newArgs[key] = words[key];
      } else {
        if (typeof words[key] === 'number') {
          newArgs[key] = words[key].toString();
        }
      }
    }
  }
  try {
    const translateDefaultParser = new TranslateDefaultParser();
    value = translateDefaultParser.interpolate(value, newArgs);
  } catch (error) {}
  return value;
}