Sub AddLanguage (Identifier As String)
Dim locale As NativeObject
locale = locale.Initialize("NSLocale").RunMethod("alloc", Null).RunMethod("initWithLocaleIdentifier:", Array(Identifier))
Dim no As NativeObject = speech
no.GetField("languages").RunMethod("setObject:forKey:", Array(locale, Identifier))
End Sub
lang = "zh-TH"
AddLanguage(lang)
If speech.SetLanguage(lang) = False Then
TextView1.Text = "Speech Recognition not available."
Else
TextView1.Text = "Ready!"
SetState(True)
End If