locale_form_language_admin_add_form_alter_submit($form, FormStateInterface $form_state)
Form submission handler for language_admin_add_form().
Set a batch for a newly-added language.
File
- core/modules/locale/locale.module, line 685
- Enables the translation of the user interface to languages other than English.
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 | function locale_form_language_admin_add_form_alter_submit( $form , FormStateInterface $form_state ) { \Drupal::moduleHandler()->loadInclude( 'locale' , 'fetch.inc' ); $options = _locale_translation_default_update_options(); if ( $form_state ->isValueEmpty( 'predefined_langcode' ) || $form_state ->getValue( 'predefined_langcode' ) == 'custom' ) { $langcode = $form_state ->getValue( 'langcode' ); } else { $langcode = $form_state ->getValue( 'predefined_langcode' ); } if (\Drupal::config( 'locale.settings' )->get( 'translation.import_enabled' )) { // Download and import translations for the newly added language. $batch = locale_translation_batch_update_build( array (), array ( $langcode ), $options ); batch_set( $batch ); } // Create or update all configuration translations for this language. If we // are adding English then we need to run this even if import is not enabled, // because then we extract English sources from shipped configuration. if (\Drupal::config( 'locale.settings' )->get( 'translation.import_enabled' ) || $langcode == 'en' ) { \Drupal::moduleHandler()->loadInclude( 'locale' , 'bulk.inc' ); if ( $batch = locale_config_batch_update_components( $options , array ( $langcode ))) { batch_set( $batch ); } } } |
Please login to continue.