Stud.IP  4.2 Revision
extract-js-localizations.php File Reference

Functions

 should_skip_file ($filename, $realfile)
 
 extract_strings ($file)
 
 find_strings_in_dir ($directory, $base=null)
 

Variables

 $occurences = find_strings_in_dir(realpath(__DIR__ . '/..'))
 
 $hashes = array()
 
foreach( $occurences as $file=> $strings)( $strings as $string)($string, "'") ?>')<? endforeach;?><? endforeach;?> $view = ob_get_clean()
 

Function Documentation

◆ extract_strings()

extract_strings (   $file)

Extract the actual text strings from a file. This will only detect single line text strings. Multi line strings are just a hassle to handle in js anyways.

Parameters
String$fileFilename to extract text strings from
Returns
mixed Array with found text strings or false if no text strings were found
Here is the caller graph for this function:

◆ find_strings_in_dir()

find_strings_in_dir (   $directory,
  $base = null 
)

Recursively find text strings in files in the given directory. This skips invalid files.

Parameters
String$directoryDirectory to search files in
mixed$baseOptional base directory to strip from file names, will default to the initial passed directory.
Returns
Array Associative array with filenames as index and an array of the text strings the file contains.
Here is the call graph for this function:

◆ should_skip_file()

should_skip_file (   $filename,
  $realfile 
)

extract-js-localizations.php

Exports all strings from js into app/views/localizations/show.php so they can be translated as well.

Author
Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL2 or any later version
Since
3.1 Determines whether the file should be skipped depending on an exclude list with an additional include list. This allows inclusion inside of previously excluded entries. We need this for the assets directory. Furthermore, the file is checked against a list of mime types to include.
Parameters
String$filenameAdjusted filename (stripped to path inside trunk)
String$realfileActual file name (needed for mime type detection)
Returns
bool indicating whether the file should be skipped or not
Here is the caller graph for this function:

Variable Documentation

◆ $hashes

$hashes = array()

◆ $occurences

$occurences = find_strings_in_dir(realpath(__DIR__ . '/..'))

◆ $view

foreach($occurences as $file => $strings) ($strings as $string) ( $string, "'") ?>')<? endforeach; ?><? endforeach; ?> $view = ob_get_clean()