You are here

function hook_l10n_update_projects_alter in Localization update 7

Same name and namespace in other branches
  1. 6 l10n_update.api.php \hook_l10n_update_projects_alter()
  2. 7.2 l10n_update.api.php \hook_l10n_update_projects_alter()

Alter the list of project to be updated by l10n update.

l10n_update uses the same list of projects as update module. Using this hook the list can be altered.

Parameters

array $projects: Array of projects.

1 invocation of hook_l10n_update_projects_alter()
l10n_update_project_list in ./l10n_update.project.inc
Get update module's project list

File

./l10n_update.api.php, line 38
API documentation for Localize updater module.

Code

function hook_l10n_update_projects_alter(&$projects) {

  // The $projects array contains the project data produced by
  // update_get_projects(). A number of the array elements are described in
  // the documentation of hook_update_projects_alter().
  // In the .info file of a project a localization server can be specified.
  // Using this hook the localization server specification can be altered or
  // added. The 'l10n path' element is optional but can be specified to override
  // the translation download path specified in the 10n_server.xml file.
  $projects['existing_example_project'] = array(
    'info' => array(
      'l10n server' => 'example.com',
      'l10n url' => 'http://example.com/files/translations/l10n_server.xml',
      'l10n path' => 'http://example.com/files/translations/%core/%project/%project-%release.%language.po',
    ),
  );

  // With this hook it is also possible to add a new project wich does not
  // exist as a real module or theme project but is treated by the localization
  // update module as one. The below data is the minumum to be specified.
  // As in the previous example the 'l10n path' element is optional.
  $projects['new_example_project'] = array(
    'project_type' => 'module',
    'name' => 'new_example_project',
    'info' => array(
      'version' => '6.x-1.5',
      'core' => '6.x',
      'l10n server' => 'example.com',
      'l10n url' => 'http://example.com/files/translations/l10n_server.xml',
      'l10n path' => 'http://example.com/files/translations/%core/%project/%project-%release.%language.po',
    ),
  );
}