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

Ability to set language for a specific lookup #110

Open
johnmaguire opened this issue May 9, 2021 · 2 comments
Open

Ability to set language for a specific lookup #110

johnmaguire opened this issue May 9, 2021 · 2 comments

Comments

@johnmaguire
Copy link

Hi there, thanks for this library.

I have an IRC bot that fetches content when it sees certain URLs. It would be nice to pull the correct article for a given URL based on its language code in the URL. Currently, this is only possible by setting the language property. This has two downsides: (a) the memoized cache is cleared, (b) you need to make sure the language property is set back afterwards.

If page() took a language parameter, it would be possible to easily toggle it for specific lookups. The cache could either be ignored in these cases, or the cache could be extended to use a per-language dictionary.

@johnmaguire
Copy link
Author

It would also be nice to be able to specify what data is preloaded - for example, I'd like to defer network calls to a thread, and I can do this with preload=True but then when I go to fetch langlinks, another call is made. Since langlinks is also a property and not a function, it's also a bit awkward to defer that call to a thread.

@barrust
Copy link
Owner

barrust commented May 20, 2021

@johnmaguire I think there wouldn't be a reason not to do the language parameter on the page function and allow bypassing the cache. I guess another short term option would be to keep a few instances around for different languages but not sure how that would work in your case.

As for the other comment, I guess that would be possible to let people set the preload items but I'm not sure if that would make it even less likely to be utilized. I'd be happy to look at suggestions on how that could be done.

Unfortunately, I do not have much time to dedicate to making these types of changes myself at the moment but Pull Requests are always welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants