feat(SW-706): use Lokalise
This commit is contained in:
@@ -4,6 +4,8 @@ import { IntlProvider } from "react-intl"
|
|||||||
|
|
||||||
import type { ClientIntlProviderProps } from "@/types/i18n"
|
import type { ClientIntlProviderProps } from "@/types/i18n"
|
||||||
|
|
||||||
|
const logged: Record<string, boolean> = {}
|
||||||
|
|
||||||
export default function ClientIntlProvider({
|
export default function ClientIntlProvider({
|
||||||
children,
|
children,
|
||||||
locale,
|
locale,
|
||||||
@@ -15,6 +17,21 @@ export default function ClientIntlProvider({
|
|||||||
locale={locale}
|
locale={locale}
|
||||||
defaultLocale={defaultLocale}
|
defaultLocale={defaultLocale}
|
||||||
messages={messages}
|
messages={messages}
|
||||||
|
onError={(err) => {
|
||||||
|
let msg = err.message
|
||||||
|
|
||||||
|
if (err.code === "MISSING_TRANSLATION") {
|
||||||
|
const id = err.descriptor?.id
|
||||||
|
if (id) {
|
||||||
|
msg = id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!logged[msg]) {
|
||||||
|
logged[msg] = true
|
||||||
|
console.warn(err)
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</IntlProvider>
|
</IntlProvider>
|
||||||
|
|||||||
+5924
-1046
File diff suppressed because it is too large
Load Diff
+5916
-1044
File diff suppressed because it is too large
Load Diff
+5920
-1041
File diff suppressed because it is too large
Load Diff
+5936
-1044
File diff suppressed because it is too large
Load Diff
+5923
-1040
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"WcBpRV": [
|
||||||
|
{
|
||||||
|
"type": 1,
|
||||||
|
"value": "roomSizeMin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": 0,
|
||||||
|
"value": "-"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": 1,
|
||||||
|
"value": "roomSizeMax"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": 0,
|
||||||
|
"value": " m²"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+5928
-1044
File diff suppressed because it is too large
Load Diff
@@ -158,7 +158,7 @@ export async function download(extractPath: string) {
|
|||||||
icu_numeric: true,
|
icu_numeric: true,
|
||||||
bundle_structure: "%LANG_ISO%.%FORMAT%",
|
bundle_structure: "%LANG_ISO%.%FORMAT%",
|
||||||
directory_prefix: "",
|
directory_prefix: "",
|
||||||
filter_data: ["last_reviewed_only"],
|
filter_data: ["translated", "nonhidden"],
|
||||||
export_empty_as: "skip",
|
export_empty_as: "skip",
|
||||||
})
|
})
|
||||||
performance.mark("lokaliseDownloadInitEnd")
|
performance.mark("lokaliseDownloadInitEnd")
|
||||||
|
|||||||
@@ -22,8 +22,10 @@
|
|||||||
"i18n:extract": "formatjs extract \"{actions,app,components,constants,hooks,i18n,lib,middlewares,server,stores,utils}/**/*.{ts,tsx}\" --format i18n/tooling/formatter.mjs --out-file i18n/tooling/extracted.json",
|
"i18n:extract": "formatjs extract \"{actions,app,components,constants,hooks,i18n,lib,middlewares,server,stores,utils}/**/*.{ts,tsx}\" --format i18n/tooling/formatter.mjs --out-file i18n/tooling/extracted.json",
|
||||||
"i18n:upload": "jiti i18n/tooling/upload.ts",
|
"i18n:upload": "jiti i18n/tooling/upload.ts",
|
||||||
"i18n:download": "jiti i18n/tooling/download.ts",
|
"i18n:download": "jiti i18n/tooling/download.ts",
|
||||||
"i18n:compile": "formatjs compile-folder --ast --format i18n/tooling/formatter.mjs i18n/tooling/translations i18n/dictionaries2",
|
"i18n:compile": "formatjs compile-folder --ast --format i18n/tooling/formatter.mjs i18n/tooling/translations i18n/dictionaries",
|
||||||
"i18n:sync": "yarn i18n:extract && yarn i18n:upload && yarn i18n:download && yarn i18n:compile"
|
"i18n:push": "yarn i18n:extract && yarn i18n:upload",
|
||||||
|
"i18n:pull": "yarn i18n:download && yarn i18n:compile",
|
||||||
|
"i18n:sync": "yarn i18n:push && yarn i18n:pull"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.27",
|
"@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.27",
|
||||||
|
|||||||
Reference in New Issue
Block a user