simplesquid / nova-enum-field

An enum field and filters for Laravel Nova.
MIT License
52 stars 26 forks source link

Is there any way to translate enumeration in field #35

Closed SirMishaa closed 3 years ago

SirMishaa commented 3 years ago

Hello!

I'm making a dashboard for French administrator, but for the relevance of the code, I obviously always use English. The problem is that I don't see how to translate this, I haven't found any method to customize this on the field

image

My enum is declared like that :

<?php

namespace App\Enum;

use BenSampo\Enum\Enum;

final class StateType extends Enum
{
    const InStock = "in_stock";
    const OutStock = "out_stock";
    const DataNotAvailable = "data_not_available";
}

I would like to keep enum in English. Only the state in the select should be translated if possible.

mdpoulter commented 3 years ago

Hi @SirMishaa. Thanks for your question 😄

Would the LocalizedEnum interface available in BenSampo/laravel-enum perhaps work for this? I haven't tested it myself, but I can't see why it wouldn't work.