Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Language API.

Development:Language API: Difference between revisions

From MoodleDocs
(New page: ''This is a draft of Language API proposal that should define data structures and API to manipulate Moodle lang files.'' [[Image:lang_api_classes.png|thumb|UML diagram of Language API cla...)
 
(Replacing page with 'TODO: describe class string_manager here and how to use it * See MDL-18776 == See also == * Development:Places to search for lang strings.')
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
''This is a draft of Language API proposal that should define data structures and API to manipulate Moodle lang files.''
TODO: describe class string_manager here and how to use it


[[Image:lang_api_classes.png|thumb|UML diagram of Language API classes]]
* See MDL-18776
From the conceptual point of view, the Language API consists of three hierarchical layers. These layers are abstracted as three object classes - see the attached UML diagram.
; language_pack : This represents the whole pack with its own repository, maintainer etc. At the moment, it is implemented as a directory - e.g. $CFG->dirroot/lang/en_utf8 or $CFG->dataroot/lang/cs_utf8 etc. Other implementations should be possible in the future.
* public '''$id''' - lang pack code, e.g. 'en_utf8'
* public '''$name''' - human readable pack name, e.g. 'English with my customizations'
* public '''$location''' - where the lang pack is saved. Currently this will be the full path to the root directory. Might be some general URI format in the future, e.g. filesystem://path/to/the/directory or dbstorage://database.server/user/password or git://git.repository/lang etc.
* public '''load_modules()''' - initializes all modules included in the language pack


; language_module : represents a single module of a given pack, defines the sub-context of translated texts. At the moment, it is implemented as a file - e.g. moodle.php or qtype_multichoice.php. Other implementations should be possible in the future.
== See also ==
; language_string : represents a single unit of text (word, sentence or whole page) that can be translated and then used in the UI. At the moment, this is either one $string[] definition or a help file content.


== See also ==
*  [[Development:Places to search for lang strings]].
*  [[Development:Places to search for lang strings]].

Latest revision as of 18:31, 7 April 2009

TODO: describe class string_manager here and how to use it

See also