Skip to content
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

More consistent namespace for UriLocalizer. #39

Closed
cirdog opened this issue Apr 21, 2016 · 1 comment
Closed

More consistent namespace for UriLocalizer. #39

cirdog opened this issue Apr 21, 2016 · 1 comment

Comments

@cirdog
Copy link

cirdog commented Apr 21, 2016

Only the UriLocalizer is not following the package's naming convention. I propose to change it to "translation.uri.localizer", and the respective Facade can handle the Name->Instance-Name translation.

public function register()
{
    $this->mergeConfigFrom(__DIR__ . '/../config/translator.php', 'translator');

    parent::register();
    $this->registerCacheRepository();
    $this->registerFileLoader();
    $this->registerCacheFlusher();
    $this->app->singleton('translation.uri.localizer', UriLocalizer::class);
    $this->app[\Illuminate\Routing\Router::class]->middleware('localize', TranslationMiddleware::class);
    // Fix issue with laravel prepending the locale to localize resource routes:
    $this->app->bind('Illuminate\Routing\ResourceRegistrar', ResourceRegistrar::class);
}

protected static function getFacadeAccessor()
{
    return 'translation.uri.localizer';
}

With these, the package's namespace would be consistent inside the bootstrap/cache/services.php

'translator' => 'App\\Providers\\TranslationServiceProvider',
'translation.loader' => 'App\\Providers\\TranslationServiceProvider',
'translation.cache.repository' => 'App\\Providers\\TranslationServiceProvider',
'translation.uri.localizer' => 'App\\Providers\\TranslationServiceProvider',

Or whatever name you choose that exhibits a more consistent convention, it'd be great!

sildraug pushed a commit that referenced this issue Jun 2, 2016
@sildraug
Copy link
Contributor

sildraug commented Jun 2, 2016

Done! See v2.1.4.3

@sildraug sildraug closed this as completed Jun 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants