ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Gettext\Extractors\JsCode Class Reference

Class to get gettext strings from javascript files. More...

+ Inheritance diagram for Gettext\Extractors\JsCode:
+ Collaboration diagram for Gettext\Extractors\JsCode:

Static Public Member Functions

static fromString ($string, Translations $translations=null, $file='')
 {Parses a string and append the translations found in the Translations instance.
Parameters
string$string
Translations | null$translations
string$fileThe file path to insert the reference
Returns
Translations
} More...
 
- Static Public Member Functions inherited from Gettext\Extractors\Extractor
static fromFile ($file, Translations $translations=null)
 Extract the translations from a file. More...
 
- Static Public Member Functions inherited from Gettext\Extractors\ExtractorInterface
static fromFile ($file, Translations $translations=null)
 Extract the translations from a file. More...
 

Static Public Attributes

static $functions
 

Additional Inherited Members

- Static Protected Member Functions inherited from Gettext\Extractors\Extractor
static getFiles ($file)
 Checks and returns all files. More...
 
static readFile ($file)
 Reads and returns the content of a file. More...
 

Detailed Description

Class to get gettext strings from javascript files.

Definition at line 11 of file JsCode.php.

Member Function Documentation

◆ fromString()

static Gettext\Extractors\JsCode::fromString (   $string,
Translations  $translations = null,
  $file = '' 
)
static

{Parses a string and append the translations found in the Translations instance.

Parameters
string$string
Translations | null$translations
string$fileThe file path to insert the reference
Returns
Translations
}

Implements Gettext\Extractors\ExtractorInterface.

Definition at line 22 of file JsCode.php.

References $file, and Gettext\Extractors\JsCode\$functions.

23  {
24  if ($translations === null) {
25  $translations = new Translations();
26  }
27 
28  $functions = new JsFunctionsScanner($string);
29  $functions->saveGettextFunctions(self::$functions, $translations, $file);
30  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file

Field Documentation

◆ $functions

Gettext\Extractors\JsCode::$functions
static
Initial value:
'__' => '__',
'n__' => 'n__',
'p__' => 'p__',
)

Definition at line 13 of file JsCode.php.

Referenced by Gettext\Extractors\JsCode\fromString().


The documentation for this class was generated from the following file: