import { APIUtils } from "../api/v1/APIUtils" ; const TranslationUtils = { getTranslationForLanguage ( data ) { if ( ! data . languageId ) { return null ; } let translationForLanguage ; if ( data . keyResponse ) { data . keyResponse . data . relationships . translations . data . some ( ( translationReference ) => { const translation = APIUtils . getIncludedObject ( translationReference , data . keyResponse . included ) ; if ( translation . relationships . language . data . id === data . languageId ) { if ( data . exportConfigId ) { if ( translation . relationships . export_config . data ?. id === data . exportConfigId ) { translationForLanguage = translation ; return true ; } } else if ( ! translation . relationships . export_config . data ?. id ) { translationForLanguage = translation ; return true ; } } } ) ; } return translationForLanguage ; } } ; export { TranslationUtils } ;