Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 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

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

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

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

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

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

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

return: int
param: string $lang language code

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

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

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