Skip to content

Commit

Permalink
Merge branch 'feature/improve-demo' into develop
Browse files Browse the repository at this point in the history
* feature/improve-demo:
  Fix eslint warnings and errors
  Run eslint for jsx files
  Make all react componentes pure
  Fix positional translation arguments
  Detect language from the selected element, not the selected element's parent element
  Improve the demo page
  Add a welcome tab to the demo page
  Add per-language links to wikipedia
  Simplify shared import paths in shared code
  Improve the demo page
  Unregister broadcast listeners when window unloads
  Add bidirectional (left-to-right, right-to-left) information to the currently supported locales
  • Loading branch information
joelpurra committed Dec 9, 2017
2 parents 3227dd3 + cfa3f9c commit ad55d59
Show file tree
Hide file tree
Showing 188 changed files with 4,643 additions and 1,083 deletions.
3 changes: 0 additions & 3 deletions .eslintrc
@@ -1,16 +1,13 @@
{
"env": {
"browser": true,
"es6": true
},
"parser": "babel-eslint",
"plugins": [
"compat",
"react"
],
"extends": [
"standard",
"plugin:react/recommended"
],
"globals": {
"browser": false,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -43,7 +43,7 @@
## Usage

1. **Select desired text** on any web page.
1. **Click the Talkie button** in your browser bar ↗︎↗︎↗︎ <img src="resources/icon/free/icon-play/icon-16x16.png" alt="Talkie play button" width="16" height="16" border="0" />
1. **Click the Talkie button** in your browser toolbar ↗︎↗︎↗︎ <img src="resources/icon/free/icon-play/icon-16x16.png" alt="Talkie play button" width="16" height="16" border="0" />


You can also **select the text, then right click on it**, and choose <img src="resources/icon/free/icon-play/icon-16x16.png" alt="Talkie play button" width="16" height="16" border="0" /> Talkie in the menu. This way also works in PDF-files and some *special* types of pages in the browser.
Expand Down
5 changes: 5 additions & 0 deletions _locales/ar/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "ar",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "rtl",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/cs/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "cs",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/da/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "da",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/de/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "de",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/el/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "el",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/en/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "en",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/es/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "es",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/fi/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "fi",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/fr/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "fr",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/he/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "he",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "rtl",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/hi/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "hi",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/hu/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "hu",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/id/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "id",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/it/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "it",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/ja/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "ja",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/ko/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "ko",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/nb/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "nb",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/nl/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "nl",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/pl/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "pl",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/pt/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "pt",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/ro/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "ro",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/ru/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "ru",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/sk/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "sk",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/sv/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "sv",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/th/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "th",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/tr/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "tr",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
5 changes: 5 additions & 0 deletions _locales/zh/manual.json
Expand Up @@ -3,5 +3,10 @@
"description": "Used to check which locale is loaded, as it might be different from @@ui_locale.",
"message": "zh",
"original": "en"
},
"extensionLocaleBidiDirection": {
"description": "Used to get the bidirectional (left-to-right, right-to-left) for the loaded locale, without relying on the browser's @@bidi_dir.",
"message": "ltr",
"original": "ltr"
}
}
9 changes: 5 additions & 4 deletions package.json
Expand Up @@ -5,7 +5,7 @@
"description": "Text-to-speech (TTS) browser extension button.",
"scripts": {
"clean": "rimraf package/ && rimraf dist/ && rimraf web-ext-artifacts/ && rimraf lib/ && rimraf _locales/*/*.json~ _locales/*/messages.json _locales/*/messages.premium.json",
"build": "npm run --silent messages:refresh && npm run --silent build:copy:libs && rollup --config rollup.config.background.js && rollup --config rollup.config.popup.js && rollup --config rollup.config.popup.html.js && rollup --config rollup.config.options.js && rollup --config rollup.config.options.html.js && rollup --config rollup.config.demo.js && rollup --config rollup.config.demo.html.js && rollup --config rollup.config.stay-alive.js && rollup --config rollup.config.extension-translator.js && npm run --silent build:chrome:free && npm run --silent build:webextension:free && npm run --silent build:chrome:premium && npm run --silent build:webextension:premium",
"build": "npm run --silent messages:refresh && npm run --silent languages:refresh && npm run --silent build:copy:libs && rollup --config rollup.config.background.js && rollup --config rollup.config.popup.js && rollup --config rollup.config.popup.html.js && rollup --config rollup.config.options.js && rollup --config rollup.config.options.html.js && rollup --config rollup.config.demo.js && rollup --config rollup.config.demo.html.js && rollup --config rollup.config.stay-alive.js && rollup --config rollup.config.extension-translator.js && npm run --silent build:chrome:free && npm run --silent build:webextension:free && npm run --silent build:chrome:premium && npm run --silent build:webextension:premium",
"build:copy:libs": "mkdirp lib/ && cp node_modules/webextension-polyfill/dist/browser-polyfill.min.js node_modules/webextension-polyfill/dist/browser-polyfill.min.js.map lib/ && npm run --silent build:copy:libs:react:min && npm run --silent build:copy:libs:react:dev",
"build:copy:libs:react:min": "cat node_modules/react/umd/react.production.min.js node_modules/react-redux/dist/react-redux.min.js node_modules/redux/dist/redux.min.js node_modules/prop-types/prop-types.min.js node_modules/react-dom/umd/react-dom.production.min.js node_modules/redux-thunk/dist/redux-thunk.min.js node_modules/redux-persist/dist/redux-persist.min.js > lib/react-libs.min.js",
"build:copy:libs:react:dev": "cat node_modules/react/umd/react.development.js node_modules/react-redux/dist/react-redux.js node_modules/redux/dist/redux.js node_modules/prop-types/prop-types.js node_modules/react-dom/umd/react-dom.development.js node_modules/redux-thunk/dist/redux-thunk.js node_modules/redux-persist/dist/redux-persist.js > lib/react-libs.js",
Expand Down Expand Up @@ -60,8 +60,8 @@
"lint:slow": "npm run --silent web-ext:lint",
"lint:full": "npm run --silent lint:fast && npm run --silent lint:slow",
"lint:copyright": "grep -L 'This file is part of Talkie' $(find src -type f \\( -iname '*.js' -or -iname '*.jsx' -or -iname '*.html' \\)) | sed 's/^/File is missing copyright notice: /'",
"eslint": "eslint ./src",
"eslint:fix": "eslint --fix ./src",
"eslint": "eslint --ext .jsx --ext .js .",
"eslint:fix": "eslint --ext .jsx --ext .js --fix .",
"web-ext:lint": "npm run --silent web-ext:lint:chrome:free && npm run --silent web-ext:lint:webextension:free && npm run --silent web-ext:lint:chrome:premium && npm run --silent web-ext:lint:webextension:premium",
"web-ext:lint:chrome:free": "echo web-ext linting package/chrome/ && web-ext --source-dir=package/chrome/ lint --ignore-files ./resources/style/options.css ./resources/style/shared.css",
"web-ext:lint:chrome:premium": "echo web-ext linting package/chrome-premium/ && web-ext --source-dir=package/chrome-premium/ lint --ignore-files ./resources/style/options.css ./resources/style/shared.css",
Expand All @@ -79,7 +79,8 @@
"messages:refresh": "npm run --silent messages:sort && ./tools/translations/merge.sh && npm run --silent messages:sort && npm run --silent messages:override:refresh",
"messages:sort": "for MESSAGES in $(find ./_locales -name '*.json'); do jq --sort-keys '.' \"$MESSAGES\" > \"${MESSAGES}~\"; mv \"${MESSAGES}~\" \"$MESSAGES\"; done",
"messages:override:refresh": "for MESSAGES in $(find ./_locales \\( -name 'override.json' -or -name 'manual.json' \\)); do jq --slurp --sort-keys '.[0] as $en | .[1] | with_entries(.key as $key | .value |= (.original = $en[$key].message) + if $en[$key].description then { description: $en[$key].description } else {} end + if $en[$key].placeholders then { placeholders: $en[$key].placeholders } else {} end)' \"./_locales/en/messages.json\" \"$MESSAGES\" > \"${MESSAGES}~\"; mv \"${MESSAGES}~\" \"$MESSAGES\"; done",
"messages:count": "for MESSAGES in $(find ./_locales -name 'messages.json'); do jq 'to_entries | .[].key' \"$MESSAGES\"; done | sort | uniq -c"
"messages:count": "for MESSAGES in $(find ./_locales -name 'messages.json'); do jq 'to_entries | .[].key' \"$MESSAGES\"; done | sort | uniq -c",
"languages:refresh": "jq --slurp --sort-keys 'map({ (.extensionLocale.message): { direction: .extensionLocaleBidiDirection.message, sample: .frontend_voicesSampleText.message } }) | add' $(find ./_locales -name 'messages.json') > \"./src/languages/extracted.json~\" && mv \"./src/languages/extracted.json~\" \"./src/languages/extracted.json\" && jq --slurp --sort-keys '{ base: .[0], languages: .[1] } + .[3]' \"./src/languages/base.json\" \"./src/languages/extracted.json\" \"./src/languages/overrides.json\" > \"./src/languages/languages.json~\" && mv \"./src/languages/languages.json~\" \"./src/languages/languages.json\""
},
"repository": {
"type": "git",
Expand Down

0 comments on commit ad55d59

Please sign in to comment.