Skip to content

Commit cee5081

Browse files
committed
Merge branch '2026.1' into 2026.x
2 parents bd06255 + 15ea3b9 commit cee5081

31 files changed

Lines changed: 4029 additions & 57 deletions

File tree

assets/js/src/core/app/i18n/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
* @license Pimcore Open Core License (POCL)
99
*/
1010

11+
import trackError, { GeneralError } from '@Pimcore/modules/app/error-handler'
12+
import { isNonEmptyString } from '@sdk/utils'
1113
import i18n from 'i18next'
1214
import { initReactI18next } from 'react-i18next'
13-
import trackError, { GeneralError } from '@Pimcore/modules/app/error-handler'
14-
import { addMissingTranslation } from './store/missingTranslations.slice'
1515
import { store } from '../store'
16-
import { returnKeyIfEmptyProcessor } from './utils/post-processors'
17-
import { isNonEmptyString } from '@sdk/utils'
16+
import { addMissingTranslation } from './store/missingTranslations.slice'
17+
import { createDebugTranslationsProcessor, returnKeyIfEmptyProcessor } from './utils/post-processors'
1818

1919
export const FALLBACK_LANGUAGE = 'en'
2020

@@ -27,7 +27,7 @@ i18n
2727
resources: {},
2828
keySeparator: false,
2929
saveMissing: true,
30-
postProcess: ['returnKeyIfEmpty']
30+
postProcess: ['returnKeyIfEmpty', 'debugTranslations']
3131
})
3232

3333
.catch(() => {
@@ -36,6 +36,11 @@ i18n
3636

3737
i18n.use(returnKeyIfEmptyProcessor)
3838

39+
const debugTranslationsProcessor = createDebugTranslationsProcessor(
40+
() => (store.getState()).settings?.settings?.debug_admin_translations === true
41+
)
42+
i18n.use(debugTranslationsProcessor)
43+
3944
i18n.on('missingKey', (lngs, namespace, key, res) => {
4045
if (isNonEmptyString(key)) {
4146
store.dispatch(addMissingTranslation(key))

assets/js/src/core/app/i18n/utils/post-processors.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@
1212
* i18next post-processor that returns the key if the translation value is empty
1313
* Used consistently across main app and iframe i18n setup
1414
*/
15+
export const createDebugTranslationsProcessor = (getDebugMode: () => boolean): {
16+
type: 'postProcessor'
17+
name: string
18+
process: (value: string, key: string | string[]) => string
19+
} => ({
20+
type: 'postProcessor' as const,
21+
name: 'debugTranslations',
22+
process (value: string, key: string | string[]): string {
23+
if (!getDebugMode()) {
24+
return value
25+
}
26+
27+
const keyString = Array.isArray(key) ? key[0] : key
28+
const isMissingTranslation = value === keyString
29+
30+
return isMissingTranslation ? `+ ${value} +` : value
31+
}
32+
})
33+
1534
export const returnKeyIfEmptyProcessor = {
1635
type: 'postProcessor' as const,
1736
name: 'returnKeyIfEmpty',

public/build/0955b464-88c8-4611-a8a5-99a35d42aff4/entrypoints.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/0955b464-88c8-4611-a8a5-99a35d42aff4/manifest.json

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/29786a01-ac29-40dd-bc5b-6141d40a24f9/entrypoints.json

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/29786a01-ac29-40dd-bc5b-6141d40a24f9/exposeRemote.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)