Skip to content

Commit

Permalink
Fixed listing unsupported languages as known languages for Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Jan 21, 2020
1 parent 5f8ee69 commit b1d635f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions spellcheck/platform/win/spellcheck_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,12 @@ class WindowsSpellChecker {
bool isLanguageSupported(const LPCWSTR& lang);
void createSpellCheckers();

std::vector<QString> _systemLanguages;
ComPtr<ISpellCheckerFactory> _spellcheckerFactory;
std::map<QString, ComPtr<ISpellChecker>> _spellcheckerMap;

};

WindowsSpellChecker::WindowsSpellChecker() {
_systemLanguages = SystemLanguages();
createFactory();
createSpellCheckers();
}
Expand All @@ -87,7 +85,7 @@ void WindowsSpellChecker::createSpellCheckers() {
if (!_spellcheckerFactory) {
return;
}
for (const auto &lang : _systemLanguages) {
for (const auto &lang : SystemLanguages()) {
const auto wlang = Q2WString(lang);
if (!isLanguageSupported(wlang)) {
continue;
Expand Down Expand Up @@ -253,7 +251,12 @@ void WindowsSpellChecker::ignoreWord(LPCWSTR word) {
}

std::vector<QString> WindowsSpellChecker::systemLanguages() {
return _systemLanguages;
std::vector<QString> langs;
ranges::transform(
_spellcheckerMap,
ranges::back_inserter(langs),
[](const auto &pair) { return pair.first; });
return langs;
}

////// End of WindowsSpellChecker class.
Expand Down

0 comments on commit b1d635f

Please sign in to comment.