I believe you need to download the language files.
Have a look at this google translate Download languages to use offline
After a bit of research Google provide some thing called on-device translation. ML Kit's on-device translation API
According to the documentation you can download the files following
// Download the French model.
let frModel = TranslateRemoteModel.translateRemoteModel(language: .fr)
// Keep a reference to the download progress so you can check that the model
// is available before you use it.
progress = ModelManager.modelManager().download(
frModel,
conditions: ModelDownloadConditions(
allowsCellularAccess: false,
allowsBackgroundDownloading: true
)
)
And to translate
englishGermanTranslator.translate(text) { translatedText, error in
guard error == nil, let translatedText = translatedText else { return }
// Translation succeeded.
}
References = Translate text with ML Kit on iOS
Also have a look at the Example Project Provided by google - Swift 5