From e5258d0cb64906527e86620f848a864563316bb0 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Thu, 19 Oct 2023 14:52:16 -0400 Subject: [PATCH] Fix translate into sort order --- libretranslate/templates/app.js.template | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libretranslate/templates/app.js.template b/libretranslate/templates/app.js.template index c01523b..6377724 100644 --- a/libretranslate/templates/app.js.template +++ b/libretranslate/templates/app.js.template @@ -155,7 +155,11 @@ document.addEventListener('DOMContentLoaded', function(){ else{ var lang = this.langs.find(l => l.code === this.sourceLang); if (!lang) return this.langs; - return lang.targets.map(t => this.langs.find(l => l.code === t)); + var tgtLangs = lang.targets.map(t => this.langs.find(l => l.code === t)); + tgtLangs.sort(function(a, b){ + return a.name.localeCompare(b.name); + }); + return tgtLangs; } } },