@enact/i18n
Version:
Internationalization support for Enact using iLib
34 lines (31 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = exports.I18nContext = void 0;
exports.useI18nContext = useI18nContext;
var _react = require("react");
var I18nContext = exports.I18nContext = /*#__PURE__*/(0, _react.createContext)(null);
/**
* Object returned by `useI18nContext`
*
* @typedef {Object} useI18nContextInterface
* @memberof i18n/I18nDecorator
* @property {Boolean} loaded `true` when external resource files have been loaded
* @property {Boolean} rtl `true` for locales with right-to-left reading order
* @property {Function} updateLocale Updates the locale
* @property {String} locale Current locale
* @private
*/
/**
* Retrieves the current locale and a method to update the current locale
*
* @returns {useI18nContextInterface}
* @private
*/
function useI18nContext() {
// This isn't adding much value but does allow a layer of abstraction so we don't have to export
// the I18nContext object and can add private API if needed later.
return (0, _react.use)(I18nContext);
}
var _default = exports["default"] = useI18nContext;