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

Qute: Template attributes in template extensions #15718

Closed
andlinger opened this issue Mar 15, 2021 · 1 comment · Fixed by #15772
Closed

Qute: Template attributes in template extensions #15718

andlinger opened this issue Mar 15, 2021 · 1 comment · Fixed by #15772
Assignees
Labels
area/qute The template engine kind/enhancement New feature or request
Milestone

Comments

@andlinger
Copy link
Contributor

andlinger commented Mar 15, 2021

I would like to implement a template extension method to properly format a MonetaryAmount parameter. Here it would be great if I could use the locale attribute of the TemplateInstance, which I already use for the MessageBundles anyway.

It would be great if you could inject the specific value via an annotation.

@TemplateExtension
public class TemplateExtensions {

    public static String formatMoney(MonetaryAmount price, @TemplateAttribute("locale") Locale locale) {
        var formatter = MonetaryFormats.getAmountFormat(AmountFormatQuery.of(locale));
        return formatter.format(price);
    }
}
@andlinger andlinger added the kind/enhancement New feature or request label Mar 15, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 15, 2021

/cc @mkouba

@quarkus-bot quarkus-bot bot added the area/qute The template engine label Mar 15, 2021
@mkouba mkouba self-assigned this Mar 15, 2021
mkouba added a commit to mkouba/quarkus that referenced this issue Mar 16, 2021
mkouba added a commit to mkouba/quarkus that referenced this issue Mar 16, 2021
mkouba added a commit to mkouba/quarkus that referenced this issue Mar 16, 2021
@quarkus-bot quarkus-bot bot added this to the 1.13 - main milestone Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/qute The template engine kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants