filipponik/translate-analyzer

Translating keys analyzer package

v0.0.4 2023-05-26 09:42 UTC

This package is auto-updated.

Last update: 2024-11-26 12:50:43 UTC


README

Installing

composer require filipponik/translate-analyzer --dev

Usage

  1. Use pwd to get needed directory, or use __DIR__ in code.
$ pwd
/home/user/project
  1. Set your directory path, analyze some folder recursively and create language files.
$analyzer = new \Filipponik\TranslateAnalyzer\Analyzer();
$analyzer
    ->setDirectoryPath('/home/user/project')
    // Analyze only .php files
    ->setSuffix('php')
    // Analyze directory ../app
    ->analyze('app')
    // Write to laravel 8- file structure
    ->toLaravel8AndBefore(['en', 'es', 'ch'])
    // Write to laravel 9+ file structure
    ->toLaravel9AndAbove(['en', 'es', 'ch'])
    // Or write lang files to selected directory
    ->writeResultsToFiles('my_lang_files');