Stud.IP  3.1 Revision 48552
 All Data Structures Namespaces Files Functions Variables Groups Pages
help-translation-tool.php File Reference

Functions

 po_escape ($string)
 po_unescape ($string)
 po_stringify ($string)
 get_id ($version, $language, $message, $route, $index, $position)

Variables

const MAX_LINE_LENGTH = 60
if(!isset($_SERVER['argv'],
$_SERVER['argc'])||$_SERVER['argc']< 2) 
$opts
 $options = getopt($opts['short'], $opts['long'])
 $force = isset($options['f']) || isset($options['force'])
 $version
 $language = @$options['language'] ?: @$options['l'] ?: substr($GLOBALS['DEFAULT_LANGUAGE'], 0, 2)
 $remove = array()
foreach(str_split($opts['short'])
as $opt) foreach($opts['long']
as $opt) 
$_SERVER ['argv'] = array_values(array_diff($_SERVER['argv'], $remove))

Function Documentation

get_id (   $version,
  $language,
  $message,
  $route,
  $index,
  $position 
)

Returns the id for a help entitiy based on the given index and other credentials. This function also copies existing data and settings if the entity in the given language is newly created.

Parameters
String$versionStud.IP version to use for the new entry
String$languageLanguage to use for the new entry
Array$messageComplete message item from parsed .po file
String$routeAssociated route (if any)
int$indexType index for the entity
int$positionPosition/version of the entity
Returns
String Id of the entity

Here is the call graph for this function:

po_escape (   $string)

Escapes a string for use in .po file.

Parameters
String$stringString to escape
Returns
String Escaped string

Here is the caller graph for this function:

po_stringify (   $string)

Prepares a string for use in .po file.

Parameters
String$stringString to use in .po file
Returns
String Processed string

Here is the call graph for this function:

po_unescape (   $string)

Unescapes a string for use in .po file.

Parameters
String$stringString to unescape
Returns
String Unescaped string

Here is the call graph for this function:

Variable Documentation

foreach (str_split($opts['short']) as $opt) foreach ($opts['long'] as $opt) $_SERVER['argv'] = array_values(array_diff($_SERVER['argv'], $remove))
$force = isset($options['f']) || isset($options['force'])
$language = @$options['language'] ?: @$options['l'] ?: substr($GLOBALS['DEFAULT_LANGUAGE'], 0, 2)
$options = getopt($opts['short'], $opts['long'])
if (!isset($_SERVER['argv'], $_SERVER['argc'])||$_SERVER['argc']< 2) $opts
Initial value:
array(
'short' => 'v:l:f',
'long' => array(
'force',
'version:',
'language:'
)
)
$remove = array()
$version
Initial value:
@$options['version'] ?: @$options['v']
?: DBManager::get()->query("SELECT MAX(studip_version) FROM help_content LIMIT 1")->fetchColumn()
?: $GLOBALS['SOFTWARE_VERSION']
const MAX_LINE_LENGTH = 60

help-translation-tool.php

Exports db data for the help content, tooltips and tours into a .po file or reimports the translated strings into the db.

Since we need to obtain the row to inssert/update the translated content, this information is coded into the corresponding filename and line number.

By using a specific range for line number, we can determine what type the translated string is:

range | context | location | file | line number -----------—+---------—+---------------------—+----—+----------— 10000 - 19999 | - | help_content.label | route | position 20000 - 29999 | content_id | help_content.content | route | position 30000 - 39999 | tour_id | help_tours.name | - | version 40000 - 49999 | tour_id | help_tours.description | - | version 50000 - 59999 | tour_id | help_tour_steps.title | route | step 60000 - 69999 | tour_id | help_tour_steps.tip | route | step 70000 - 79999 | tooltip_id | help_tooltips.content | route | version

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