locale.bulk.js 752 B

1234567891011121314151617181920212223
  1. /**
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/2815083
  5. * @preserve
  6. **/
  7. (function ($, Drupal) {
  8. Drupal.behaviors.importLanguageCodeSelector = {
  9. attach: function attach(context, settings) {
  10. var $form = $('#locale-translate-import-form').once('autodetect-lang');
  11. if ($form.length) {
  12. var $langcode = $form.find('.langcode-input');
  13. $form.find('.file-import-input').on('change', function () {
  14. var matches = $(this).val().match(/([^.][\.]*)([\w-]+)\.po$/);
  15. if (matches && $langcode.find('option[value="' + matches[2] + '"]').length) {
  16. $langcode.val(matches[2]);
  17. }
  18. });
  19. }
  20. }
  21. };
  22. })(jQuery, Drupal);