laravellaravel-localization

How can I overwrite method “__(”?


In laravel using location method __(, like :

$managerAccessText = __('common.As you have manager access');

I got text

common.As you have manager access

in case if this label was not found

How can I overwrite method __( if i want to remove file name like in case above?

"laravel/framework": "^9.19",

Solution

  • You understand that this function is for the international translation of strings according to the current locale of the application.

    Unless you provide specific translation then the string will be output exactly as provided.

    https://laravel.com/docs/9.x/localization#retrieving-translation-strings

    You can include placeholders in the string where values passed to the function will be inserted into the translated string.

    https://laravel.com/docs/9.x/localization#replacing-parameters-in-translation-strings