Comparing version 1.0.0 to 1.1.0
@@ -1,3 +0,1 @@ | ||
import { TranslateDefaultParser } from '@ngx-translate/core'; | ||
function getSupportedLocale(wanted, available, fallback, redirects) { | ||
@@ -237,3 +235,11 @@ if (available.has(wanted)) { | ||
const parser = new TranslateDefaultParser(); | ||
let parser; // @todo Okay originally it wasn't too much of a problem to use @ngx-translate server-side. | ||
// Now it's a shit sandwich as you can see below and we should replace it by a hand-made solution that behaves | ||
// similarly. | ||
import( | ||
/* webpackIgnore: true */ | ||
'@angular/compiler').then(() => import( | ||
/* webpackIgnore: true */ | ||
'@ngx-translate/core')).then(mod => parser = new mod.TranslateDefaultParser()); | ||
/** | ||
@@ -315,2 +321,4 @@ * Gets a translation function parametrized to use the locale defined in the request, the locale that's really applied | ||
function translate(registry, locale, key, values) { | ||
var _a; | ||
const translation = registry.getTranslations(locale); | ||
@@ -321,3 +329,3 @@ const defaultTranslation = registry.getTranslations(registry.defaultLocale); // Leave || operator, don't use ?? because we want to use fallbacks on '' strings. | ||
return parser.interpolate(value, values); | ||
return (_a = parser.interpolate(value, values)) !== null && _a !== void 0 ? _a : key; | ||
} | ||
@@ -324,0 +332,0 @@ /** |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ngx-translate/core')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@ngx-translate/core'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Intl = {}, global.core)); | ||
})(this, (function (exports, core) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Intl = {})); | ||
})(this, (function (exports) { 'use strict'; | ||
@@ -414,3 +414,15 @@ /*! ***************************************************************************** | ||
var parser = new core.TranslateDefaultParser(); | ||
var parser; // @todo Okay originally it wasn't too much of a problem to use @ngx-translate server-side. | ||
// Now it's a shit sandwich as you can see below and we should replace it by a hand-made solution that behaves | ||
// similarly. | ||
import( | ||
/* webpackIgnore: true */ | ||
'@angular/compiler').then(function () { | ||
return import( | ||
/* webpackIgnore: true */ | ||
'@ngx-translate/core'); | ||
}).then(function (mod) { | ||
return parser = new mod.TranslateDefaultParser(); | ||
}); | ||
/** | ||
@@ -492,2 +504,4 @@ * Gets a translation function parametrized to use the locale defined in the request, the locale that's really applied | ||
function translate(registry, locale, key, values) { | ||
var _a; | ||
var translation = registry.getTranslations(locale); | ||
@@ -498,3 +512,3 @@ var defaultTranslation = registry.getTranslations(registry.defaultLocale); // Leave || operator, don't use ?? because we want to use fallbacks on '' strings. | ||
return parser.interpolate(value, values); | ||
return (_a = parser.interpolate(value, values)) !== null && _a !== void 0 ? _a : key; | ||
} | ||
@@ -501,0 +515,0 @@ /** |
{ | ||
"name": "@mitm/intl", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "./intl.umd.js", | ||
@@ -9,4 +9,6 @@ "module": "./intl.esm.js", | ||
"peerDependencies": { | ||
"@ngx-translate/core": "^13.0.0" | ||
"date-fns": "^2.25.0", | ||
"@ngx-translate/core": "^14.0.0", | ||
"@angular/compiler": "^13.0.2" | ||
} | ||
} |
43480
966
3