Issue #2240555 by penyaskito: Preselect language when importing translations previously exported.
parent
c5c075dfd8
commit
33d8ee8c8f
|
@ -14,9 +14,11 @@
|
|||
var $langcode = $form.find('.langcode-input');
|
||||
$form.find('.file-import-input')
|
||||
.on('change', function () {
|
||||
var matches = $(this).val().match(/\.([\-\w]+)\.po/);
|
||||
if (matches && $langcode.find('option[value="' + matches[1] + '"]').length) {
|
||||
$langcode.val(matches[1]);
|
||||
// If the filename is fully the language code or the filename
|
||||
// ends with a language code, pre-select that one.
|
||||
var matches = $(this).val().match(/([^.][\.]*)([\w-]+)\.po$/);
|
||||
if (matches && $langcode.find('option[value="' + matches[2] + '"]').length) {
|
||||
$langcode.val(matches[2]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue