Sort source langs

This commit is contained in:
Piero Toffanin 2026-02-05 16:22:36 -05:00
parent 29ec5ca5b8
commit 4f6a9cc193
2 changed files with 8 additions and 1 deletions

View File

@ -155,6 +155,13 @@ document.addEventListener('DOMContentLoaded', function(){
canSendSuggestion: function(){
return this.translatedText.trim() !== "" && this.translatedText !== this.savedTanslatedText;
},
sourceLangs: function(){
var srcLangs = JSON.parse(JSON.stringify(this.langs));
srcLangs.sort(function(a, b){
return a.name.localeCompare(b.name);
});
return srcLangs;
},
targetLangs: function(){
if (!this.sourceLang) return this.langs;
else{

View File

@ -195,7 +195,7 @@
<span id="sourceLangLabel">{{ _h("Translate from") }}</span>
<span v-if="detectedLangText !== ''">[[ detectedLangText ]]</span>
<select aria-labelledby="sourceLangLabel" class="browser-default" v-model="sourceLang" ref="sourceLangDropdown" @change="handleInput">
<template v-for="option in langs">
<template v-for="option in sourceLangs">
<option :value="option.code">[[ option.name ]]</option>
</template>
</select>