Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make flexibler for other languages #6

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions anki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ function anki()
. kindleVoc.sh "${db}"
echo "Which words do you want to select?"
MODE=$(askMode)
BOOKLANG="en"
BOOKLANG="${dictLang}"
else
. kobo/koboVoc.sh "${db}" "${kMount}"
MODE="fr"
MODE="${dictLang}"
BOOKLANG="${MODE}"
fi

Expand Down
4 changes: 2 additions & 2 deletions learn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function ask()
case $OPERATION in
"ask leo")
echo "asking leo for meaning of: ${STEM}"
search ${STEM}
search ${STEM} ${dictLang}
;;
"ask oxford")
echo "asking oxford for meaning of: $STEM"
Expand Down Expand Up @@ -58,7 +58,7 @@ function main()
MODE=$(askMode)
else
. kobo/koboVoc.sh "${db}" "${kMount}"
MODE="en"
MODE="${dictLang}"
fi

WORD_RAW=$(selectWords $MODE)
Expand Down
4 changes: 2 additions & 2 deletions leoDict.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function search()
CACHE_QUERY="SELECT response FROM query_cache c WHERE c.word=='${WORD}'"
RESPONSE=$(sqlite3 "$LEODB" "$CACHE_QUERY")
if [[ $RESPONSE != *"matches for"* ]]; then
WORD_ENCODED=$(urlEncode "$WORD")
RESPONSE=$(leo -l ${BOOKLANG}2de -n ${WORD_ENCODED} | sed -e 's|[\”\“]|\"|g' | iconv -f ISO-8859-1 -t utf-8 )
#WORD_ENCODED=$(urlEncode "$WORD")
RESPONSE=$(leo -l ${BOOKLANG}2de -n "${WORD}" | sed -e 's|[\”\“]|\"|g' | iconv -f ISO-8859-1 -t utf-8 )
if [[ $RESPONSE == *"matches for"* ]]; then
WRITE_QUERY="INSERT INTO QUERY_CACHE (word,response) VALUES ('${WORD}',\"${RESPONSE}\");"
sqlite3 "$LEODB" "$WRITE_QUERY"
Expand Down
5 changes: 4 additions & 1 deletion settings.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ kMount=sample
# a place where your sqlite db can accessed
# for kobo this could be: $kMount/.kobo/KoboReader.sqlite
# for kindle this could be: [kMount]/system/vocabulary/vocab.db
db=kobo/sample/KoboReader.sqlite
db=kobo/sample/KoboReader.sqlite

# the dictionary language
dictLang=en
Loading