Replies: 1 comment
-
We should think of a nice way to use a plural form of the label. First thought is probably adding a new method like public function labelPlural(int $number): string
{
$langKey = ...;
return app('translator')->has($langKey)
? trans_choice($langKey, $number)
: $value->value;
} However if they're using multi choice translation values then then So perhaps instead we should always use As a side note, we should also update the label method so we can pass through replacements. protected function defaultLabelReplacements(): array
{
return match($this) {
self::SOME_CASE => ['item' => 'vehicle', 'color' => 'unknown'],
default => []
};
} |
Beta Was this translation helpful? Give feedback.
-
Right now we use
__($lang_key)
to get the translation of the label.There is no way to use
trans_choice
to get a pluralized version.Beta Was this translation helpful? Give feedback.
All reactions