-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Language in packages #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Have u tried trans('packagename::file.key'); |
when i used lang() : the language file: 'ago', 'periods' => array('seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years', 'decades', 'century'), ); i can use trans('oly::date.periods.1') to "seconds" but i cannot access to 'ago' with trans('oly::date.ago') |
I was having this (or a similar) problem last night but couldn't figure out how to fix it. Basically when you're in a namespace you define, PHP tries to find the Lang/Config/etc. facades within that namespace. Even if you try to call it using \Lang, \Config, etc. (global namespace), it fails. |
I can't recreate this. Would be helpful to paste your service provider, package directory structure, etc. |
I,m adding "psr-0": { "": "vendor/oly/src/" } for loading package <?php
namespace Oly\Providers;
use Illuminate\Support\ServiceProvider,
Illuminate\Support\Facades\Config,
Illuminate\Support\Facades\Validator,
Oly\Settings\Repository;
class OlyCoreServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot() {
$this->package('oly/oly');
$Settings = new Repository($this->app['env'], Config::get('oly::settings.table'));
$Date = new \Oly\Date\Repository;
$this->app->instance('Settings', $Settings);
$this->app->instance('Date', $Date);
Validator::resolver(function($translator, $data, $rules) {
return new \Oly\Validator\Validator($translator, $data, $rules);
});
include __DIR__ . '/../router.php';
include __DIR__ . '/../Helpers/helpers.php';
}
/**
* Register the service provider.
*
* @return void
*/
public function register() {
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides() {
return array();
}
} and the package directory structure |
It may be because you have created a new "Provider" namespace. Move it back into the directory above that. |
tanks I do this but the problem was not solved |
@sajjad-ser I think your issue is related to this #43 |
@sajjad-ser Have you solved? |
Add simple app version setup (on docker build) - Fixes laravel#283
Language in packages are loading but not work
The text was updated successfully, but these errors were encountered: