Q:

How to install language on iOS devices?

I'm coding a program for iOS 11 swift3. I'm trying to code the application for it to install the proper language pack if it's not installed on the iPhone already. The app is a "Learn English" program. I want to make sure the user has Chinese input installed on the iOS device already. I was wondering if anyone out there know's anything class iOS library that need to use in order to get it to download the language package?

A:

There is no way to add a keyboard programmatically. The user must do it by running the Settings app and going to General -> Keyboard -> Keyboards and selecting "Add New Keyboard...".
But you can detect if a certain keyboard is already installed or not. So you can check if the user has added a Chinese keyboard or not. If they haven't, you can show a message with instructions telling them how to add the keyboard.
var hasChinese = false
let keyboards = UITextInputMode.activeInputModes
for keyboard in keyboards {
    if let language = keyboard.primaryLanguage {
        if language.hasPrefix("zh") {
            hasChinese = true
        }
    }
}

if !hasChinese {
    // show message with instructions
}

You may wish to check for a specific Chinese keyboard instead of any Chinese keyboard. Adjust the check of language as needed.

