//#region ../@intlayer/cli/dist/esm/core/dist/esm/interpreter/getTranslation.mjs
/**
*
* Allow to pick a content based on a locale.
* If not locale found, it will return the content related to the default locale.
*
* Return either the content editor, or the content itself depending on the configuration.
*
* Usage:
*
* ```ts
* const content = getTranslation<string>({
* en: 'Hello',
* fr: 'Bonjour',
* }, 'fr');
* // 'Bonjour'
* ```
*
* Using TypeScript:
* - this function will require each locale to be defined if defined in the project configuration.
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
*/
const getTranslation = (languageContent, locale, fallback) => {
	let result = languageContent[locale];
	if (fallback && !result) result = languageContent[fallback];
	return result;
};

//#endregion
export { getTranslation };
//# sourceMappingURL=getTranslation.mjs.map