Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
tool_customlang_utils Class Reference

Provides various utilities to be used by the plugin. More...

Static Public Member Functions

static checkin ($lang)
 Exports the translator database into disk files.
 
static checkout ($lang, progress_bar $progressbar=null)
 Updates the translator database with the strings from files.
 
static get_localpack_location ($lang)
 Returns full path to the directory where local packs are dumped into.
 
static list_components ()
 Returns a list of all components installed on the server.
 

Public Attributes

 $filepath = self::get_localpack_location($lang)
 
const ROUGH_NUMBER_OF_STRINGS = 32000
 Rough number of strings that are being processed during a full checkout.
 

Static Protected Member Functions

static dump_strings ($lang, $component, $strings)
 Writes strings into a local language pack file.
 

Detailed Description

Provides various utilities to be used by the plugin.

All the public methods here are static ones, this class can not be instantiated

Member Function Documentation

◆ checkin()

static tool_customlang_utils::checkin ( $lang)
static

Exports the translator database into disk files.

Parameters
mixed$langlanguage code

◆ checkout()

static tool_customlang_utils::checkout ( $lang,
progress_bar $progressbar = null )
static

Updates the translator database with the strings from files.

This should be executed each time before going to the translation page

Parameters
string$langlanguage code to checkout
progress_bar$progressbaroptionally, the given progress bar can be updated

◆ dump_strings()

static tool_customlang_utils::dump_strings ( $lang,
$component,
$strings )
staticprotected

Writes strings into a local language pack file.

Parameters
string$componentthe name of the component
array$strings
Return values
void

◆ get_localpack_location()

static tool_customlang_utils::get_localpack_location ( $lang)
static

Returns full path to the directory where local packs are dumped into.

Parameters
string$langlanguage code
Return values
stringfull path

◆ list_components()

static tool_customlang_utils::list_components ( )
static

Returns a list of all components installed on the server.

Return values
array(string)legacyname => (string)frankenstylename

Member Data Documentation

◆ ROUGH_NUMBER_OF_STRINGS

const tool_customlang_utils::ROUGH_NUMBER_OF_STRINGS = 32000

Rough number of strings that are being processed during a full checkout.

This is used to estimate the progress of the checkout.


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