mercredi 21 décembre 2016

How do I override package language files in Laravel 5.1

According to Laravel Docs: http://ift.tt/2hdzzbr

for example, if you need to override the English language lines in messages.php for a package named skyrim/hearthfire, you would place a language file at: resources/lang/vendor/hearthfire/en/messages.php.

I currently have the package activewebsite/enterprise-entity package that I am including in my project. It contains a language file:

vendor/activewebsite/enterprise-entity/src/resources/lang/en/phone.php

This file contains translations for types of phone numbers:

'phone_1' => 'Home',
'phone_2' => 'Work',
'phone_3' => 'Mobile',
'phone_4' => 'Office',
'phone_5' => 'Fax',
'phone_6' => 'Fax 2',
'phone_7' => 'Home 2',
'phone_8' => 'Direct',

Following the example above, I attempted to override this file by creating the following directory:

resources/lang/vendor/enterprise-entity/en/phone.php 

containing an additional phone number specific to this project:

    'phone_9' => 'Rapid Rewards Text Alert Number',

But the the translation does not come through to the front-end. The only way I've been able to get the translation to appear is to edit the language file within the enterprise-entity package.

I found this thread: http://ift.tt/2hs8kX2 Where another user seems to be having a similar issue, but it is suggested that they use the directory structure:

/lang/{locale}/{vendor}/{plugin}/lang.php

so I attempted

/lang/en/activewebsite/enterprise-entity/phone.php

with no luck.

Can anyone tell me what I may be getting wrong here? I've attempted running a php artisan optimize after each change to see if that could clear things up, but no luck.

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire