UNPKG

@catchphrase/core

Version:

Functional i18n library for the web

16 lines (15 loc) 599 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createTranslation = void 0; const createTranslation = ({ languageSelector }) => (translationThunk) => { const translations = translationThunk(); const selectLanguage = (languageCode) => translations[languageCode]; const getLanguageCodes = () => Object.keys(translations); const getTranslations = () => selectLanguage(languageSelector()); return { selectLanguage, getLanguageCodes, getTranslations, }; }; exports.createTranslation = createTranslation;