import { APIUtils } from "../api/v1/APIUtils" ; import { IGetLanguagesResponse , ILanguage } from "../api/v1/LanguagesAPI" ; import { IGetMachineTranslationsSourceLanguages } from "../api/v1/MachineTranslationsAPI" ; const MachineTranslationUtils = { supportsMachineTranslationAsSourceLanguage ( data ) { if ( ! data . language ) { return false ; } const defaultLanguageLanguageCode = APIUtils . getIncludedObject ( data . language . relationships . language_code . data , data . languagesResponse . included ) ; return data . supportedSourceLanguages ?. data ?. some ( ( supportedSourceLanguage ) => { return supportedSourceLanguage . attributes . language_code === defaultLanguageLanguageCode . attributes . code ; } ) ; } } ; export { MachineTranslationUtils } ;