Skip to content
Snippets Groups Projects
Commit 33d8ee8c authored by catch's avatar catch
Browse files

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

parent c5c075df
No related branches found
No related tags found
No related merge requests found
......@@ -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]);
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment