Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Translation] Default parametersΒ #48182

Closed
@sylfabre

Description

@sylfabre

Description

Hello

First of all, thank you for this amazing framework πŸ™

When using translation strings with params in large applications, we keep injecting the same params:

  • a user's name, first, or last name
  • a brand name
  • an application name
  • a customer's name
  • ...

And it's pretty difficult to enforce a strict naming convention.
For instance, we can have these variations about a user's name:

  • user_name
  • username
  • userName
  • name

It would be nice to have a way to define a set of common params that don't need to be injected every time the trans() method is invoked within PHP code or a Twig template.

Thanks!

Example

setDefaultParams([ 'first_name' => 'Sylvain', 'company' => 'AssoConnect', ]); // hello: 'Hello {first_name}, you work at {company} $translor->trans('hello'); // Hello Sylvain, you work at AssoConnect

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions