Chris@0: Media > File system) can be addressed Chris@0: * using the "translations://" streamwrapper. But also other streamwrappers can Chris@0: * be used. Chris@0: * @code Chris@0: * 'interface translation server pattern': translations://%project-%version.%language.po Chris@0: * @endcode Chris@0: * @code Chris@0: * 'interface translation server pattern': public://translations/%project-%version.%language.po Chris@0: * @endcode Chris@0: * Chris@0: * Multiple custom modules or themes sharing the same po file should have Chris@0: * matching definitions. Such as modules and sub-modules or multiple modules in Chris@0: * the same project/code tree. Both "interface translation project" and Chris@0: * "interface translation server pattern" definitions of these modules should Chris@0: * match. Chris@0: * Chris@0: * Example .info.yml file properties for a custom module with a po file located Chris@0: * on a remote translation server. Chris@0: * @code Chris@0: * 'interface translation project': example_module Chris@0: * 'interface translation server pattern': http://example.com/files/translations/%core/%project/%project-%version.%language.po Chris@0: * @endcode Chris@0: * Chris@0: * Custom themes, features and distributions can implement these .info.yml file Chris@0: * properties in their .info.yml file too. Chris@0: * Chris@0: * To change the interface translation settings of modules and themes hosted at Chris@0: * drupal.org use hook_locale_translation_projects_alter(). Possible changes Chris@0: * include changing the po file location (server pattern) or removing the Chris@0: * project from the translation update list. Chris@0: * Chris@0: * Available .info.yml file properties: Chris@0: * - "interface translation project": project name. Required. Chris@0: * Name of the project a (sub-)module belongs to. Multiple modules sharing Chris@0: * the same project name will be listed as one the translation status list. Chris@0: * - "interface translation server pattern": URL of the .po translation files Chris@0: * used to download the files from. The URL contains tokens which will be Chris@0: * replaced by appropriate values. The file can be locate both at a local Chris@0: * relative path, a local absolute path and a remote server location. Chris@0: * Chris@0: * The following tokens are available for the server pattern: Chris@0: * - "%core": Core version. Value example: "8.x". Chris@0: * - "%project": Project name. Value examples: "drupal", "media_gallery". Chris@0: * - "%version": Project version release. Value examples: "8.1", "8.x-1.0". Chris@0: * - "%language": Language code. Value examples: "fr", "pt-pt". Chris@0: * Chris@0: * @see i18n Chris@0: * @} Chris@0: */ Chris@0: Chris@0: /** Chris@0: * @addtogroup hooks Chris@0: * @{ Chris@0: */ Chris@0: Chris@0: /** Chris@0: * Alter the list of projects to be updated by locale's interface translation. Chris@0: * Chris@0: * Locale module attempts to update the translation of those modules returned Chris@0: * by \Drupal\Update\UpdateManager::getProjects(). Using this hook, the data Chris@0: * returned by \Drupal\Update\UpdateManager::getProjects() can be altered or Chris@0: * extended. Chris@0: * Chris@0: * Modules or distributions that use a dedicated translation server should use Chris@0: * this hook to specify the interface translation server pattern, or to add Chris@0: * additional custom/non-Drupal.org modules to the list of modules known to Chris@0: * locale. Chris@0: * - "interface translation server pattern": URL of the .po translation files Chris@0: * used to download the files from. The URL contains tokens which will be Chris@0: * replaced by appropriate values. Chris@0: * The following tokens are available for the server pattern: Chris@0: * - "%core": Core version. Value example: "8.x". Chris@0: * - "%project": Project name. Value examples: "drupal", "media_gallery". Chris@0: * - "%version": Project version release. Value examples: "8.1", "8.x-1.0". Chris@0: * - "%language": Language code. Value examples: "fr", "pt-pt". Chris@0: * Chris@0: * @param array $projects Chris@0: * Project data as returned by \Drupal\Update\UpdateManager::getProjects(). Chris@0: * Chris@0: * @see locale_translation_project_list() Chris@0: * @ingroup interface_translation_properties Chris@0: */ Chris@0: function hook_locale_translation_projects_alter(&$projects) { Chris@0: // The translations are located at a custom translation sever. Chris@0: $projects['existing_project'] = [ Chris@0: 'info' => [ Chris@0: 'interface translation server pattern' => 'http://example.com/files/translations/%core/%project/%project-%version.%language.po', Chris@0: ], Chris@0: ]; Chris@0: } Chris@0: Chris@0: /** Chris@0: * @} End of "addtogroup hooks". Chris@0: */