2015-06-05 20:17:55 +00:00
|
|
|
/**
|
2017-05-19 22:12:53 +00:00
|
|
|
* DO NOT EDIT THIS FILE.
|
|
|
|
* See the following change record for more information,
|
2017-05-23 14:30:14 +00:00
|
|
|
* https://www.drupal.org/node/2815083
|
2017-05-19 22:12:53 +00:00
|
|
|
* @preserve
|
|
|
|
**/
|
2015-06-05 20:17:55 +00:00
|
|
|
|
2014-01-25 02:37:16 +00:00
|
|
|
(function ($, Drupal) {
|
2014-01-27 21:41:32 +00:00
|
|
|
Drupal.behaviors.importLanguageCodeSelector = {
|
2017-05-19 22:12:53 +00:00
|
|
|
attach: function attach(context, settings) {
|
2014-01-27 21:41:32 +00:00
|
|
|
var $form = $('#locale-translate-import-form').once('autodetect-lang');
|
|
|
|
if ($form.length) {
|
|
|
|
var $langcode = $form.find('.langcode-input');
|
2017-05-19 22:12:53 +00:00
|
|
|
$form.find('.file-import-input').on('change', function () {
|
|
|
|
var matches = $(this).val().match(/([^.][\.]*)([\w-]+)\.po$/);
|
|
|
|
if (matches && $langcode.find('option[value="' + matches[2] + '"]').length) {
|
|
|
|
$langcode.val(matches[2]);
|
|
|
|
}
|
|
|
|
});
|
2014-01-27 21:41:32 +00:00
|
|
|
}
|
2012-09-01 01:59:54 +00:00
|
|
|
}
|
2014-01-27 21:41:32 +00:00
|
|
|
};
|
2017-05-19 22:12:53 +00:00
|
|
|
})(jQuery, Drupal);
|