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

feat: add currency formatter #190

Merged
merged 4 commits into from
Feb 12, 2025
Merged

Conversation

sabify
Copy link
Contributor

@sabify sabify commented Feb 12, 2025

No description provided.

@sabify
Copy link
Contributor Author

sabify commented Feb 12, 2025

One recursion is happening that rustc fails compiling. Trying to identify the place. Please let me know if you've been able to find it.

@@ -49,8 +49,8 @@
"datetime_formatting": "{{ date, datetime }}",
"number_formatting": "{{ num, number }}",
"number_formatting_grouping": "{{ num, number(grouping_strategy: never) }}",
"currency_formatting": "{{ num, currency(country_code: USD) }}",
"currency_formatting_width": "{{ num, currency(width: narrow, country_code: USD) }}",
"currency_formatting": "{{ num, currency(currency_code: FRA) }}",
Copy link
Owner

Choose a reason for hiding this comment

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

ha yes, the old french franc, the currency of the future

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just found out there isn't any FRA in the table!! https://www.iban.com/currency-codes

I should change the tests...

Copy link
Owner

Choose a reason for hiding this comment

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

Oups I saw the message just after merging, if you want to update the test with EUR I'd appreciate it !

@Baptistemontan
Copy link
Owner

Looks really great, thanks a lot! The only thing I would look into is to make tinystr optionnal and only enable it with format_currency feature

@sabify
Copy link
Contributor Author

sabify commented Feb 12, 2025

The only thing I would look into is to make tinystr optionnal and only enable it with format_currency feature

I made it optional in the leptos_i18n crate. Making it optional in other crates needs module branching or using many gated features for structs and implementations in the crates that never been used for other features. Please let me know if you want me to make a separate module for each currency feature usage...

@Baptistemontan
Copy link
Owner

Yes perfect!

@Baptistemontan Baptistemontan merged commit cf350c5 into Baptistemontan:master Feb 12, 2025
29 checks passed
@Baptistemontan
Copy link
Owner

shipped with v0.5.6

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