tirkarthi / NotificationDictionary

An android app to display meaning for selected word as notification
MIT License
143 stars 14 forks source link

Add support for all languages in wikitionary #66

Open ligix opened 6 months ago

ligix commented 6 months ago

Instead of continuing to add more and more ugly if cases and hardcoding the lists of the languages it might be a good idea to make the code generic to allow adding more languages by just changing a simple configuration file.

A few examples of code that needs changing: https://github.com/tirkarthi/NotificationDictionary/blob/d8ac11d193b48c8ef5949436572c4d26fb056302/app/src/main/java/com/xtreak/notificationdictionary/MainActivity.kt#L82-L85 https://github.com/tirkarthi/NotificationDictionary/blob/d8ac11d193b48c8ef5949436572c4d26fb056302/app/src/main/java/com/xtreak/notificationdictionary/MainActivity.kt#L212 https://github.com/tirkarthi/NotificationDictionary/blob/d8ac11d193b48c8ef5949436572c4d26fb056302/app/src/main/java/com/xtreak/notificationdictionary/MainActivity.kt#L224 https://github.com/tirkarthi/NotificationDictionary/blob/d8ac11d193b48c8ef5949436572c4d26fb056302/app/src/main/java/com/xtreak/notificationdictionary/MainActivity.kt#L278-L279

Relevant issues: #39 #49 #55 #56

tirkarthi commented 6 months ago

Agree that the language handling needs refactoring since I remember the places to update which is error prone.

The issue with adding new language is that is it's not easy to parse XML of different languages since they exist in different formats of markup without any standard to parse them. AFAIK, there is no database dump available from Wiktionary and the XML dump has to be parsed per language using Python. Since I am not a native speaker I also need to randomly verify few words to ensure the meaning and parts of speech are correct. This also involves updating CDN which is also a manual process. This makes adding new languages a tiresome process.