All files / utils/i18n-importer i18n-importer.js

100% Statements 31/31
100% Branches 2/2
100% Functions 2/2
100% Lines 31/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 321x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import { implementation } from './provider.js'
 
/**
 * Imports a {@link Translations} from an URL
 * @param {string | URL} url - target URL
 * @param {string | URL} base - Base URL to use when `url` uses relative url
 * @returns {Promise<Translations>} promise that results imported {@link Translations} object on finish
 */
export const importTranslations = (url, base) => implementation.importTranslations(url, base)
 
/**
 * Imports a {@link I18nDefinitionMap} from an URL
 * @param {string | URL} url - target URL
 * @param {string | URL} base - Base URL to use when `url` uses relative url
 * @returns {Promise<I18nDefinitionMap>} promise that results imported {@link I18nDefinitionMap} object on finish
 */
export const importDefinitionMap = (url, base) => implementation.importDefinitionMap(url, base)
 
/**
 * @typedef {Record<string, string>} Translations
 */
 
/**
 * @typedef {object} I18nDefinition
 * @property {string | string[]} [import]    - Additional files to import to the definition
 * @property {Translations}      translations - translation map
 */
 
/**
 * @typedef {Record<string, I18nDefinition>} I18nDefinitionMap
 */