test(ivy): add i18n integration tests via TestBed (#27852)
PR Close #27852
This commit is contained in:

committed by
Kara Erickson

parent
ac5f5ed0a6
commit
4613864fc8
@ -16,13 +16,12 @@
|
||||
export function polyfillGoogGetMsg(translations: {[key: string]: string} = {}): void {
|
||||
const glob = (global as any);
|
||||
glob.goog = glob.goog || {};
|
||||
glob.goog.getMsg =
|
||||
glob.goog.getMsg || function(input: string, placeholders: {[key: string]: string} = {}) {
|
||||
if (typeof translations[input] !== 'undefined') { // to account for empty string
|
||||
input = translations[input];
|
||||
}
|
||||
return Object.keys(placeholders).length ?
|
||||
input.replace(/\{\$(.*?)\}/g, (match, key) => placeholders[key] || '') :
|
||||
input;
|
||||
};
|
||||
}
|
||||
glob.goog.getMsg = function(input: string, placeholders: {[key: string]: string} = {}) {
|
||||
if (typeof translations[input] !== 'undefined') { // to account for empty string
|
||||
input = translations[input];
|
||||
}
|
||||
return Object.keys(placeholders).length ?
|
||||
input.replace(/\{\$(.*?)\}/g, (match, key) => placeholders[key] || '') :
|
||||
input;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user