UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

59 lines 2.03 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.useDateTranslationContext = exports.DateTranslationContextProvider = exports.getGlobalTranslations = exports.getTranslations = exports.getLocaleFromString = void 0; const locale_1 = require("date-fns/locale"); const helpers_1 = require("../utils/helpers"); const en_1 = __importDefault(require("../utils/i18n/locales/en")); const nn_1 = __importDefault(require("../utils/i18n/locales/nn")); /** @private */ const getLocaleFromString = (locale = "nb") => { switch (locale) { case "nn": return locale_1.nn; case "en": return locale_1.enGB; default: return locale_1.nb; } }; exports.getLocaleFromString = getLocaleFromString; /** * @private * Temporary for backwards compatibility with locale prop. Can be removed when locale prop has been removed. */ const getTranslations = (locale) => { switch (locale) { case "nn": return nn_1.default.DatePicker; case "en": case "en-GB": return en_1.default.DatePicker; default: return undefined; } }; exports.getTranslations = getTranslations; /** * @private * Temporary for backwards compatibility with locale prop. Can be removed when locale prop has been removed. */ const getGlobalTranslations = (locale) => { switch (locale) { case "nn": return nn_1.default.global; case "en": case "en-GB": return en_1.default.global; default: return undefined; } }; exports.getGlobalTranslations = getGlobalTranslations; _a = (0, helpers_1.createStrictContext)({ name: "DateTranslationContext", }), exports.DateTranslationContextProvider = _a.Provider, exports.useDateTranslationContext = _a.useContext; //# sourceMappingURL=Date.locale.js.map