Commit 33d8ee8c authored by catch's avatar catch

Issue #2240555 by penyaskito: Preselect language when importing translations previously exported.

parent c5c075df
......@@ -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]);
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment