|
|
(3 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.''
| | #REDIRECT [[String API]] |
| | |
| [[Image:lang_api_classes.png|thumb|UML diagram of Language API classes]] | |
| 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.
| |
| ; 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 ==
| |
| * [[Places to search for lang strings]].
| |