1

Can we get the language of the current keyboard that user is using.. that is see wether the user is using English keyboard or Chinese Keyboard or some other language one…?

I can get the language of the device but i have to get the user's typing language.

Thanks in advance.

Ahmed Z.
  • 2,329
  • 23
  • 52

2 Answers2

2

You can get like bellow

[UITextInputMode currentInputMode].primaryLanguage
Rajesh
  • 948
  • 7
  • 13
1

From this documentation, you can further get the displayName of the language using NSLocale.

NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:[YOUR_TEXTFIELD_INSTANCE textInputMode].primaryLanguage];
    NSLog(@"%@", [locale displayNameForKey:NSLocaleIdentifier value:[YOUR_TEXTFIELD_INSTANCE textInputMode].primaryLanguage]);

NSLog prints "English (United States)" if the primary language is En-US.

Note: currentInputMode is deprecated from iOS 7.0. Consider using textInputMode like above.

GenieWanted
  • 4,473
  • 4
  • 24
  • 35