_install_prepare_import($langcodes, $server_pattern)
Tells the translation import process that Drupal core is installed.
Parameters
array $langcodes: Language codes used for the translations.
string $server_pattern: Server access pattern (to replace language code, version number, etc. in).
File
- core/includes/install.core.inc, line 1667
- API functions for installing Drupal.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | function _install_prepare_import( $langcodes , $server_pattern ) { \Drupal::moduleHandler()->loadInclude( 'locale' , 'bulk.inc' ); $matches = array (); foreach ( $langcodes as $langcode ) { // Get the translation files located in the translations directory. $files = locale_translate_get_interface_translation_files( array ( 'drupal' ), array ( $langcode )); // Pick the first file which matches the language, if any. $file = reset( $files ); if ( is_object ( $file )) { $filename = $file ->filename; preg_match( '/drupal-([0-9a-z\.-]+)\.' . $langcode . '\.po/' , $filename , $matches ); // Get the version information. if ( $version = $matches [1]) { $info = _install_get_version_info( $version ); // Picking the first file does not necessarily result in the right file. So // we check if at least the major version number is available. if ( $info [ 'major' ]) { $core = $info [ 'major' ] . '.x' ; $data = array ( 'name' => 'drupal' , 'project_type' => 'module' , 'core' => $core , 'version' => $version , 'server_pattern' => $server_pattern , 'status' => 1, ); \Drupal::service( 'locale.project' )->set( $data [ 'name' ], $data ); module_load_include( 'compare.inc' , 'locale' ); locale_translation_check_projects_local( array ( 'drupal' ), array ( $langcode )); } } } } } |
Please login to continue.