laminas / laminas-i18n

Provide translations for your application, and filter and validate internationalized values
https://docs.laminas.dev/laminas-i18n/
BSD 3-Clause "New" or "Revised" License
46 stars 27 forks source link

Add the possibility to set the minimum number of decimals in the numb… #113

Open MatthiasKuehneEllerhold opened 10 months ago

MatthiasKuehneEllerhold commented 10 months ago
Q A
Documentation no
Bugfix no
BC Break no
New Feature yes
RFC yes
QA no

Description

We have some user provided numbers that may have zero to endless decimals. We want to display them in the user locale exactly as provided.

If the user inputs "1", we want to display "1". If the user inputs "0,5432" (german notation!) we want to display "0,5432".

Sadly with the current (2.24.1) View-Helper we have to know beforehand how many decimals the user has used.

The underlying NumberFormatter-Class can do this: by setting min-decimals to zero and max-decimals to PHP_INT_MAX (or some large arbitrary number). The view-helper does not allow to set these 2 options separatly (yet). Thats what I added.

According to the github-template I should target the "develop" branch. Sadly no branch named "develop" can be found in this repository, so I've targeted the branch of the currently active minor version. Please advice if this was the right approach.

Some commits are optional: adding type hint to variables and classes and may be discard if undesired.

MatthiasKuehneEllerhold commented 10 months ago

Added Unit-Tests and fixed CI (hopefully). DCO still says "signoff missing" although all commits are signed by my GPG key. What did I do wrong? Additionally: Im not sure on how to fix the remaining psalm errors. Any hint please?

MatthiasKuehneEllerhold commented 10 months ago

I could add another PR with all the type hint changes, this time targeting a more recent branch - if you like. All it would take is a git revert of ae1da38 (and possibly some more work in the other files ;-) ).