Browse Source

Move lang stubs to stubs/resources/lang directory

tags/1.1.6
Nafies Luthfi 8 years ago
parent
commit
22b3ea3bdb
  1. 12
      src/Generators/LangFileGenerator.php
  2. 0
      src/stubs/resources/lang/en/app.stub
  3. 0
      src/stubs/resources/lang/en/master.stub
  4. 0
      src/stubs/resources/lang/id/app.stub
  5. 0
      src/stubs/resources/lang/id/master.stub

12
src/Generators/LangFileGenerator.php

@ -17,7 +17,7 @@ class LangFileGenerator extends BaseGenerator
$this->createAppLangFile($langPath);
$this->generateFile($langPath.'/'.$this->modelNames['lang_name'].'.php', $this->getContent('lang-'.$locale));
$this->generateFile($langPath.'/'.$this->modelNames['lang_name'].'.php', $this->getContent($locale));
$this->command->info($this->modelNames['lang_name'].' lang files generated.');
}
@ -25,14 +25,14 @@ class LangFileGenerator extends BaseGenerator
/**
* {@inheritDoc}
*/
public function getContent(string $stubName)
public function getContent(string $locale)
{
$langStubPath = __DIR__.'/../stubs/'.$stubName.'.stub';
$langStubPath = __DIR__.'/../stubs/resources/lang/'.$locale.'/master.stub';
if ($this->files->exists($langStubPath)) {
$stub = $this->files->get($langStubPath);
} else {
$stub = $this->files->get(__DIR__.'/../stubs/lang.stub');
$stub = $this->files->get(__DIR__.'/../stubs/resources/lang/en/master.stub');
}
$displayModelName = ucwords(str_replace('_', ' ', snake_case($this->modelNames['model_name'])));
@ -69,12 +69,12 @@ class LangFileGenerator extends BaseGenerator
{
$locale = config('app.locale');
$langStubPath = __DIR__.'/../stubs/lang-app-'.$locale.'.stub';
$langStubPath = __DIR__.'/../stubs/resources/lang/'.$locale.'/app.stub';
if ($this->files->exists($langStubPath)) {
$stub = $this->files->get($langStubPath);
} else {
$stub = $this->files->get(__DIR__.'/../stubs/lang-app.stub');
$stub = $this->files->get(__DIR__.'/../stubs/resources/lang/en/app.stub');
}
return $stub;
}

0
src/stubs/lang-app.stub → src/stubs/resources/lang/en/app.stub

0
src/stubs/lang.stub → src/stubs/resources/lang/en/master.stub

0
src/stubs/lang-app-id.stub → src/stubs/resources/lang/id/app.stub

0
src/stubs/lang-id.stub → src/stubs/resources/lang/id/master.stub

Loading…
Cancel
Save