phibr0 / obsidian-dictionary

Dictionary - Obsidian Plugin | This plugin adds a multilingual dictionary to the Obsidian note taking tool.
GNU Affero General Public License v3.0
360 stars 45 forks source link

2.15.0: Russian & Portuguese doesn’t seem to work at all #42

Open Moonbase59 opened 3 years ago

Moonbase59 commented 3 years ago

Russian apparently uses the Free Dictionary API but has no synonym provider.

It doesn’t seem to work at all (not even an error message), try words like

Москва
Ру́сский
русский
словарь
язык

Same for Portuguese, word list I tried:

língua
dicionário
brasileiro
brasileira
phibr0 commented 3 years ago

A Synonym Provider is not needed, the Synonym Popover won't work but the Sidebar lookup still should. Let me investigate

phibr0 commented 3 years ago

I think i already found the Error. These russian letters need to be urlencoded like so: https://api.dictionaryapi.dev/api/v2/entries/ru/%D0%91%D0%BE%D0%BB%D1%8C%D1%88%D0%BE%D0%B9

phibr0 commented 3 years ago

Could you please try again with the newest Version?

Moonbase59 commented 3 years ago

Yeah, thanks!

In the meantime, list of languages I could use:

de
en-US
en-GB
es
fr
it
ko
tr

Languages that didn’t work:

hi
ja
ru
pt-BR
ar
zh
phibr0 commented 3 years ago

These are all Languages with "non standard" letters right?

Moonbase59 commented 3 years ago

Still not functioning (2.15.1):

These are the ones that worked:

-Dictionary TOC (2021-08-16) - Knowledgebase - Obsidian 0 12 12_140

Moonbase59 commented 3 years ago

These are all Languages with "non standard" letters right?

I’d say "standard" lol, because Unicode. But yes, non-latin script, and odd word separators. Plus, with Arabic, a right-to-left language.

phibr0 commented 3 years ago

Yeah but they seem to get encoded differently in a URL

These russian letters need to be urlencoded like so: https://api.dictionaryapi.dev/api/v2/entries/ru/%D0%91%D0%BE%D0%BB%D1%8C%D1%88%D0%BE%D0%B9

phibr0 commented 3 years ago

Or atleast this API is doing it

Moonbase59 commented 3 years ago

Would probably not hurt always using encodeURIComponent() on the search phrases.

phibr0 commented 3 years ago

Did that in 2.15.1, need to investigate some more tomorrow for the other languages

Moonbase59 commented 3 years ago

Btw, do we have an offline dictionary for Chinese? When selecting Chinese, it always switches to the Offline Dictionary …

Thanks for keeping on the track!

phibr0 commented 3 years ago

Yes, the offline Dictionary works in english and chinese

Moonbase59 commented 3 years ago

But there’s no online directory for Chinese?

phibr0 commented 3 years ago

Just to be sure, hindi works in 2.15.1?

phibr0 commented 3 years ago

But there’s no online directory?

No, just the offline Dictionary for now.

Moonbase59 commented 3 years ago

Just to be sure, hindi works in 2.15.1?

Hm. It worked before (see screenshot), and if I look something up, it shows it in the pane, but now it won’t create a file anymore?!

Try the word for "yes" → हाँ

Odd. The word for "dictionary" it writes a note for → शब्दकोश

phibr0 commented 3 years ago

Any Console Errors?

Moonbase59 commented 3 years ago

Here you go, had to clean all the old errors first ;-)

app.js:1 Obsidian Developer Console
main.ts:27 loading markdown-table-editor plugin
main.ts:40 Dataview: Version 0.4.x Loaded
main.ts:77 DiceRoller plugin loaded
main.ts:49 loading Find unlinked files and unresolved links plugin
main.ts:40 loading Hotkeys for templates plugin v1.4.2
main.ts:10 Loading Hotkeys++ plugin
main.ts:125 loading plugin
VM122:2 Loading Obsidian Leaflet v3.24.10
main.ts:55 loading plugin
main.ts:17 Sortable: loading plugin...
main.ts:25 Sortable: loaded plugin.
main.ts:17 Loading snippets plugin
main.ts:27 Loading Pandoc plugin
main.ts:31 Loading status bar pomodoro timer
VM147:4684 loading dictionary
VM148:10348 [Longform] Starting Longform 1.0.3…
main.ts:20 loading open-note-to-window-title plugin
index.ts:356 Dataview: Parsed all file prefixes (0.001s)
main.ts:148 Hotkeys for templates -> active plugins: templater-obsidian,core
VM148:10529 [Longform] Loaded and watching projects.
index.ts:409 Dataview: Initialized CSV row cache (loading 5 CSV files).
index.ts:247 Dataview: Task & metadata parsing queued in 0.001s.
DevTools failed to load SourceMap: Could not parse content for app://obsidian.md/main.js.map: Unexpected end of JSON input
VM147:4543 Uncaught (in promise) TypeError: Cannot read property 'split' of undefined
    at LocalDictionaryBuilder.cap (eval at <anonymous> (app.js:1), <anonymous>:4543:30)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:4560:43)
    at Array.forEach (<anonymous>)
    at LocalDictionaryBuilder.eval (eval at <anonymous> (app.js:1), <anonymous>:4559:30)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:31:71)
    at new Promise (<anonymous>)
    at __awaiter (eval at <anonymous> (app.js:1), <anonymous>:27:12)
    at LocalDictionaryBuilder.newNote (eval at <anonymous> (app.js:1), <anonymous>:4549:16)
    at Array.click_handler (eval at <anonymous> (app.js:1), <anonymous>:3091:60)
cap @ VM147:4543
eval @ VM147:4560
eval @ VM147:4559
eval @ VM147:31
__awaiter @ VM147:27
newNote @ VM147:4549
click_handler @ VM147:3091
click_handler @ VM147:2615
async function (async)
click_handler @ VM147:3091
click_handler @ VM147:2615

Happens the moment I click "new note" (with the word हाँ on screen)

Moonbase59 commented 3 years ago

What are you splitting? Remember we have a lot of languages that don’t have a word separator.

"//This really needs a refactor" :rofl:

phibr0 commented 3 years ago

I think I was splitting the word to capitalize it correctly, but that doesnt make any sense when you just enter one word, might remove it which should fix these errors

Moonbase59 commented 3 years ago

Wonder why string was undef, though.

phibr0 commented 3 years ago

The undefined Strings should be fixed now

phibr0 commented 3 years ago

Japanese is also working: ありがとう image

phibr0 commented 3 years ago

Btw, do we have an offline dictionary for Chinese? When selecting Chinese, it always switches to the Offline Dictionary …

Well not really, its basically an English to Chinese Dictionary..

image

What still needs to be investigated:

phibr0 commented 3 years ago

I found why all these Issues just started to happen..

https://github.com/meetDeveloper/freeDictionaryAPI/commit/e1a9c6c2245b5684f9503ff6d6f51e2ac6dfeae1

Removed references to language other than english. API will soon start to use wiktionary as its source for defintion and currently it provides good support for English only.

phibr0 commented 3 years ago

See #43

Moonbase59 commented 3 years ago

Sad. Just now when you got so far … Confirm undef not giving errors anymore in 2.15.2, Hindi "yes" note created.

meetDeveloper commented 3 years ago

@phibr0 @Moonbase59 As I have not changed any code in Dictionary API so I do not think that this bug is caused due to any recent changes from my side. As I said on other ticket, I will keep non english languages also up but have removed it from the website and github to avoid new users to use API for non english words. Adding wiktionary support for other languages will take some time as I am sole developer of Free Dictionary API but will keep them up.

phibr0 commented 3 years ago

Yeah already investigating, the API works, just not in Obsidian. Thank you so much!

phibr0 commented 3 years ago

Russian is working again! (Tested with: Привет)

Moonbase59 commented 3 years ago

Hm. Don’t work here. Your word didn’t show anything, my list words above show "No Definitions Found". Using v2.15.5.

Viniuau commented 3 years ago

Portuguese always returns "No Definitions Found", even when using previously searched words. Version 2.15.5.

Viniuau commented 3 years ago

Russian is working again, but the issue still persists when using Brazilian Portuguese. image Version 2.16.3