tc decimal handling
See original GitHub issuevue & vue-i18n version vue 2.6.8 vue-i18n 8.11.2
Steps to reproduce
{{ $tc('daysCounter', days, {count: days}) }}
i18n: {
messages: {
daysCounter: ' 0 jour | {count} jour | {count} jours'
}
}
What is Expected? if days is 0.5 or 1.5 the singular option should be selected and output ‘0.5 jour’ or ‘1.5 jour’
What is the result? vue-i18n displays ‘0 jours | 0.5 jour | 0.5 jours’
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
tc(8) - Linux manual page
Tc is used to configure Traffic Control in the Linux kernel. ... Processing of traffic is controlled by three kinds of objects: qdiscs,...
Read more >Measurement Difference in decimal place in NX12 and ...
In NX12 , we are able to display multiple decimal places. After import to TC, TC only shows 2 decimal place.
Read more >Town Creator - Decimal Game (Place value & Rounding)
An Online game to practice decimal place value and decimal rounding.
Read more >Fanuc Series Oi-TC - numbers displayed after decimal place
ANYWAY, "we" were finally able to change the parameter to set the control to a 4-place decimal display. I actually gave the info...
Read more >Set variables' output format
%-tC. %-td date. %-td etc. There are many variations allowed. ... set dp sets the symbol that Stata uses to represent the decimal...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think
$tc
should warn if it received a non-int value (float, string, array or whatever). Warning like$tc's second argument should be int but ... given. If you want to pass non-int number to the chosen message, consider $tc(messageKey, round(f), {count: f})
so that we can avoid confusing like this situation.I think we can add
int
-ness check and warning around inside the below https://github.com/kazupon/vue-i18n/blob/6ffc60190d4d7910964186fd3904b77fd422a399/src/index.js#L517-L525This is because
$tc
’s second argument is supposed to be a index to choose message fromcase of 0 | 1 | 2 and more
, so it must beint
right now.I think you may get expcted result if you
round
orceil
before passingdays
to$tc
I made an example of that: http://jsfiddle.net/5mxgauwf/1/