Skip to content

Translate whole file while using replacements #41917

@lenssoft

Description

@lenssoft
  • Laravel Version: 8.83.7
  • PHP Version: 7.4.28
  • Database Driver & Version: mysql 8

Description:

Translator throws warning when trying to translate a whole translation file containing array keys and using replace keys feature.

Last known to work with v8.61.0

Steps To Reproduce:

trans('validation', ['key' => 'to_replace'], 'en')

outcome:
PHP Warning: strtr() expects parameter 1 to be string, array given in /app/vendor/laravel/framework/src/Illuminate/Translation/Translator.php on line 226

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions