wingbot 3.44.2 → 3.44.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/BuildRouter.js
CHANGED
|
@@ -102,8 +102,9 @@ const DUMMY_ROUTE = { id: 0, path: null, resolvers: [] };
|
|
|
102
102
|
* @param {string} senderId
|
|
103
103
|
* @param {string} textLabel
|
|
104
104
|
* @param {string} urlText
|
|
105
|
-
* @param {boolean}
|
|
106
|
-
* @param {object}
|
|
105
|
+
* @param {boolean} isExtUrl
|
|
106
|
+
* @param {object} state
|
|
107
|
+
* @param {string} pageId
|
|
107
108
|
* @returns {string}
|
|
108
109
|
*/
|
|
109
110
|
|
|
@@ -72,7 +72,14 @@ function carousel (params, context) {
|
|
|
72
72
|
const hasExtension = type === TYPE_URL_WITH_EXT;
|
|
73
73
|
const textLabel = titleText || subtitleText;
|
|
74
74
|
let urlText = getText(url, state);
|
|
75
|
-
urlText = linksTranslator(
|
|
75
|
+
urlText = linksTranslator(
|
|
76
|
+
senderId,
|
|
77
|
+
textLabel,
|
|
78
|
+
urlText,
|
|
79
|
+
isExtUrl,
|
|
80
|
+
state,
|
|
81
|
+
req.pageId
|
|
82
|
+
);
|
|
76
83
|
elem.setElementAction(urlText, hasExtension, webviewHeight);
|
|
77
84
|
break;
|
|
78
85
|
}
|
package/src/resolvers/message.js
CHANGED
|
@@ -36,7 +36,8 @@ function getVoiceControlFromParams (params, lang = null) {
|
|
|
36
36
|
|
|
37
37
|
voiceControlProps.forEach((prop) => {
|
|
38
38
|
if (params[prop]) {
|
|
39
|
-
|
|
39
|
+
// for voice control do not default to other languages
|
|
40
|
+
voiceControl[prop] = getLanguageText(params[prop], lang, true);
|
|
40
41
|
}
|
|
41
42
|
});
|
|
42
43
|
|
package/src/resolvers/utils.js
CHANGED
|
@@ -61,9 +61,10 @@ function isTextObjectEmpty (text) {
|
|
|
61
61
|
/**
|
|
62
62
|
* @param {Translations} translations
|
|
63
63
|
* @param {string} [lang]
|
|
64
|
+
* @param {boolean} [disableDefaulting] - it will try to find translation for other language
|
|
64
65
|
* @returns {null|string}
|
|
65
66
|
*/
|
|
66
|
-
function getLanguageText (translations, lang = null) {
|
|
67
|
+
function getLanguageText (translations, lang = null, disableDefaulting = false) {
|
|
67
68
|
let foundText;
|
|
68
69
|
|
|
69
70
|
if (isArrayOfObjects(translations)) {
|
|
@@ -71,7 +72,7 @@ function getLanguageText (translations, lang = null) {
|
|
|
71
72
|
// @ts-ignore
|
|
72
73
|
foundText = translations.find((t) => t.l === lang);
|
|
73
74
|
}
|
|
74
|
-
if (isTextObjectEmpty(foundText)) {
|
|
75
|
+
if (isTextObjectEmpty(foundText) && !disableDefaulting) {
|
|
75
76
|
// @ts-ignore
|
|
76
77
|
foundText = translations.find((t) => !isTextObjectEmpty(t));
|
|
77
78
|
}
|
|
@@ -204,7 +205,7 @@ function getText (text, state) {
|
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
// eslint-disable-next-line no-unused-vars
|
|
207
|
-
const DEFAULT_LINK_TRANSLATOR = (senderId,
|
|
208
|
+
const DEFAULT_LINK_TRANSLATOR = (senderId, text, url, isExtUrl, state, pageId) => url;
|
|
208
209
|
|
|
209
210
|
/** @typedef {import('../BuildRouter').BotContext} BotContext */
|
|
210
211
|
|
|
@@ -257,7 +258,14 @@ function processButtons (
|
|
|
257
258
|
case TYPE_URL_WITH_EXT: {
|
|
258
259
|
const hasExtention = type === TYPE_URL_WITH_EXT;
|
|
259
260
|
let urlText = getText(url, state);
|
|
260
|
-
urlText = translateLinks(
|
|
261
|
+
urlText = translateLinks(
|
|
262
|
+
senderId,
|
|
263
|
+
defaultText,
|
|
264
|
+
urlText,
|
|
265
|
+
isExtUrl,
|
|
266
|
+
state,
|
|
267
|
+
req.pageId
|
|
268
|
+
);
|
|
261
269
|
elem.urlButton(btnTitleText, urlText, hasExtention, webviewHeight);
|
|
262
270
|
break;
|
|
263
271
|
}
|