【发布时间】:2017-05-07 08:22:20
【问题描述】:
根据 Laravel 文档:https://laravel.com/docs/5.1/localization#overriding-package-language-files
例如,如果您需要为名为 skyrim/hearthfire 的包覆盖messages.php 中的英语行,您可以将语言文件放置在:resources/lang/vendor/hearthfire/en/messages.php。
我目前有我的项目中包含的包 activewebsite/enterprise-entity 包。它包含一个语言文件:
vendor/activewebsite/enterprise-entity/src/resources/lang/en/phone.php
此文件包含电话号码类型的翻译:
'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',
按照上面的示例,我尝试通过创建以下目录来覆盖此文件:
resources/lang/vendor/enterprise-entity/en/phone.php
包含一个特定于该项目的附加电话号码:
'phone_9' => 'Rapid Rewards Text Alert Number',
但是翻译没有通过前端。我能够让翻译出现的唯一方法是编辑企业实体包中的语言文件。
我找到了这个帖子:https://octobercms.com/forum/post/localication-problems-where-to-overwrite-octobercms-lang-settings-in-general 其他用户似乎有类似问题,但建议他们使用目录结构:
/lang/{locale}/{vendor}/{plugin}/lang.php
所以我尝试了
/lang/en/activewebsite/enterprise-entity/phone.php
没有运气。
谁能告诉我这里可能出了什么问题?我尝试在每次更改后运行 php artisan optimize 以查看是否可以解决问题,但没有运气。
谢谢!
【问题讨论】:
-
我在任何地方都找不到你提到的包裹,是不是虚构的包裹?