Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0'
Browse files Browse the repository at this point in the history
* release/v1.1.0:
  1.1.0
  Speak a message when no available voice language was detected for the text
  Tiles for the web store
  Mention TTS as a keyword
  • Loading branch information
joelpurra committed Dec 31, 2016
2 parents 0d5b88a + 2b8e5b7 commit f2a77f7
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -19,7 +19,7 @@

## Features

- Uses your browser's built-in [Web Speech API for text-to-speech](https://www.w3.org/community/speech-api/) known as [Speech Synthesis](https://dvcs.w3.org/hg/speech-api/raw-file/9a0075d25326/speechapi.html#tts-section).
- Uses your browser's built-in [Web Speech API for text-to-speech (TTS)](https://www.w3.org/community/speech-api/) known as [Speech Synthesis](https://dvcs.w3.org/hg/speech-api/raw-file/9a0075d25326/speechapi.html#tts-section).
- Privacy aware.
- All text and speech is processed internally by your browser. While ultimately depending on your specific browser, all processing is expected to be done on your own machine and not use a server.
- Sound is only produced, never recorded.
Expand Down
8 changes: 8 additions & 0 deletions _locales/en/messages.json
Expand Up @@ -17,5 +17,13 @@
},
"noTextSelectedMessage": {
"message": "Please select desired text on the website first!"
},
"noVoiceForLanguageDetectedMessage": {
"message": "Sorry, no available voice language detected for the selected text.",
"description": "This is a fallback message. For this reason it is always in English."
},
"noVoiceForLanguageDetectedMessageLanguage": {
"message": "en",
"description": "This is a fallback message. For this reason it is always in English."
}
}
8 changes: 8 additions & 0 deletions _locales/sv/messages.json
Expand Up @@ -17,5 +17,13 @@
},
"noTextSelectedMessage": {
"message": "Vänligen markera önskad text först!"
},
"noVoiceForLanguageDetectedMessage": {
"message": "Sorry, no available voice language detected for the selected text.",
"description": "This is a fallback message. For this reason it is always in English."
},
"noVoiceForLanguageDetectedMessageLanguage": {
"message": "en",
"description": "This is a fallback message. For this reason it is always in English."
}
}
2 changes: 1 addition & 1 deletion manifest.json
@@ -1,6 +1,6 @@
{
"manifest_version": 2,
"version": "1.0.1",
"version": "1.1.0",
"name": "__MSG_extensionName__",
"short_name": "__MSG_extensionShortName__",
"description": "__MSG_extensionDescription__",
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,8 +1,8 @@
{
"name": "talkie",
"private": true,
"version": "1.0.1",
"description": "Text-to-speech browser extension button.",
"version": "1.1.0",
"description": "Text-to-speech (TTS) browser extension button.",
"scripts": {
"package": "rimraf .package && mkdir -p .package/ && cp -r _locales resources src CLA.md LICENSE README.md manifest.json .package/ && cd .package/ && zip -vr \"../talkie-joelpurra.com-${npm_package_version}.zip\" .",
"version:get": "git rev-parse --abbrev-ref HEAD | sed -n -e '/release/ s_release/__ p'",
Expand Down
Binary file added resources/tile/440x280/2016-12-31.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/tile/920x680/2016-12-31.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/background.js
Expand Up @@ -66,6 +66,11 @@ const noTextSelectedMessage = {
effectiveLanguage: chrome.i18n.getMessage("@@ui_locale"),
};

const noVoiceForLanguageDetectedMessage = {
text: chrome.i18n.getMessage("noVoiceForLanguageDetectedMessage"),
effectiveLanguage: chrome.i18n.getMessage("noVoiceForLanguageDetectedMessageLanguage"),
};

const setup = () => promiseTry(
() => {
log("Start", "Pre-requisites check");
Expand Down Expand Up @@ -440,8 +445,17 @@ const cleanupSelections = (allVoices, detectedPageLanguage, selections) => promi
};
};

const fallbackMessageForNoLanguageDetected = (selection) => {
if (selection.effectiveLanguage === null) {
return noVoiceForLanguageDetectedMessage;
}

return selection;
};

const selectionsWithValidTextAndDetectedLanguageAndEffectiveLanguage = selectionsWithValidTextAndDetectedLanguage.map(cleanupParentElementsLanguages)
.map(setEffectiveLanguage)
.map(fallbackMessageForNoLanguageDetected)
.map(mapResults);

if (selectionsWithValidTextAndDetectedLanguageAndEffectiveLanguage.length === 0) {
Expand Down

0 comments on commit f2a77f7

Please sign in to comment.