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

Allow implicit locale in component file names #2118

Merged
merged 10 commits into from
Oct 15, 2024

Conversation

chloe-meister
Copy link
Contributor

What are you trying to accomplish?

I'm proposing a fix for Issue#2113.

The refactor of the compiler in v.3.15 changed the way the format is used to define @call_method_name, used in the template to compile to component.

What approach did you choose and why?

Once I had understood what the problem was, I tried to see why it was working in previous versions (<3.15). The method name was not defined in the same way back then, and it didn't use the format at all, only the variant.

From this I assessed that it would be enough to exclude the locale from the format when building the @call_method_name. I created a new method that excludes anything before the . in formats received from the controller, and I use it to define if something needs to be appended to call_.

What might be a bit clumsy is this new format_without_locale method, as it literally takes the format symbol from @this_format, looks for a . character and assumes the format is at the end.

I chose this solution however because it does not modify @this_format, which keeps the locale in if there is any.

docs/CHANGELOG.md Outdated Show resolved Hide resolved
@joelhawksley
Copy link
Member

Thanks for the PR! I should have time to look at this tomorrow and flesh out some edge cases ❤️

@chloe-meister
Copy link
Contributor Author

You're very welcome! Let me know how/if I can help!

Copy link
Member

@joelhawksley joelhawksley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tweaked this a little to keep the changes within Compiler. Thanks for your help in solving this bug! We should probably revisit this change to make a more robust fix, but I'm going to ship what we have here to unblock you ❤️

@joelhawksley joelhawksley merged commit 21b94a7 into ViewComponent:main Oct 15, 2024
19 checks passed
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.

2 participants