Portuguese locale: incorrect `milhar` value and misspelled `milissegundo`
While reviewing the Portuguese localization files, I noticed two issues in src/Humanizer/Locales/pt.yml.
1. milhar is mapped to 1,000,000,000
The Portuguese cardinal map currently contains:
mil: 1000
'milhão': 1000000
'milhões': 1000000
milhar: 1000000000However, milhar means one thousand (1,000), not one billion.
Since the words-to-number parser checks the cardinal map directly, parsing "milhar" may return 1_000_000_000 instead of 1_000.
I believe the correct mapping should be:
milhar: 1000It would also be useful to add regression coverage for this behavior.
2. milisegundo should be milissegundo
The duration section currently contains forms such as:
numeric: '1 milisegundo'
words: 'um milisegundo'
default: 'milisegundos'
singular: 'milisegundo'The correct Portuguese spelling is milissegundo, with a double s.
Interestingly, the relativeDate section of the same locale already uses the correct spelling (milissegundo / milissegundos), so the locale is currently inconsistent.
There is also test data that expects milisegundos, so those expectations would need to be updated together with the locale.
Expected changes
- Change
milharfrom1_000_000_000to1_000. - Add regression tests for parsing
milhar. - Change
milisegundo/milisegundostomilissegundo/milissegundos. - Update the related localization tests.
If the maintainers agree that these are valid corrections, I'd be happy to submit a PR with the changes and regression tests.
Source: Humanizr/Humanizer