Usage
If the buffer mode is =pdf-view-mode=, you have to mark the context manually.
In other modes, It gets context by =sentence-at-point= and =(thing-at-point 'line)=.
=M-x anki-vocabulary=
Pick the vocabulary
It will display the =translation of context(if avaible)= and shows you =vocabulary meanings=
Pick the correct meaning in the context
It will create the card automatically
According to the [[http://ai.youdao.com/DOCSIRMA/html/%E8%87%AA%E7%84%B6%E8%AF%AD%E8%A8%80%E7%BF%BB%E8%AF%91/API%E6%96%87%E6%A1%A3/%E6%96%87%E6%9C%AC%E7%BF%BB%E8%AF%91%E6%9C%8D%E5%8A%A1/%E6%96%87%E6%9C%AC%E7%BF%BB%E8%AF%91%E6%9C%8D%E5%8A%A1-API%E6%96%87%E6%A1%A3.html#section-9][API Documentation]],It will identify Chinese, English, Japanese, Korean, French, Spanish, Portuguese, Russian, Vietnamese, German, Arabic, Indonesian and Italian automatically.
But you can also Specify the original language and target language with following steps.
| The language | code | | Chinese | zh-CHS | | English | en | | Japanese | ja | | Korean | ko | | French | fr | | Spanish | Es | | Portuguese | pt | | Italian | it | | Russian | ru | | Vietnamese | vi | | German | DE | | Arabic | ar | | Indonesian | id | | Afrikaans | af | | Bosnian | bs | | Bulgarian | bg | | Cantonese | make | | Catalan | ca | | Croatian | hr | | Czech | cs | | Danish | da | | Dutch | nl | | Estonian | et | | Fijian | fj | | Finnish | fi | | Greek | el | | Haitian | Creole ht | | Hebrew | he | | Hindi | hi | | White hmong | mwW | | Hungarian | hu | | Swahili | sw | | Klingon | tlh | | Latvian | lv | | Lithuanian | lt | | Malay | ms | | Maltese | mt | | Norwegian | no | | Persian | fa | | Polish | pl | | Queretaro | otq | | Romanian | ro | | Serbian (Cyrillic) | sr-Cyrl | | Serbian (Latin) | sr-Latn | | Slovak | sk | | Slovenian | sl | | Swedish | sv | | Tahitian | ty | | Thai | th | | Tongan | to | | Turkish | tr | | Ukrainian | uk | | Urdu | ur | | Welsh | cy | | Yucatan Maya | yua | | Albanian | sq | | Amharic | am | | Armenian | hy | | azeri | az | | Bengali | bn | | Basque | eu | | Belarusian | be | | Cebu language | ceb | | Corsican | co | | Esperanto | eo | | Filipino | tl | | Frisian | fy | | Galician | gl | | Georgian | ka | | Gujarat | gu | | Hausa | ha | | Hawaiian | haw | | Icelandic | is | | Ibo | ig | | Irish | ga | | Javanese | jw | | Kannada | kn | | Kazakh | kk | | Khmer | km | | Kurdish | ku | | Kirgiz | ky | | Lao | lo | | Latin | la | | Luxembourg | lb | | Macedonian | mk | | Malgash | mg | | Malayalam | ml | | Maori | mi | | Marathi | mr | | Mongolian | mn | | Burmese | my | | Nepali | ne | | Zichewa | ny | | Pashto | ps | | Punjabi | pa | | Samoan | sm | | Scottish Gaelic | gd | | The sesotho language | st | | Shona | sn | | Sindhi | sd | | Sinhala | si | | Somali | so | | The sunda | su | | Tajik | tg | | Tamil | ta | | telugu | Te | | Uzbek | uz | | Xhosa | xh | | Yiddish | yi | | yoruba | yo | | South African zulu | zu | | Automatic identification | auto |
For example, if you want to translate French to English, you can do the following customization:
(setq youdao-dictionary-app-key "xxxxxxxxxxxxxxx") (setq youdao-dictionary-secret-key "yyyyyyyyyyyyyyy") (setq youdao-dictionary-from "fr") (setq youdao-dictionary-to "en") ;;. Bonjour, je m’appelle Geo et je viens de Chine.
[[file:demo1.gif]]
** Using other translation services You can define your own function to fetch the meanings of vocabulary and translation of the context.
The function used to get meanings of vocabulary should accept the vocabulary as the argument and return an alist like
`((expression . ,vocabulary-string) (glossary . ,meanings-of-vocabulary-list) (phonetic . ,phonetic-string))"
The function used to translate the context should accept the context as the only argument and return the translation in a string.
Then set the =anki-vocabulary-word-searcher= to the function that get meanings of vocabulary.
Set the =anki-vocabulary-sentence-translator= to the function that get the translation of context.