Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language codes for non-English recognition | Are they different on Android and iOS? #452

Open
The-Linguist opened this issue Aug 17, 2022 · 2 comments

Comments

@The-Linguist
Copy link

The-Linguist commented Aug 17, 2022

On this page I see that "zh-CN" for mainland and "zh-TW" for Taiwan are listed for Chinese; and "zh" is not listed.
But on developers.apple.com like this page I often encounter "zh-Hans" and "zh-Hant".
Note that this confusion applies to most non-English languages, i.e. not only Chinese.
EDIT-1:
Tested on Mac OS, and setLanguage("zh"); works and setLanguage("zh-Hans"); doesn't work.
EDIT-2:
Tried listening to Arabic on Mac OS. For some reason setLanguage("ar"); makes it return possible phrases as recognized speech but no annyang commands fired (Safari 16.0) even though the string values were obviously matching. So I had to quit using annyang.addCommands(commands);
and instead I did something like,

annyang.addCallback('result', function() {
      // Run a for loop and use .search() to see if there is a match
});

and it worked.

With regards to the community

@The-Linguist
Copy link
Author

The-Linguist commented Aug 17, 2022

Additional things to mention:

  • Chrome seems to work fine with just "en" inside setLanguage() instead any of en-GB en-US en-AU en-CA en-IN en-NZ en-ZA and is good at catching both British and American pronunciations.
  • It looks like there is now also the "Edge" case about which I've never been able to run any tests. But would like to know if it expects exactly what Chrome expects or is any different.

@The-Linguist
Copy link
Author

The-Linguist commented Aug 17, 2022

Upon further and deeper search I've found https://www.ibabbleon.com/iOS-Language-Codes-ISO-639.html

It would be great if everyone «who gets to test it» shared his/her test results to let us find how reliable that is.

EDIT: As mentioned above in javascript annyang.setLanguage("zh"); works and annyang.setLanguage("zh-Hans"); doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant