diff --git a/main-src/libs/locales/de/ui.json b/main-src/libs/locales/de/ui.json index 04664eda..dd454a0a 100644 --- a/main-src/libs/locales/de/ui.json +++ b/main-src/libs/locales/de/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "Sprachgeschwindigkeit", "slowest": "Langsamste", "normal": "Normal", - "fastest": "Schnellste" + "fastest": "Schnellste", + "textSize": "Schriftgröße" } diff --git a/main-src/libs/locales/en/ui.json b/main-src/libs/locales/en/ui.json index b968ea3e..ce482a3e 100644 --- a/main-src/libs/locales/en/ui.json +++ b/main-src/libs/locales/en/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "Voice speed", "slowest": "Slowest", "normal": "Normal", - "fastest": "Fastest" + "fastest": "Fastest", + "textSize": "Text size" } diff --git a/main-src/libs/locales/es/ui.json b/main-src/libs/locales/es/ui.json index 0748f3e5..baa3601d 100644 --- a/main-src/libs/locales/es/ui.json +++ b/main-src/libs/locales/es/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "Velocidad de voz", "slowest": "Muy lento", "normal": "Normal", - "fastest": "Lo más rápido" + "fastest": "Lo más rápido", + "textSize": "Tamaño del texto" } diff --git a/main-src/libs/locales/fr/ui.json b/main-src/libs/locales/fr/ui.json index 872ca321..2ac88fcb 100644 --- a/main-src/libs/locales/fr/ui.json +++ b/main-src/libs/locales/fr/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "Vitesse de la voix", "slowest": "Le plus lent", "normal": "Normale", - "fastest": "Le plus rapide" + "fastest": "Le plus rapide", + "textSize": "Taille du texte" } diff --git a/main-src/libs/locales/it/ui.json b/main-src/libs/locales/it/ui.json index 9fbf2c6a..12b505f6 100644 --- a/main-src/libs/locales/it/ui.json +++ b/main-src/libs/locales/it/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "Velocità vocale", "slowest": "Più lenta", "normal": "Normali", - "fastest": "Più Veloce" + "fastest": "Più Veloce", + "textSize": "Dimensione testo" } diff --git a/main-src/libs/locales/ja/ui.json b/main-src/libs/locales/ja/ui.json index 11cac1a7..b6632685 100644 --- a/main-src/libs/locales/ja/ui.json +++ b/main-src/libs/locales/ja/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "音声スピード", "slowest": "最も低速", "normal": "普通", - "fastest": "最速" + "fastest": "最速", + "textSize": "文字サイズ" } diff --git a/main-src/libs/locales/ko/ui.json b/main-src/libs/locales/ko/ui.json index 937eee94..098d6da5 100644 --- a/main-src/libs/locales/ko/ui.json +++ b/main-src/libs/locales/ko/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "음성 속도", "slowest": "가장 느리게", "normal": "보통", - "fastest": "가장 빠르게" + "fastest": "가장 빠르게", + "textSize": "글자 크기" } diff --git a/main-src/libs/locales/pt-PT/ui.json b/main-src/libs/locales/pt-PT/ui.json index ef7f6370..780400f0 100644 --- a/main-src/libs/locales/pt-PT/ui.json +++ b/main-src/libs/locales/pt-PT/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "Velocidade de voz", "slowest": "Mais lento", "normal": "Normal", - "fastest": "Mais rápida" + "fastest": "Mais rápida", + "textSize": "Tamanho do texto" } diff --git a/main-src/libs/locales/ru/ui.json b/main-src/libs/locales/ru/ui.json index 54d6e6e9..85d500ea 100644 --- a/main-src/libs/locales/ru/ui.json +++ b/main-src/libs/locales/ru/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "Скорость голоса", "slowest": "Медленнейш", "normal": "Норм", - "fastest": "Минимум" + "fastest": "Минимум", + "textSize": "Размер текста" } diff --git a/main-src/libs/locales/tr/ui.json b/main-src/libs/locales/tr/ui.json index 834478f8..0724f381 100644 --- a/main-src/libs/locales/tr/ui.json +++ b/main-src/libs/locales/tr/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "Ses hızı", "slowest": "En yavaş", "normal": "Normal", - "fastest": "En Hızlı" + "fastest": "En Hızlı", + "textSize": "Metin boyutu" } diff --git a/main-src/libs/locales/vi/ui.json b/main-src/libs/locales/vi/ui.json index d56d4e1a..1c3540a9 100644 --- a/main-src/libs/locales/vi/ui.json +++ b/main-src/libs/locales/vi/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "Tốc độ giọng nói", "slowest": "Chậm nhất", "normal": "Bình thường", - "fastest": "Nhanh nhất" + "fastest": "Nhanh nhất", + "textSize": "Cỡ chữ" } diff --git a/main-src/libs/locales/zh-CN/ui.json b/main-src/libs/locales/zh-CN/ui.json index f226ea2a..bef0dace 100644 --- a/main-src/libs/locales/zh-CN/ui.json +++ b/main-src/libs/locales/zh-CN/ui.json @@ -142,5 +142,6 @@ "voiceSpeed": "语音速度", "slowest": "最慢", "normal": "正常", - "fastest": "最快" + "fastest": "最快", + "textSize": "文本尺寸" } diff --git a/main-src/libs/preferences.js b/main-src/libs/preferences.js index 357dd974..0d2b32bc 100644 --- a/main-src/libs/preferences.js +++ b/main-src/libs/preferences.js @@ -56,6 +56,7 @@ const defaultPreferences = { useHardwareAcceleration: true, // 10 => 1x (speed goes from 0.1x to 10x, we multiple by 10 to avoid using decimals) voiceSpeed: 10, + textSize: 1, }; const initCachedPreferences = () => { diff --git a/src/components/pages/home/index.js b/src/components/pages/home/index.js index e892ea27..8e1066ac 100644 --- a/src/components/pages/home/index.js +++ b/src/components/pages/home/index.js @@ -184,6 +184,18 @@ const styles = (theme) => ({ }, }); +const textSizeToVariant = (textSize) => { + switch (textSize) { + case 7: return 'h1'; + case 6: return 'h2'; + case 5: return 'h3'; + case 4: return 'h4'; + case 3: return 'h5'; + case 2: return 'h6'; + default: return 'body1'; + } +}; + const Home = ({ classes, fullscreenInputBox, @@ -206,6 +218,7 @@ const Home = ({ output, outputLang, showTransliteration, + textSize, textToSpeechPlaying, translateWhenPressingEnter, }) => { @@ -307,7 +320,7 @@ const Home = ({ @@ -355,6 +368,7 @@ const Home = ({ onUpdateOutputLang, output, showTransliteration, + textSize, textToSpeechPlaying, ]); @@ -702,6 +716,7 @@ Home.propTypes = { output: PropTypes.object, outputLang: PropTypes.string.isRequired, showTransliteration: PropTypes.bool.isRequired, + textSize: PropTypes.number.isRequired, textToSpeechPlaying: PropTypes.bool.isRequired, translateWhenPressingEnter: PropTypes.bool.isRequired, }; @@ -714,6 +729,7 @@ const mapStateToProps = (state) => ({ output: state.pages.home.output, outputLang: state.preferences.outputLang, showTransliteration: state.preferences.showTransliteration, + textSize: state.preferences.textSize, textToSpeechPlaying: state.pages.home.textToSpeech.textToSpeechPlaying, translateWhenPressingEnter: state.preferences.translateWhenPressingEnter, }); diff --git a/src/components/pages/preferences/list-item-sliders.js b/src/components/pages/preferences/list-item-sliders.js index f7c0f386..db1b1bad 100644 --- a/src/components/pages/preferences/list-item-sliders.js +++ b/src/components/pages/preferences/list-item-sliders.js @@ -47,12 +47,13 @@ const convertPreferenceValToSliderVal = (val) => { const ListItemSliders = ({ classes, voiceSpeed, + textSize, }) => ( - + {getLocale('voiceSpeed')} @@ -91,6 +92,33 @@ const ListItemSliders = ({ /> + + + + {getLocale('textSize')} + + + + { + requestSetPreference('textSize', value); + }} + /> + + ); @@ -98,10 +126,12 @@ const ListItemSliders = ({ ListItemSliders.propTypes = { classes: PropTypes.object.isRequired, voiceSpeed: PropTypes.number.isRequired, + textSize: PropTypes.number.isRequired, }; const mapStateToProps = (state) => ({ voiceSpeed: state.preferences.voiceSpeed, + textSize: state.preferences.textSize, }); export default connectComponent(