Skip to content

Commit

Permalink
add support for language #5
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen authored and EddyVerbruggen committed Apr 10, 2017
1 parent b823de9 commit f90e237
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
*.js.map
*.log
!scripts/*.js
demo/app/*.js
!demo/karma.conf.js
!demo/app/tests/*.js
demo/*.d.ts
!demo/references.d.ts
demo/lib
demo/platforms
demo/node_modules
node_modules
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# NativeScript Speech Recognition

[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]
[![Twitter Follow][twitter-image]][twitter-url]

[npm-image]:http://img.shields.io/npm/v/nativescript-speech-recognition.svg
[npm-url]:https://npmjs.org/package/nativescript-speech-recognition
[downloads-image]:http://img.shields.io/npm/dm/nativescript-speech-recognition.svg
[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me
[twitter-url]:https://twitter.com/eddyverbruggen

This is the plugin [demo](https://github.com/EddyVerbruggen/nativescript-speech-recognition/tree/master/demo) in action..

| ..while recognizing Dutch 🇳🇱 | .. after recognizing American-English 🇺🇸 |
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-speech-recognition",
"version": "1.1.2",
"version": "1.1.3",
"description": "Speech to text plugin, leveraging iOS and Android's built-in recognition engines.",
"main": "speech-recognition",
"typings": "index.d.ts",
Expand All @@ -22,7 +22,7 @@
"setup": "npm i && cd demo && npm i && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
"changelog": "conventional-changelog -i CHANGELOG.md -s -r 0",
"changelog:add": "git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md'",
"dopublish": "npm run build; npm run changelog; npm publish"
"prepublish": "npm run build && npm run changelog && npm publish"
},
"repository": {
"type": "git",
Expand Down
5 changes: 4 additions & 1 deletion speech-recognition.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ export class SpeechRecognition implements SpeechRecognitionApi {
let intent = new android.content.Intent(android.speech.RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL, android.speech.RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(android.speech.RecognizerIntent.EXTRA_CALLING_PACKAGE, "voice.recognition.test");
intent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE, "en"); // TODO
// if not set, the default will be used
if (options.locale) {
intent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE, options.locale);
}
intent.putExtra(android.speech.RecognizerIntent.EXTRA_MAX_RESULTS, 100);
loopHandler.post(new java.lang.Runnable({
run: () => {
Expand Down

0 comments on commit f90e237

Please sign in to comment.