Skip to content

Commit

Permalink
fix(dicts): use lower case
Browse files Browse the repository at this point in the history
  • Loading branch information
crimx committed May 28, 2018
1 parent 72f6abe commit f66e99a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/dictionaries/cambridge/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function search (
? 'https://dictionary.cambridge.org/zht/詞典/英語-漢語-繁體/'
: 'https://dictionary.cambridge.org/dictionary/english/'

return fetchDirtyDOM(url + text.replace(/[^A-Za-z0-9]+/g, '-'))
return fetchDirtyDOM(url + text.toLocaleLowerCase().replace(/[^A-Za-z0-9]+/g, '-'))
.then(handleDOM)
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/dictionaries/longman/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function search (
config: AppConfig,
): Promise<LongmanSearchResult> {
const options = config.dicts.all.longman.options
return fetchDirtyDOM('http://www.ldoceonline.com/dictionary/' + text.replace(/[^A-Za-z0-9]+/g, '-'))
return fetchDirtyDOM('http://www.ldoceonline.com/dictionary/' + text.toLocaleLowerCase().replace(/[^A-Za-z0-9]+/g, '-'))
.then(doc => handleDOM(doc, options))
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/dictionaries/macmillan/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function search (
): Promise<MacmillanSearchResult> {
const options = config.dicts.all.macmillan.options

return fetchDirtyDOM('http://www.macmillandictionary.com/dictionary/british/' + text.replace(/[^A-Za-z0-9]+/g, '-'))
return fetchDirtyDOM('http://www.macmillandictionary.com/dictionary/british/' + text.toLocaleLowerCase().replace(/[^A-Za-z0-9]+/g, '-'))
.then(doc => checkResult(doc, options))
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/dictionaries/oald/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function search (
text: string,
config: AppConfig,
): Promise<OALDSearchResult> {
text = text.replace(/[^A-Za-z0-9]+/g, '-')
text = text.toLocaleLowerCase().replace(/[^A-Za-z0-9]+/g, '-')
const options = config.dicts.all.oald.options

return fetchDirtyDOM('https://www.oxfordlearnersdictionaries.com/definition/english/' + text)
Expand Down
2 changes: 1 addition & 1 deletion src/components/dictionaries/websterlearner/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function search (
): Promise<WebsterLearnerSearchResult> {
const options = config.dicts.all.websterlearner.options

return fetchDirtyDOM('http://www.learnersdictionary.com/definition/' + text.replace(/[^A-Za-z0-9]+/g, '-'))
return fetchDirtyDOM('http://www.learnersdictionary.com/definition/' + text.toLocaleLowerCase().replace(/[^A-Za-z0-9]+/g, '-'))
.then(doc => checkResult(doc, options))
}

Expand Down

0 comments on commit f66e99a

Please sign in to comment.