Chris@0: /** Chris@0: * DO NOT EDIT THIS FILE. Chris@0: * See the following change record for more information, Chris@0: * https://www.drupal.org/node/2815083 Chris@0: * @preserve Chris@0: **/ Chris@0: Chris@0: (function ($, Drupal) { Chris@0: Drupal.behaviors.importLanguageCodeSelector = { Chris@0: attach: function attach(context, settings) { Chris@0: var $form = $('#locale-translate-import-form').once('autodetect-lang'); Chris@0: if ($form.length) { Chris@0: var $langcode = $form.find('.langcode-input'); Chris@0: $form.find('.file-import-input').on('change', function () { Chris@14: var matches = $(this).val().match(/([^.][.]*)([\w-]+)\.po$/); Chris@0: if (matches && $langcode.find('option[value="' + matches[2] + '"]').length) { Chris@0: $langcode.val(matches[2]); Chris@0: } Chris@0: }); Chris@0: } Chris@0: } Chris@0: }; Chris@0: })(jQuery, Drupal);