This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/web/core/modules/locale/locale.bulk.js

23 lines
751 B
JavaScript
Raw Normal View History

/**
2018-11-23 12:29:20 +00:00
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
Drupal.behaviors.importLanguageCodeSelector = {
2018-11-23 12:29:20 +00:00
attach: function attach(context, settings) {
var $form = $('#locale-translate-import-form').once('autodetect-lang');
if ($form.length) {
var $langcode = $form.find('.langcode-input');
2018-11-23 12:29:20 +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]);
}
});
}
}
};
2018-11-23 12:29:20 +00:00
})(jQuery, Drupal);