Skip to content

Commit

Permalink
Disable Free Dictionary API for languages other than english
Browse files Browse the repository at this point in the history
  • Loading branch information
phibr0 committed Feb 25, 2022
1 parent b190545 commit 9ddbafb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-dictionary-plugin",
"name": "Dictionary",
"version": "2.19.0",
"version": "2.19.1",
"minAppVersion": "0.12.11",
"description": "This is a simple dictionary for the Obsidian Note-Taking Tool.",
"author": "phibr0",
Expand Down
22 changes: 11 additions & 11 deletions src/integrations/freeDictionaryAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ abstract class Base {
export class FreeDictionaryDefinitionProvider extends Base implements DefinitionProvider {
public supportedLanguages: string[] = [
"en_US",
"hi",
"es",
"fr",
"ja",
"ru",
// "hi",
// "es",
// "fr",
// "ja",
// "ru",
"en_GB",
"de",
"it",
"ko",
"pt_BR",
"ar",
"tr",
// "de",
// "it",
// "ko",
// "pt_BR",
// "ar",
// "tr",
];

/**
Expand Down
5 changes: 5 additions & 0 deletions src/integrations/openThesaurusAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export class OpenThesaurusSynonymAPI implements SynonymProvider {
}

const response = await JSON.parse(result);

if(!response.synsets){
return Promise.reject("Word doesnt exist in this Dictionary");
}

if (response.synsets.length <= 0) {
return Promise.reject("No Synonym found");
}
Expand Down

0 comments on commit 9ddbafb

Please sign in to comment.