<?php

namespace App\Providers;

use App\Supports\TranslationLoader;
use Illuminate\Translation\FileLoader;
use Illuminate\Translation\TranslationServiceProvider as ServiceProvider;

class TranslationServiceProvider extends ServiceProvider
{
    protected function registerLoader()
    {
        if (alreadyInstalled()) {
            $this->app->singleton('translation.loader', function ($app) {
                return new TranslationLoader($app['files'], $app['path.lang']);
            });
        }else {
            $this->app->singleton('translation.loader', function ($app) {
                return new FileLoader($app['files'], $app['path.lang']);
            });
        }
    }
}
