如何在我的应用程序中添加泰米尔语。我的 Xcode 版本是 9.2

How to add Tamil Language in my app. My Xcode Version is 9.2

我在我的应用程序中实现了本地化。添加泰米尔语我遵循以下 link enter link description here 如何在编辑方案选项中选择泰米尔语。我没有看到泰米尔语。查看屏幕截图 [![在此处输入图片描述][2]][2] 如何在我的应用程序中添加泰米尔语。任何人帮助我。

您不能在方案中添加它的原因是这些仅适用于 iOS 系统语言。泰米尔语不是 iOS 的可选系统语言,但您仍然可以在本地化中使用它。在项目本地化中:

转到建议列表的底部并 select 'other'。将打开一个新列表,您可以在那里选择泰米尔语。

项目变量中的此处。

作为应用程序语言,您需要实现语言选择器按钮。看评论里的link或者做下面的,添加一个函数:

func changeToLanguage(_ langCode: String) {
    if Bundle.main.preferredLocalizations.first != langCode {
        let message = NSLocalizedString("In order to change the language, the App must be closed and reopened by you.", comment: "")
        let confirmAlertCtrl = UIAlertController(title: NSLocalizedString("App restart required", comment: ""), message: message, preferredStyle: .alert)

        let confirmAction = UIAlertAction(title: NSLocalizedString("Close now", comment: ""), style: .destructive) { _ in
            UserDefaults.standard.set([langCode], forKey: "AppleLanguages")
            UserDefaults.standard.synchronize()
            exit(EXIT_SUCCESS)
        }
        confirmAlertCtrl.addAction(confirmAction)

        let cancelAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil)
        confirmAlertCtrl.addAction(cancelAction)

        present(confirmAlertCtrl, animated: true, completion: nil)
    }
} 

并通过按钮调用它:

@IBAction func didPressChangeLanguageButton() {
        let message = NSLocalizedString("Change language of this app including its content.", comment: "")
        let sheetCtrl = UIAlertController(title: NSLocalizedString("Choose language", comment: ""), message: message, preferredStyle: .actionSheet)

        for languageCode in Bundle.main.localizations.filter({ [=11=] != "Base" }) {
            let langName = Locale.current.localizedString(forLanguageCode: languageCode)
            if languageCode != "(null)" {
                let action = UIAlertAction(title: NSLocalizedString(langName!, comment: ""), style: .default) { _ in
                self.changeToLanguage(languageCode) // see step #2
                }
                sheetCtrl.addAction(action)
            }
        }

        let cancelAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil)
        sheetCtrl.addAction(cancelAction)

        sheetCtrl.popoverPresentationController?.sourceView = self.view
        sheetCtrl.popoverPresentationController?.sourceRect = self.changeLanguageButton.frame
        present(sheetCtrl, animated: true, completion: nil)
    }