Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401] [Versions 401 and 403]

Definition of classes used by language customization admin tool

Copyright: 2010 David Mudrak <david@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 553 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

tool_customlang_utils:: (10 methods):
  __construct()
  list_components()
  checkout()
  checkin()
  get_localpack_location()
  dump_strings()
  get_component_filename()
  get_count_of_modified()
  save_filter()
  load_filter()

tool_customlang_menu:: (3 methods):
  __construct()
  get_items()
  add_item()

tool_customlang_translator:: (1 method):
  __construct()


Class: tool_customlang_utils  - X-Ref

Provides various utilities to be used by the plugin

All the public methods here are static ones, this class can not be instantiated
__construct()   X-Ref
This class can not be instantiated


list_components()   X-Ref
Returns a list of all components installed on the server

return: array (string)legacyname => (string)frankenstylename

checkout($lang, progress_bar $progressbar = null)   X-Ref
Updates the translator database with the strings from files

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

param: string $lang language code to checkout
param: progress_bar $progressbar optionally, the given progress bar can be updated

checkin($lang)   X-Ref
Exports the translator database into disk files

param: mixed $lang language code

get_localpack_location($lang)   X-Ref
Returns full path to the directory where local packs are dumped into

param: string $lang language code
return: string full path

dump_strings($lang, $component, $strings)   X-Ref
Writes strings into a local language pack file

param: string $component the name of the component
param: array $strings
return: void

get_component_filename($component)   X-Ref
Returns the name of the file where the component's local strings should be exported into

param: string $component normalized name of the component, eg 'core' or 'mod_workshop'
return: string|boolean filename eg 'moodle.php' or 'workshop.php', false if not found

get_count_of_modified($lang)   X-Ref
Returns the number of modified strings checked out in the translator

param: string $lang language code
return: int

save_filter(stdclass $data, stdclass $persistant)   X-Ref
Saves filter data into a persistant storage such as user session

param: stdclass $data filter values
param: stdclass $persistant storage object

load_filter(stdclass $persistant)   X-Ref
Loads the previously saved filter settings from a persistent storage

param: stdclass $persistant storage object
return: stdclass filter data

Class: tool_customlang_menu  - X-Ref

Represents the action menu of the tool

__construct(array $items = array()   X-Ref
No description

get_items()   X-Ref
Returns the menu items

return: array (string)key => (object)[->(string)title ->(moodle_url)url ->(string)method]

add_item($key, $title, moodle_url $url, $method)   X-Ref
Adds item into the menu

param: string $key item identifier
param: string $title localized action title
param: moodle_url $url action handler
param: string $method form method

Class: tool_customlang_translator  - X-Ref

Represents the translation tool

__construct(moodle_url $handler, $lang, $filter, $currentpage = 0)   X-Ref
No description