adamclark64 / cerebro-wiki

Use Wikipedia in Cerebro
2 stars 3 forks source link

Change the search language #3

Closed ManuelPimienta closed 6 years ago

ManuelPimienta commented 6 years ago

Thank you very much for the plugin. Will it be possible to change the search language of wikipedia, for example to search for a result in Spanish?

I'm using Cerebro v0.3.2 on Windows 10

adamclark64 commented 6 years ago

on line 11 I have language hard coded to 'en'. https: //es.wikipedia.org/w/index.php?search=pizza&title=Especial:Buscar&go=Ir https: //www.wikipedia.org/search-redirect.php?family=wikipedia&language=en&search=' + q + '&language=en&go=Go are the two search urls which are quite different (btw I have a typo and duplicated language=en on my url). The issue I see is A: The difference in the urls and B: If we introduce spanish, We should introduce any of the language options Wikipedia has and finally C: The figuring out if the user wants a spanish response or an english.

A & B will require a decent refactor to make the code dynamic for any language search. C seems like it would only work if the user added an extra flag to the search input like --lang=es. That seems like a goofy user experience as opposed to making a seperate spanish-cerbro-wiki plugin and having a respective plugin for each different language. I am happy to discuss and do a refactor but I would want to have a better feeling about C and how users would designate a language choice. Happy for feedback

adamclark64 commented 6 years ago

closing this. if you want to come back you can open it back up