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

New providers API #357

Merged
merged 16 commits into from
Dec 11, 2023
Merged

New providers API #357

merged 16 commits into from
Dec 11, 2023

Conversation

rafaelmardojai
Copy link
Member

No description provided.

We want Provider.features to always be iterable, so let's add a new
flag to represent None
Adds a try block when dynamically importing the providers python
modules.

In the future we might want to include optional providers that only
work when some dependency is met, for example some offline providers
could not satisfy its deps in a arm machine.

In the future we probably will want to expose failing providers in the
UI.
helper functions

Update bing and google provider to make use of it.
base provider

Also adds the lang_aliases dict prop that providers can overwrite to
define their own mapping to Dialect/CLDR's lang codes making it more
scalable.

We still keep the LANG_ALIASES cosnt in the define module to keep
a well know mapping of lang codes provided by Dialect.
dialect/window.py Outdated Show resolved Hide resolved
This method will probaly come handy in scenarios like DeepL where
"en" lang can't be translated to "en-US" nor "en-GB", so extra logic
for comparison can be added by the provider.
@rafaelmardojai rafaelmardojai marked this pull request as ready for review November 20, 2023 17:39
@rafaelmardojai
Copy link
Member Author

New providers API is done I think, it's really flexible and extendable in the future.

@mufeedali
Copy link
Member

I've committed fixes for the two issues I did find. Code looks great! As this is a pretty huge change, we may still need more testing as it stays in main. Especially maybe the search provider, which I can't test right now as I'm on Plasma.

@mufeedali mufeedali merged commit bde2562 into main Dec 11, 2023
2 checks passed
@mufeedali mufeedali deleted the new-providers-api branch December 11, 2023 16:35
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

Successfully merging this pull request may close these issues.

None yet

2 participants