Search code examples
phplaravellaravel-5laravel-localization

localization image laravel 5


what code should I write for localization in laravel 5 for an image?

The following code I used to string

ENGLISH lang

       <?php
   return [
      'namaSaya' => 'MY NAME',
      'registrasi' => ' REGISTRASION'      
   ];

INDONESIA lang

       <?php 
return [
      'namaSaya' => 'NAMA SAYA',
      'registrasi' => ' REGISTRASI'      
   ];

and the code that I use to display

{{ trans('content.namaSaya') }}

any idea?


Solution

  • Try just like this:

    <?php 
    return [
      'namaSaya' => 'NAMA SAYA',
      'registrasi' => ' REGISTRASI',
      'sampleImg' => url('to/img_in_certain_lang.jpg')
    ];
    

    and then just:

    <img src="@lang('content.sampleImg')" />