Skip to content

Interference character | (Straight line) In trans_choice function #53289

@MohammadZarifiyan

Description

@MohammadZarifiyan

Laravel Version

11.29

PHP Version

8.1

Database Driver & Version

No response

Description

When I use trans_choice and use straight line symbol (|) in the parameters, it causes the sentence structure to be messed up. It seems that Laravel first places the parameters in the sentences and then selects the sentence based on the number parameter in trans_choice. While the correct way is to first select the correct sentence in terms of number, then replace the parameters.

Steps To Reproduce

home.php file:

return [
   'greeting' => '{0} Hello :name|[1,*] Hello :name, you have :count unread messages'
];

Usage:

trans_choice('home.greeting', 0, ['name' => 'Alex | Moi']);

Above code must result in Hello Alex | Moi, But it results to Hello Alex.

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