Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Use non english spell check dict when available
Browse files Browse the repository at this point in the history
Fix #1788

Auditors: @aekeus
  • Loading branch information
bbondy committed Jun 1, 2016
1 parent 6296d6a commit 1e054e3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Fixed pinned tabs sometimes duplicating. ([#1508](https://github.com/brave/browser-laptop/issues/1508))
- Fixed Fullscreen mode showing a black bar up top on OS X. ([#1358](https://github.com/brave/browser-laptop/issues/1358))
- Fixed contractions showing up as misspelled for spell check. ([#2015](https://github.com/brave/browser-laptop/issues/2015))
- Fixed non-English spell checking dictionaries. ([#1788](https://github.com/brave/browser-laptop/issues/1788))
- Possibly fixed intermittent problem with copy on OS X. ([#1060](https://github.com/brave/browser-laptop/issues/1060))
- Upgrade to HTTPS Everywhere definitions for 5.1.9. ([#1692](https://github.com/brave/browser-laptop/issues/1692))
- Upgrade to libchromiumcontent 51.0.2704.63. ([#1405](https://github.com/brave/browser-laptop/issues/1405))
Expand Down
9 changes: 7 additions & 2 deletions app/spellCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const app = electron.app
const appStore = require('../js/stores/appStore')
const appActions = require('../js/actions/appActions')
const contractionSet = new Set()
const getSetting = require('../js/settings').getSetting
const settings = require('../js/constants/settings')

let dictionaryLocale

// Stores a reference to the last added immutable words
Expand Down Expand Up @@ -68,13 +71,15 @@ module.exports.init = () => {
contractions.forEach((word) => contractionSet.add(word.replace(/'.*/, '')))

const availableDictionaries = spellchecker.getAvailableDictionaries()
let dict = app.getLocale().replace('-', '_')
let dict = getSetting(settings.LANGUAGE) || app.getLocale().replace('-', '_')
if (availableDictionaries.includes(dict)) {
dictionaryLocale = dict
spellchecker.setDictionary(dict)
} else {
dict = app.getLocale().split('-')[0]
dict = dict.split('-')[0]
if (availableDictionaries.includes(dict)) {
dictionaryLocale = dict
spellchecker.setDictionary(dict)
}
}

Expand Down
2 changes: 1 addition & 1 deletion js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module.exports = {
winBaseUrl: `${winUpdateHost}/multi-channel/releases/CHANNEL/`
},
defaultSettings: {
'general.language': 'en-US',
'general.language': undefined,
'general.startup-mode': 'lastTime',
'general.homepage': 'https://www.brave.com',
'general.show-home-button': false,
Expand Down

1 comment on commit 1e054e3

@aekeus
Copy link
Member

@aekeus aekeus commented on 1e054e3 Jun 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.