Skip to content

Commit

Permalink
Add Ancient Greek, sort supported languages by name
Browse files Browse the repository at this point in the history
Close #55
  • Loading branch information
1over137 committed Mar 22, 2024
1 parent a967782 commit dc31601
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Manual

[New manual, most up to date](https://docs.freelanguagetools.org/)
[New manual](https://docs.freelanguagetools.org/)

## Support

Expand Down Expand Up @@ -61,6 +61,13 @@ For debugging purposes, set the environmental variable `VOCABSIEVE_DEBUG` to any

Pull requests are welcome! If you want to implement a significant feature, be sure to first ask by creating an issue so that no effort is wasted on doing the same work twice.

## Status
This is currently beta software. You should not expect it to be completely bug-free, but you may expect that:
- You should not lose data by upgrading to a new release. However, downgrading is not guaranteed to work! When in doubt, back up your data and ask in the chatroom before attempting to downgrade.
- This does not include your settings, which may need to be reset for a new release. This will be indicated on the release notes.
- Using the `master` branch and only upgrading should *usually* not break things, but this is not guaranteed. You are expected to read commit messages to take proper precaution.
- Using feature branches may break things!

## Feedback
You are welcome to report bugs, suggest features/enhancements, or ask for clarifications by opening a GitHub issue.

Expand Down
20 changes: 11 additions & 9 deletions vocabsieve/dictionary.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from operator import gt
from typing import Optional
from bidict import bidict

Expand All @@ -18,12 +19,10 @@

langs_supported = bidict(
dict(zip(gtrans_languages, [langcodes[item] for item in gtrans_languages])))

gdict_languages = [
'en', 'hi', 'es', 'fr', 'ja', 'ru', 'de', 'it', 'ko', 'ar', 'tr', 'pt'
]

pronunciation_sources = ["Forvo (all)", "Forvo (best)"]
langs_supported['grc'] = "Ancient Greek"
# sort by the full name
langs_supported = bidict(
sorted(langs_supported.items(), key=lambda x: x[1]))


def preprocess_clipboard(s: str, lang: str, should_convert_to_uppercase: bool = False) -> str:
Expand All @@ -43,9 +42,12 @@ def preprocess_clipboard(s: str, lang: str, should_convert_to_uppercase: bool =
def getDictsForLang(lang: str, dicts: list):
"Get the list of dictionaries for a given language"
# These are for all the languages
results = ["Wiktionary (English)", "Google Translate"]
results.extend([item['name'] for item in dicts if item['lang'] ==
lang and item['type'] != "freq" and item['type'] != 'audiolib'])
results = []
results.append("Wiktionary (English)")
if lang in gtrans_languages:
results.append("Google Translate")
results.extend([item['name'] for item in dicts
if item['lang'] == lang and item['type'] != "freq" and item['type'] != 'audiolib'])
return results


Expand Down

0 comments on commit dc31601

Please sign in to comment.