vue-i18n
                                
                                 vue-i18n copied to clipboard
                                
                                    vue-i18n copied to clipboard
                            
                            
                            
                        [feature request] Handle booleans like pluralization
Pluralization allows simple shortcut syntax like
{
  car: 'car | cars'
}
Which can be called with
<p>0: {{ $tc('car', 0) }}</p>
<p>1: {{ $tc('car', 1) }}</p>
<p>2: {{ $tc('car', 2) }}</p>
Which produces
0: cars
1: car
2: cars
I would like a similar shorthand for booleans where the first item is true and the second item is false
{
  validity: 'valid | invalid'
}
<p>true: {{ $tc('validity', true) }}</p>
<p>false: {{ $tc('validity', false) }}</p>
true: valid
false: invalid
I think $tc should focus for pluralization purpose. Overloading for boolean complicates $tc in terms of both usage and implementation.
Switching translation by boolean seems to have many use case (e.g. valid/invalid, enabled/disabled, full/vacant). So I think adding new method for boolean , like $tb or something, might be handy.
Is this feature still wanted? I would like to try to submit a PR for this feature issue. It looks useful. This feature would only works with true or false, right? What should be the behavior when null or undefined is passed? Should we support a fallback message (third value option) for that case?
@robinsondotnet I'd definitely still like this feature and can help you with the review if you want.
The basic concept is that it would work for things like (on, off), (yes, no), (valid, invalid), (visible, hidden), etc.
Regarding null, I'd say that null, false, undefined and any other falsey values should yield the "false" value.
Similarly, I would consider the false condition to be the fallback.
my workaround for this situation is
{
  "validity": "invalid | valid"  // false text first
}
t('validity', +isValid + 1) 
the unary + operator turns false to 0 and true to 1. by adding one the result is either 1 or 2