REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.51 KB
Close
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/lib/utils/translate-functions.factory.js
Text
Base64
import startCase from 'lodash/startCase.js'; /** * @memberof TranslateFunctions * @alias TranslateFunction */ /** * Translate Functions are the helper functions which you can use to translate * your application. * * On the fronted they can be used with {@link useTranslation} hook. On the backend * they are injected to any {@link AdminJS} instance and {@link ActionContext}. */ const translate = (i18n, key, name, resourceId, options = {}) => { // cspell:disable-next-line if (i18n.language === 'cimode') return [key, name].join('.'); let realOptions = { ...options, defaultValue: options.defaultValue ?? startCase(name) }; let keys = [`${key}.${name}`]; if (resourceId && typeof resourceId !== 'string') { realOptions = resourceId; } else if (resourceId) { keys = [`resources.${resourceId}.${key}.${name}`, ...keys]; } return i18n.t(keys, realOptions); }; export const createFunctions = i18n => { const translateAction = (actionName, resourceId, options) => translate(i18n, 'actions', actionName, resourceId, options); const translateButton = (buttonLabel, resourceId, options) => translate(i18n, 'buttons', buttonLabel, resourceId, options); const translateLabel = (label, resourceId, options) => translate(i18n, 'labels', label, resourceId, options); const translateProperty = (propertyName, resourceId, options) => translate(i18n, 'properties', propertyName, resourceId, options); const translateMessage = (messageName, resourceId, options) => translate(i18n, 'messages', messageName, resourceId, { ...options, defaultValue: options?.defaultValue ?? messageName }); const translateComponent = (messageName, resourceId, options) => translate(i18n, 'components', messageName, resourceId, options); const translatePage = (messageName, resourceId, options) => translate(i18n, 'pages', messageName, resourceId, options); return { translateAction, ta: translateAction, translateButton, tb: translateButton, translateLabel, tl: translateLabel, translateProperty, tp: translateProperty, translateMessage, tm: translateMessage, translateComponent, tc: translateComponent, translatePage, t: i18n.t, translate: i18n.t }; }; /** * ES Modules exports are immutable thus Sinon cannot create stubs for e.g. createFunctions * Wrapping the exports in an object allows Sinon to modify it's properties. * * This prevents Sinon error from appearing: * "TypeError: ES Modules cannot be stubbed" */ export const __testExports = { createFunctions };
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 2 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
flat
DIR
-
drwxr-xr-x
2026-02-28 00:31:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
param-converter
DIR
-
drwxr-xr-x
2026-02-28 00:31:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
error-type.enum.js
508 B
lrw-r--r--
2026-02-28 00:31:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
file-resolver.js
1.39 KB
lrw-r--r--
2026-02-28 00:31:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.js
164 B
lrw-r--r--
2026-02-28 00:31:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
theme-bundler.js
404 B
lrw-r--r--
2026-02-28 00:31:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
translate-functions.factory.js
2.51 KB
lrw-r--r--
2026-02-28 00:31:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).