Giter Club home page Giter Club logo

Comments (5)

danharrin avatar danharrin commented on May 26, 2024

Actions generate their labels from the name of the action. For actions like CreateAction, we define a label in setUp() that is localised for convenience. By setting that to null, you are removing it.

Changing it would be a breaking change for people who want to remove the localised label. And also, in my opinion the current behaviour is expected and I would not change it even in a major version.

from filament.

RalphMRivera avatar RalphMRivera commented on May 26, 2024

@danharrin - Understood. Thank you for the explanation. That was helpful and clarified things for me. Is there a way to localize an action button without a model label so that instead of "Create book" (English) or "Crear book" (Spanish), I get "Create" and "Crear" without having to use a custom label() and lean on the existing Filament language files?

from filament.

danharrin avatar danharrin commented on May 26, 2024

Have a look at the existing translation string we use, and pass an empty string as the model label?

from filament.

RalphMRivera avatar RalphMRivera commented on May 26, 2024

@danharrin - This is the solution that I have used:

CreateAction::make()
->label(fn (): string => __('filament-actions::create.single.label', ['label' => null]));

This results in "New" in English and "Crear" in Spanish.

I yanked that from here. I was worried that was a bad practice which is why I was looking for an alternative.

Thank you again for all your hard work. You've made my team's job easier.

from filament.

danharrin avatar danharrin commented on May 26, 2024

Yeah that looks good to me

from filament.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.