root / drupal7 / sites / all / modules / l10n_update / l10n_update.api.php @ edccd837
1 |
<?php
|
---|---|
2 |
|
3 |
/**
|
4 |
* @file
|
5 |
* API documentation for Localize updater module.
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* Returns available translation servers and server definitions.
|
10 |
*
|
11 |
* @return keyed array of available servers.
|
12 |
* Example: array('localize.drupal.org' => array(
|
13 |
* 'name' => 'localize.drupal.org',
|
14 |
* 'server_url' => 'http://ftp.drupal.org/files/translations/l10n_server.xml',
|
15 |
* 'update_url' => 'http://ftp.drupal.org/files/translations/%core/%project/%project-%release.%language.po',
|
16 |
* ),
|
17 |
* );
|
18 |
*/
|
19 |
function hook_l10n_servers() { |
20 |
// This hook is used to specify the default localization server(s).
|
21 |
// Additionally server data can be specified on a per project basis in the
|
22 |
// .info file or using the hook_l10n_update_projects_alter().
|
23 |
|
24 |
module_load_include('inc', 'l10n_update'); |
25 |
$server = l10n_update_default_server();
|
26 |
return array($server['name'] => $server ); |
27 |
} |
28 |
|
29 |
/**
|
30 |
* Alter the list of project to be updated by l10n update.
|
31 |
*
|
32 |
* l10n_update uses the same list of projects as update module. Using this hook
|
33 |
* the list can be altered.
|
34 |
*
|
35 |
* @param array $projects
|
36 |
* Array of projects.
|
37 |
*/
|
38 |
function hook_l10n_update_projects_alter(&$projects) { |
39 |
// The $projects array contains the project data produced by
|
40 |
// update_get_projects(). A number of the array elements are described in
|
41 |
// the documentation of hook_update_projects_alter().
|
42 |
|
43 |
// In the .info file of a project a localization server can be specified.
|
44 |
// Using this hook the localization server specification can be altered or
|
45 |
// added. The 'l10n path' element is optional but can be specified to override
|
46 |
// the translation download path specified in the 10n_server.xml file.
|
47 |
$projects['existing_example_project'] = array( |
48 |
'info' => array( |
49 |
'l10n server' => 'example.com', |
50 |
'l10n url' => 'http://example.com/files/translations/l10n_server.xml', |
51 |
'l10n path' => 'http://example.com/files/translations/%core/%project/%project-%release.%language.po', |
52 |
), |
53 |
); |
54 |
|
55 |
// With this hook it is also possible to add a new project wich does not
|
56 |
// exist as a real module or theme project but is treated by the localization
|
57 |
// update module as one. The below data is the minumum to be specified.
|
58 |
// As in the previous example the 'l10n path' element is optional.
|
59 |
$projects['new_example_project'] = array( |
60 |
'project_type' => 'module', |
61 |
'name' => 'new_example_project', |
62 |
'info' => array( |
63 |
'version' => '6.x-1.5', |
64 |
'core' => '6.x', |
65 |
'l10n server' => 'example.com', |
66 |
'l10n url' => 'http://example.com/files/translations/l10n_server.xml', |
67 |
'l10n path' => 'http://example.com/files/translations/%core/%project/%project-%release.%language.po', |
68 |
), |
69 |
); |
70 |
} |