import useEngineContext from "../../../../hooks/useEngineContext";

/** 读取引擎提供的多语言对象翻译函数；缺失时回退到 original/en。 */
export var useTranslation = function useTranslation() {
  var _context$appHelper;
  var context = useEngineContext();
  return (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.translation) || function (val) {
    if (typeof val === 'string') return val;
    return (val === null || val === void 0 ? void 0 : val.original) || (val === null || val === void 0 ? void 0 : val.en) || '';
  };
};