From 9ab81352b152a108fd3416a43a4f41c8023d14fe Mon Sep 17 00:00:00 2001 From: Will Vincent Date: Fri, 28 Oct 2016 03:15:36 -0500 Subject: [PATCH 1/2] Fix language selection --- app/js/welcome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/js/welcome.js b/app/js/welcome.js index 6da727a..08a903d 100644 --- a/app/js/welcome.js +++ b/app/js/welcome.js @@ -33,7 +33,7 @@ $.each(i18n.fullLocaleList, (i, v) => { }); // Try to figure out user's language -$('#locales-list').val(app.getLocale() ? app.getLocale() : 'en'); +$('#locales-list').val(app.getLocale() ? app.getLocale().split('-')[0] : 'en'); /* Go button action */ $('#go').click(() => { From f24f90dadd76918e17d45b1d9d77a57bb4afc99a Mon Sep 17 00:00:00 2001 From: Will Vincent Date: Fri, 28 Oct 2016 03:35:07 -0500 Subject: [PATCH 2/2] Better locale check logic. --- app/js/welcome.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/js/welcome.js b/app/js/welcome.js index 08a903d..ee92ddb 100644 --- a/app/js/welcome.js +++ b/app/js/welcome.js @@ -33,7 +33,13 @@ $.each(i18n.fullLocaleList, (i, v) => { }); // Try to figure out user's language -$('#locales-list').val(app.getLocale() ? app.getLocale().split('-')[0] : 'en'); +if (app.getLocale() in i18n.fullLocaleList) { + $('#locales-list').val(app.getLocale()); +} else if (app.getLocale().split('-')[0] in i18n.fullLocaleList) { + $('#locales-list').val(app.getLocale().split('-')[0]); +} else { + $('#locales-list').val('en'); +} /* Go button action */ $('#go').click(() => {