"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useTranslation = void 0;
/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
const defaults = require("../UiFramework.json");
const React = require("react");
const core_react_1 = require("@itwin/core-react");
const UiFramework_1 = require("../UiFramework");
/** Returns a translation function.
 * @internal
 */
function useTranslation() {
    const fallback = React.useCallback((key) => {
        if (!UiFramework_1.UiFramework.initialized) {
            return undefined;
        }
        return UiFramework_1.UiFramework.translate(key);
    }, []);
    return (0, core_react_1.usePackageTranslation)({
        namespace: UiFramework_1.UiFramework.localizationNamespace,
        fallback,
        defaults,
    });
}
exports.useTranslation = useTranslation;
//# sourceMappingURL=useTranslation.js.map