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

[Enhancement] Provide API to configure behaviors of different backends #1

Open
syeopite opened this issue Aug 15, 2021 · 1 comment
Labels

Comments

@syeopite
Copy link
Owner

syeopite commented Aug 15, 2021

In Lens, each of the backends currently have a slightly different behavior.

For instance, the Gettext family of backends returns the given ID when a translation is not found.

backend = Gettext::MOBackend.new("locales")
catalogue_hash = backend.create()
catalogue = catalogue_hash["en_US"]
catalogue.gettext("I don't exist") # => "I don't exist" 

Whereas the RubyI18n YAML backend would raise an LensExceptions::MissingTranslation

catalogue = RubyI18n::Yaml.new("locales")
catalogue.translate("en", "I  also don't exist") # => LensExceptions::MissingTranslation

Not to mention the fact that Gettext requires creating a catalogue object first while the other doesn't.

This discrepancy is intentional, in order to preserve the behaviors seen in their reference or intended implementations.

However, I do see merit in a potential way to configure these behaviors. It wouldn't change the API differences, but it would help resolve any unintended errors a developer might experience when swapping backends.

@syeopite syeopite changed the title [Enhancement] More uniform behavior between backends. [Enhancement] Provide API to configure behaviors of different backends Sep 14, 2021
@github-actions
Copy link

This issue has been automatically marked as stale and will be closed in 15 days because it has not had recent activity and is much likely outdated. If you think this issue is still relevant and applicable, you just have to post a comment and it will be unmarked.

@github-actions github-actions bot added the stale label Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant