1 import { environment } from '../../environments/environment'
2 import IntlMessageFormat from 'intl-messageformat'
4 function isOnDevLocale () {
5 return environment.production === false && window.location.search === '?lang=fr'
8 function getDevLocale () {
12 function prepareIcu (icu: string) {
13 let alreadyWarned = false
16 const msg = new IntlMessageFormat(icu, $localize.locale)
18 return (context: { [id: string]: number | string }, fallback: string) => {
20 return msg.format(context) as string
22 if (!alreadyWarned) console.warn('Cannot format ICU %s.', icu, err)
29 console.warn('Cannot build intl message %s.', icu, err)
31 return (_context: unknown, fallback: string) => fallback