REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 5.49 KB
Close
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/react-i18next/dist/es/useTranslation.js
Text
Base64
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _typeof from "@babel/runtime/helpers/typeof"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } import { useState, useEffect, useContext, useRef } from 'react'; import { getI18n, getDefaults, ReportNamespaces, I18nContext } from './context.js'; import { warnOnce, loadNamespaces, loadLanguages, hasLoadedNamespace } from './utils.js'; var usePrevious = function usePrevious(value, ignore) { var ref = useRef(); useEffect(function () { ref.current = ignore ? ref.current : value; }, [value, ignore]); return ref.current; }; export function useTranslation(ns) { var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var i18nFromProps = props.i18n; var _ref = useContext(I18nContext) || {}, i18nFromContext = _ref.i18n, defaultNSFromContext = _ref.defaultNS; var i18n = i18nFromProps || i18nFromContext || getI18n(); if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces(); if (!i18n) { warnOnce('You will need to pass in an i18next instance by using initReactI18next'); var notReadyT = function notReadyT(k, optsOrDefaultValue) { if (typeof optsOrDefaultValue === 'string') return optsOrDefaultValue; if (optsOrDefaultValue && _typeof(optsOrDefaultValue) === 'object' && typeof optsOrDefaultValue.defaultValue === 'string') return optsOrDefaultValue.defaultValue; return Array.isArray(k) ? k[k.length - 1] : k; }; var retNotReady = [notReadyT, {}, false]; retNotReady.t = notReadyT; retNotReady.i18n = {}; retNotReady.ready = false; return retNotReady; } if (i18n.options.react && i18n.options.react.wait !== undefined) warnOnce('It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.'); var i18nOptions = _objectSpread(_objectSpread(_objectSpread({}, getDefaults()), i18n.options.react), props); var useSuspense = i18nOptions.useSuspense, keyPrefix = i18nOptions.keyPrefix; var namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS; namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation']; if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces); var ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(function (n) { return hasLoadedNamespace(n, i18n, i18nOptions); }); function getT() { return i18n.getFixedT(props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix); } var _useState = useState(getT), _useState2 = _slicedToArray(_useState, 2), t = _useState2[0], setT = _useState2[1]; var joinedNS = namespaces.join(); if (props.lng) joinedNS = "".concat(props.lng).concat(joinedNS); var previousJoinedNS = usePrevious(joinedNS); var isMounted = useRef(true); useEffect(function () { var bindI18n = i18nOptions.bindI18n, bindI18nStore = i18nOptions.bindI18nStore; isMounted.current = true; if (!ready && !useSuspense) { if (props.lng) { loadLanguages(i18n, props.lng, namespaces, function () { if (isMounted.current) setT(getT); }); } else { loadNamespaces(i18n, namespaces, function () { if (isMounted.current) setT(getT); }); } } if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) { setT(getT); } function boundReset() { if (isMounted.current) setT(getT); } if (bindI18n && i18n) i18n.on(bindI18n, boundReset); if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset); return function () { isMounted.current = false; if (bindI18n && i18n) bindI18n.split(' ').forEach(function (e) { return i18n.off(e, boundReset); }); if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(function (e) { return i18n.store.off(e, boundReset); }); }; }, [i18n, joinedNS]); var isInitial = useRef(true); useEffect(function () { if (isMounted.current && !isInitial.current) { setT(getT); } isInitial.current = false; }, [i18n, keyPrefix]); var ret = [t, i18n, ready]; ret.t = t; ret.i18n = i18n; ret.ready = ready; if (ready) return ret; if (!ready && !useSuspense) return ret; throw new Promise(function (resolve) { if (props.lng) { loadLanguages(i18n, props.lng, namespaces, function () { return resolve(); }); } else { loadNamespaces(i18n, namespaces, function () { return resolve(); }); } }); }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 16
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
context.js
2.90 KB
lrw-r--r--
2026-02-28 00:27:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
defaults.js
1.48 KB
lrw-r--r--
2026-02-28 00:27:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
I18nextProvider.js
429 B
lrw-r--r--
2026-02-28 00:27:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
i18nInstance.js
135 B
lrw-r--r--
2026-02-28 00:28:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.js
994 B
lrw-r--r--
2026-02-28 00:28:26
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
initReactI18next.js
246 B
lrw-r--r--
2026-02-28 00:28:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
package.json
37 B
lrw-r--r--
2026-02-28 00:29:16
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Trans.js
2.58 KB
lrw-r--r--
2026-02-28 00:28:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Translation.js
687 B
lrw-r--r--
2026-02-28 00:28:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TransWithoutContext.js
11.97 KB
lrw-r--r--
2026-02-28 00:28:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
unescape.js
684 B
lrw-r--r--
2026-02-28 00:29:00
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useSSR.js
1.02 KB
lrw-r--r--
2026-02-28 00:29:04
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useTranslation.js
5.49 KB
lrw-r--r--
2026-02-28 00:29:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
utils.js
3.38 KB
lrw-r--r--
2026-02-28 00:29:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
withSSR.js
1.89 KB
lrw-r--r--
2026-02-28 00:29:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
withTranslation.js
2.73 KB
lrw-r--r--
2026-02-28 00:29:12
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).