Drop ios 12 support
This commit is contained in:
parent
3842a527f6
commit
c2ff5c112b
|
@ -208,11 +208,7 @@
|
|||
"is-plain-object",
|
||||
"parse-srcset",
|
||||
"deepmerge",
|
||||
"core-js/features/reflect",
|
||||
"@formatjs/intl-locale/polyfill",
|
||||
"@formatjs/intl-locale/should-polyfill",
|
||||
"@formatjs/intl-pluralrules/polyfill-force",
|
||||
"@formatjs/intl-pluralrules/should-polyfill"
|
||||
"core-js/features/reflect"
|
||||
],
|
||||
"scripts": [],
|
||||
"extractLicenses": false,
|
||||
|
|
|
@ -53,8 +53,6 @@
|
|||
"@angular/platform-browser-dynamic": "^18.0.4",
|
||||
"@angular/router": "^18.0.4",
|
||||
"@angular/service-worker": "^18.0.4",
|
||||
"@formatjs/intl-locale": "^4.0.0",
|
||||
"@formatjs/intl-pluralrules": "^5.2.2",
|
||||
"@ng-bootstrap/ng-bootstrap": "^17.0.0",
|
||||
"@ngx-loading-bar/core": "^6.0.0",
|
||||
"@ngx-loading-bar/http-client": "^6.0.0",
|
||||
|
|
|
@ -1,57 +1,22 @@
|
|||
import IntlMessageFormat from 'intl-messageformat'
|
||||
import { shouldPolyfill as shouldPolyfillLocale } from '@formatjs/intl-locale/should-polyfill'
|
||||
import { shouldPolyfill as shouldPolyfillPlural } from '@formatjs/intl-pluralrules/should-polyfill'
|
||||
import { logger } from '@root-helpers/logger'
|
||||
import IntlMessageFormat from 'intl-messageformat'
|
||||
import { environment } from '../../environments/environment'
|
||||
|
||||
function isOnDevLocale () {
|
||||
export function isOnDevLocale () {
|
||||
return environment.production === false && window.location.search === '?lang=fr'
|
||||
}
|
||||
|
||||
function getDevLocale () {
|
||||
export function getDevLocale () {
|
||||
return 'fr-FR'
|
||||
}
|
||||
|
||||
async function polyfillICU () {
|
||||
// Important to be in this order, Plural needs Locale (https://formatjs.io/docs/polyfills/intl-pluralrules)
|
||||
await polyfillICULocale()
|
||||
await polyfillICUPlural()
|
||||
}
|
||||
|
||||
async function polyfillICULocale () {
|
||||
// This locale is supported
|
||||
if (shouldPolyfillLocale()) {
|
||||
// TODO: remove, it's only needed to support Plural polyfill and so iOS 12
|
||||
console.log('Loading Intl Locale polyfill for ' + $localize.locale)
|
||||
|
||||
await import('@formatjs/intl-locale/polyfill')
|
||||
}
|
||||
}
|
||||
|
||||
async function polyfillICUPlural () {
|
||||
const unsupportedLocale = shouldPolyfillPlural($localize.locale)
|
||||
|
||||
// This locale is supported
|
||||
if (!unsupportedLocale) {
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: remove, it's only needed to support iOS 12
|
||||
console.log('Loading Intl Plural rules polyfill for ' + $localize.locale)
|
||||
|
||||
// Load the polyfill 1st BEFORE loading data
|
||||
await import('@formatjs/intl-pluralrules/polyfill-force')
|
||||
// Degraded mode, so only load the en local data
|
||||
await import(`@formatjs/intl-pluralrules/locale-data/en.js`)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const icuCache = new Map<string, IntlMessageFormat>()
|
||||
const icuWarnings = new Set<string>()
|
||||
const fallback = 'String translation error'
|
||||
|
||||
function formatICU (icu: string, context: { [id: string]: number | string }) {
|
||||
export function formatICU (icu: string, context: { [id: string]: number | string }) {
|
||||
try {
|
||||
let msg = icuCache.get(icu)
|
||||
|
||||
|
@ -70,10 +35,3 @@ function formatICU (icu: string, context: { [id: string]: number | string }) {
|
|||
return fallback
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
getDevLocale,
|
||||
polyfillICU,
|
||||
formatICU,
|
||||
isOnDevLocale
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import {
|
|||
ServerService,
|
||||
getCoreProviders
|
||||
} from './app/core'
|
||||
import { polyfillICU } from './app/helpers'
|
||||
import { getMainProviders } from './app/shared/shared-main/main-providers'
|
||||
import { environment } from './environments/environment'
|
||||
import { logger } from './root-helpers'
|
||||
|
@ -95,11 +94,6 @@ const bootstrap = () => bootstrapApplication(AppComponent, {
|
|||
useFactory: loadConfigFactory,
|
||||
deps: [ ServerService, PluginService, RedirectService ],
|
||||
multi: true
|
||||
},
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: () => polyfillICU,
|
||||
multi: true
|
||||
}
|
||||
]
|
||||
})
|
||||
|
|
|
@ -1634,30 +1634,6 @@
|
|||
"@formatjs/ecma402-abstract" "2.0.0"
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@formatjs/intl-enumerator@1.4.7":
|
||||
version "1.4.7"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/intl-enumerator/-/intl-enumerator-1.4.7.tgz#6ab697f3f8f18cf0cc6a6b028cb9c40db6001f3d"
|
||||
integrity sha512-03RHnFqfpB4H/jwCwlzC+wkTDk2Fi24JmVIY2PVGvTUpikN2bSr9+8oTXfOC+y7B7VxjCArUnqWXVoctkmy85w==
|
||||
dependencies:
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@formatjs/intl-getcanonicallocales@2.3.0":
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/intl-getcanonicallocales/-/intl-getcanonicallocales-2.3.0.tgz#b6c6fa1c664e30a61f27fa6399a76159d82a5842"
|
||||
integrity sha512-BOXbLwqQ7nKua/l7tKqDLRN84WupDXFDhGJQMFvsMVA2dKuOdRaWTxWpL3cJ7qPkoNw11Jf+Xpj4OSPBBvW0eQ==
|
||||
dependencies:
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@formatjs/intl-locale@^4.0.0":
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/intl-locale/-/intl-locale-4.0.0.tgz#c111a33078413eba2011e82140466261eb1d67cd"
|
||||
integrity sha512-+4dbMEGsp1bvB3JB3UHH6YTjMnFTifnfdaHp4ROrCCu50NedA69RBsDCG3eivcZkbj57X9ehGhMWjLxlP+gyVw==
|
||||
dependencies:
|
||||
"@formatjs/ecma402-abstract" "2.0.0"
|
||||
"@formatjs/intl-enumerator" "1.4.7"
|
||||
"@formatjs/intl-getcanonicallocales" "2.3.0"
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@formatjs/intl-localematcher@0.5.4":
|
||||
version "0.5.4"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/intl-localematcher/-/intl-localematcher-0.5.4.tgz#caa71f2e40d93e37d58be35cfffe57865f2b366f"
|
||||
|
@ -1665,15 +1641,6 @@
|
|||
dependencies:
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@formatjs/intl-pluralrules@^5.2.2":
|
||||
version "5.2.14"
|
||||
resolved "https://registry.yarnpkg.com/@formatjs/intl-pluralrules/-/intl-pluralrules-5.2.14.tgz#7477bd2aa9bfde9e543d839707eff5460eb08026"
|
||||
integrity sha512-l6Ev7aOGXJSh5EPDEqzsbyufdCCKXZk993QXRQebLsB0TXRhIyF4alqjdMEatLwIigK/Mka8kiVIOLeFP5Cj9Q==
|
||||
dependencies:
|
||||
"@formatjs/ecma402-abstract" "2.0.0"
|
||||
"@formatjs/intl-localematcher" "0.5.4"
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@humanwhocodes/config-array@^0.11.14":
|
||||
version "0.11.14"
|
||||
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b"
|
||||
|
|
Loading…
Reference in New Issue