From 6548c9836ab2d5f393769eab7f51c40b7892d9d6 Mon Sep 17 00:00:00 2001 From: Erik Brommers <1458944+eb1@users.noreply.github.com> Date: Fri, 31 May 2024 13:25:31 -0700 Subject: [PATCH 1/2] Fix #577 Test length of localnames and names atts before using them; also prefer name to names[0] in selection. --- www/js/views/ProjectViews.js | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/www/js/views/ProjectViews.js b/www/js/views/ProjectViews.js index 3f8e9655..96f9fc26 100644 --- a/www/js/views/ProjectViews.js +++ b/www/js/views/ProjectViews.js @@ -714,13 +714,13 @@ define(function (require) { if (data.attributes.localname) { return data.attributes.localname; } - if (data.attributes.localnames) { + if (data.attributes.localnames && data.attributes.localnames.length > 0) { return data.attributes.localnames[0]; } - if (data.attributes.names) { - return data.attributes.names[0]; + if (data.attributes.name) { + return data.attributes.name; } - return data.attributes.name; + return data.attributes.names[0]; }, source: this.languageMatches(this.theLangs), limit: 200, @@ -793,13 +793,13 @@ define(function (require) { if (data.attributes.localname) { return data.attributes.localname; } - if (data.attributes.localnames) { + if (data.attributes.localnames && data.attributes.localnames.length > 0) { return data.attributes.localnames[0]; } - if (data.attributes.names) { - return data.attributes.names[0]; + if (data.attributes.name) { + return data.attributes.name; } - return data.attributes.name; + return data.attributes.names[0]; }, source: this.languageMatches(this.theLangs), limit: 200, @@ -1198,9 +1198,9 @@ define(function (require) { // try autonym, fall back on language name in English if (firstLang.attributes.localname) { currentView.langName = firstLang.attributes.localname; - } else if (firstLang.attributes.localnames) { + } else if (firstLang.attributes.localnames && firstLang.attributes.localnames.length > 0) { currentView.langName = firstLang.attributes.localnames[0]; - } else if (firstLang.attributes.names) { + } else if (firstLang.attributes.names && firstLang.attributes.names.length > 0) { currentView.langName = firstLang.attributes.names[0]; } else { currentView.langName = firstLang.attributes.name; @@ -1220,12 +1220,12 @@ define(function (require) { // try autonym, fall back on language name in English if (suggestion.attributes.localname) { currentView.langName = suggestion.attributes.localname; - } else if (suggestion.attributes.localnames) { + } else if (suggestion.attributes.localnames && suggestion.attributes.localnames.length > 0) { currentView.langName = suggestion.attributes.localnames[0]; - } else if (suggestion.attributes.names) { - currentView.langName = suggestion.attributes.names[0]; - } else { + } else if (suggestion.attributes.name) { currentView.langName = suggestion.attributes.name; + } else { + currentView.langName = suggestion.attributes.names[0]; } newLangCode = suggestion.attributes.tag; currentView.langCode = buildFullLanguageCode(newLangCode, $('#LanguageVariant').val().trim().replace(/\s+/g, '')); @@ -1697,9 +1697,9 @@ define(function (require) { // try autonym, fall back on language name in English if (firstLang.attributes.localname) { currentView.langName = firstLang.attributes.localname; - } else if (firstLang.attributes.localnames) { + } else if (firstLang.attributes.localnames && firstLang.attributes.localnames.length > 0) { currentView.langName = firstLang.attributes.localnames[0]; - } else if (firstLang.attributes.names) { + } else if (firstLang.attributes.names && firstLang.attributes.names.length > 0) { currentView.langName = firstLang.attributes.names[0]; } else { currentView.langName = firstLang.attributes.name; @@ -1719,12 +1719,12 @@ define(function (require) { // try autonym, fall back on language name in English if (suggestion.attributes.localname) { currentView.langName = suggestion.attributes.localname; - } else if (suggestion.attributes.localnames) { + } else if (suggestion.attributes.localnames && suggestion.attributes.localnames.length > 0) { currentView.langName = suggestion.attributes.localnames[0]; - } else if (suggestion.attributes.names) { - currentView.langName = suggestion.attributes.names[0]; - } else { + } else if (suggestion.attributes.name) { currentView.langName = suggestion.attributes.name; + } else { + currentView.langName = suggestion.attributes.names[0]; } newLangCode = suggestion.attributes.tag; currentView.langCode = buildFullLanguageCode(newLangCode, $('#LanguageVariant').val().trim().replace(/\s+/g, '')); @@ -1918,9 +1918,9 @@ define(function (require) { // try autonym, fall back on language name in English if (firstLang.attributes.localname) { strLangName = firstLang.attributes.localname; - } else if (firstLang.attributes.localnames) { + } else if (firstLang.attributes.localnames && firstLang.attributes.localnames.length > 0) { strLangName = firstLang.attributes.localnames[0]; - } else if (firstLang.attributes.names) { + } else if (firstLang.attributes.names && firstLang.attributes.names.length > 0) { strLangName = firstLang.attributes.names[0]; } else { strLangName = firstLang.attributes.name; From 2d401b7292849c2b80d6e64e5b992fbc9a086faf Mon Sep 17 00:00:00 2001 From: Erik Brommers <1458944+eb1@users.noreply.github.com> Date: Fri, 31 May 2024 15:50:23 -0700 Subject: [PATCH 2/2] Version bump (1.16.3) --- config.xml | 2 +- package.json | 2 +- www/js/Application.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.xml b/config.xml index 5f79ba80..7bd2ddfc 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + Adapt It Mobile An open source application for translating between related languages. diff --git a/package.json b/package.json index da2127a4..1b746296 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "adapt-it-mobile", - "version": "1.16.2", + "version": "1.16.3", "description": "Adapt It Mobile", "repository": { "type": "git", diff --git a/www/js/Application.js b/www/js/Application.js index 00e484b7..564a3b2a 100755 --- a/www/js/Application.js +++ b/www/js/Application.js @@ -79,8 +79,8 @@ define(function (require) { searchIndex: 0, currentProject: null, localURLs: [], - version: "1.16.2", // appended with Android / iOS build info - AndroidBuild: "54", // (was milestone release #) + version: "1.16.3", // appended with Android / iOS build info + AndroidBuild: "55", // (was milestone release #) iOSBuild: "1", // iOS uploaded build number for this release (increments from 1 for each release) importingURL: "", // for other apps in Android-land sending us files to import