original_string: public function init($language = null)
      {
          if (!$language) {
              $language = $this->in('Please specify language code, e.g. `en`, `eng`, `en_US` etc.');
          }
          if (strlen($language) < 2) {
              $this->abort('Invalid language code. Valid is `en`, `eng`, `en_US` etc.');
          }
  
          $this->_paths = App::path('Locale');
          if ($this->param('plugin')) {
              $plugin = Inflector::camelize($this->param('plugin'));
              $this->_paths = App::path('Locale', $plugin);
          }
  
          $response = $this->in('What folder?', null, rtrim($this->_paths[0], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
          $sourceFolder = rtrim($response, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
          $targetFolder = $sourceFolder . $language . DIRECTORY_SEPARATOR;
          if (!is_dir($targetFolder)) {
              mkdir($targetFolder, 0775, true);
          }
  
          $count = 0;
          $iterator = new DirectoryIterator($sourceFolder);
          foreach ($iterator as $fileinfo) {
              if (!$fileinfo->isFile()) {
                  continue;
              }
              $filename = $fileinfo->getFilename();
              $newFilename = $fileinfo->getBasename('.pot');
              $newFilename .= '.po';
  
              $this->createFile($targetFolder . $newFilename, file_get_contents($sourceFolder . $filename));
              $count++;
          }
  
          $this->out('Generated ' . $count . ' PO files in ' . $targetFolder);
      }
code: public function init($language = null)
      {
          if (!$language) {
              $language = $this->in('Please specify language code, e.g. `en`, `eng`, `en_US` etc.');
          }
          if (strlen($language) < 2) {
              $this->abort('Invalid language code. Valid is `en`, `eng`, `en_US` etc.');
          }
  
          $this->_paths = App::path('Locale');
          if ($this->param('plugin')) {
              $plugin = Inflector::camelize($this->param('plugin'));
              $this->_paths = App::path('Locale', $plugin);
          }
  
          $response = $this->in('What folder?', null, rtrim($this->_paths[0], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
          $sourceFolder = rtrim($response, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
          $targetFolder = $sourceFolder . $language . DIRECTORY_SEPARATOR;
          if (!is_dir($targetFolder)) {
              mkdir($targetFolder, 0775, true);
          }
  
          $count = 0;
          $iterator = new DirectoryIterator($sourceFolder);
          foreach ($iterator as $fileinfo) {
              if (!$fileinfo->isFile()) {
                  continue;
              }
              $filename = $fileinfo->getFilename();
              $newFilename = $fileinfo->getBasename('.pot');
              $newFilename .= '.po';
  
              $this->createFile($targetFolder . $newFilename, file_get_contents($sourceFolder . $filename));
              $count++;
          }
  
          $this->out('Generated ' . $count . ' PO files in ' . $targetFolder);
      }
code_tokens: public function init ( $ language = null ) { if ( ! $ language ) { $ language = $ this -> in ( 'Please specify language code, e.g. `en`, `eng`, `en_US` etc.' ) ; } if ( strlen ( $ language ) < 2 ) { $ this -> abort ( 'Invalid language code. Valid is `en`, `eng`, `en_US` etc.' ) ; } $ this -> _paths = App :: path ( 'Locale' ) ; if ( $ this -> param ( 'plugin' ) ) { $ plugin = Inflector :: camelize ( $ this -> param ( 'plugin' ) ) ; $ this -> _paths = App :: path ( 'Locale' , $ plugin ) ; } $ response = $ this -> in ( 'What folder?' , null , rtrim ( $ this -> _paths [ 0 ] , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ) ; $ sourceFolder = rtrim ( $ response , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; $ targetFolder = $ sourceFolder . $ language . DIRECTORY_SEPARATOR ; if ( ! is_dir ( $ targetFolder ) ) { mkdir ( $ targetFolder , 0775 , true ) ; } $ count = 0 ; $ iterator = new DirectoryIterator ( $ sourceFolder ) ; foreach ( $ iterator as $ fileinfo ) { if ( ! $ fileinfo -> isFile ( ) ) { continue ; } $ filename = $ fileinfo -> getFilename ( ) ; $ newFilename = $ fileinfo -> getBasename ( '.pot' ) ; $ newFilename .= '.po' ; $ this -> createFile ( $ targetFolder . $ newFilename , file_get_contents ( $ sourceFolder . $ filename ) ) ; $ count ++ ; } $ this -> out ( 'Generated ' . $ count . ' PO files in ' . $ targetFolder ) ; }
docstring: Inits PO file from POT file.
  
  @param string|null $language Language code to use.
  @return void
  @throws \Cake\Console\Exception\StopException
docstring_tokens: Inits PO file from POT file .