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

Adds smarter lookup and fallback to I18n#t helper method #411

Open
wants to merge 1 commit into
base: edge
Choose a base branch
from

Conversation

adamcreekroad
Copy link
Contributor

Fixes #410

This adds fallback lookup to the I18n#t helper method available for components. It first checks the full namespace as it did before, but also will then look without the components namespace (if applicable), then lookup just the key provided, and finally return the key titleized if the translation is missing (this mimics the server-side behavior in views).

One thing to add - I had to manually perform the titleize call, because hyper-operation patches String#titleize to return itself with no modification.

@adamcreekroad adamcreekroad requested a review from catmando April 30, 2021 16:59
@adamcreekroad adamcreekroad changed the title Adds smarted lookup and fallback I18n#t helper method Adds smarter lookup and fallback to I18n#t helper method Apr 30, 2021
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.

Hyperstack::I18n#t should also check non-namespaced translation
1 participant