Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

GetText PHP scanner

Created by Eslam Mahmoud http://eslam.me contact@eslam.me

Description

PHP class to scan files/project and create or update .po file, used for localization. Could be used to scan any type of files, It will extract all strings like __('Hello World') Or _e("Hello again.").

Configuration

  • $directory to be scanned accept array of directories or single string directory
  • $file_extensions an array of allowed files extensions to be scanned

How to use it?

    //Example of how to use this class
    require_once './gettext.php';
    $gettext = new gettext();
    $lines = $gettext->scan_dir();
    echo count($lines) . ' lines have been collected and need to be translated <br>';
    
    if ($gettext->create_po($lines))
        echo '"' . $gettext->file_name . '" file has been created in the same directory of this script find it at <a href="' . $gettext->file_name . '">download ' . $gettext->file_name . '</a>';
    else
        echo 'Error could not create the file please check if you have the right permissions';

About

Scan php files/project and create .po file, used for localization. It will extract all strings like __('txt').

Resources

Releases

No releases published
You can’t perform that action at this time.