Skip to content

Commit 4d78a41

Browse files
committed
v10.5.0
1 parent 672e807 commit 4d78a41

File tree

5 files changed

+28
-67
lines changed

5 files changed

+28
-67
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "10.1.0",
3+
"version": "10.5.0",
44
"main": "build/index.js",
55
"scripts": {
66
"start": "webpack serve",

src/GleapConfigManager.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,7 @@ export default class GleapConfigManager {
145145
GleapNetworkIntercepter.getInstance().setBlacklist(flowConfig.networkLogBlacklist);
146146
}
147147

148-
if (flowConfig.customTranslations) {
149-
GleapTranslationManager.getInstance().setCustomTranslation(flowConfig.customTranslations);
150-
GleapTranslationManager.getInstance().updateRTLSupport();
151-
}
148+
GleapTranslationManager.getInstance().updateRTLSupport();
152149

153150
Gleap.enableShortcuts(flowConfig.enableShortcuts ? true : false);
154151
} catch (e) { }

src/GleapFeedbackButtonManager.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ export default class GleapFeedbackButtonManager {
114114
}${flowConfig.feedbackButtonPosition === GleapFeedbackButtonManager.FEEDBACK_BUTTON_CLASSIC_BOTTOM
115115
? "bb-feedback-button-classic--bottom"
116116
: ""
117-
}">${GleapTranslationManager.translateText(
118-
flowConfig.widgetButtonText
119-
)}</div>`;
117+
}">${flowConfig.widgetButtonText}</div>`;
120118
} else {
121119
if (buttonIcon !== this.lastButtonIcon) {
122120
this.feedbackButton.innerHTML = `<div class="bb-feedback-button-icon">${buttonIcon}${loadIcon(

src/GleapMarkerManager.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,18 @@ export default class GleapMarkerManager {
208208
<div class="bb-capture-toolbar-item bb-capture-toolbar-drawingitem" data-type="colorpicker">
209209
<div class="bb-capture-toolbar-item-selectedcolor"></div>
210210
<span class="bb-tooltip">${GleapTranslationManager.translateText(
211-
`Pick a color`
211+
`pickAColor`
212212
)}</span>
213213
</div>
214214
<div class="bb-capture-toolbar-item bb-capture-toolbar-drawingitem bb-capture-toolbar-item-tool" data-type="undo">
215215
${loadIcon("undo")}
216216
<span class="bb-tooltip">${GleapTranslationManager.translateText(
217-
`Undo`
217+
`undo`
218218
)}</span>
219219
</div>
220220
${this.type !== "capture"
221221
? `<div class="bb-capture-button-next">${GleapTranslationManager.translateText(
222-
`Next`
222+
`next`
223223
)}</div>`
224224
: ""
225225
}
@@ -238,10 +238,10 @@ export default class GleapMarkerManager {
238238
<video controls muted autoplay></video>
239239
<div class="bb-capture-preview-buttons">
240240
<div class="bb-capture-preview-retrybutton">${GleapTranslationManager.translateText(
241-
`Retry`
241+
`retry`
242242
)}</div>
243243
<div class="bb-capture-preview-sendbutton">${GleapTranslationManager.translateText(
244-
`Next`
244+
`next`
245245
)}</div>
246246
</div>
247247
</div>
@@ -569,21 +569,21 @@ export default class GleapMarkerManager {
569569
"bb-capture-toolbar-item--inactivecross"
570570
);
571571
audioRecordingTooltip.innerHTML = GleapTranslationManager.translateText(
572-
"Mute"
572+
"mute"
573573
);
574574
} else {
575575
toolbarItem.classList.add(
576576
"bb-capture-toolbar-item--inactivecross"
577577
);
578578
audioRecordingTooltip.innerHTML = GleapTranslationManager.translateText(
579-
"Unmute"
579+
"unmute"
580580
);
581581
}
582582
} else {
583583
toolbarItem.classList.add(itemInactiveClass);
584584
toolbarItem.classList.add("bb-capture-toolbar-item--inactivecross");
585585
audioRecordingTooltip.innerHTML = GleapTranslationManager.translateText(
586-
"Browser not supported"
586+
"browserNotSupported"
587587
);
588588
}
589589
break;
@@ -594,21 +594,21 @@ export default class GleapMarkerManager {
594594
if (this.screenRecorder.isRecording) {
595595
toolbarItem.setAttribute("data-active", "true");
596596
screenRecordingTooltip.innerHTML = GleapTranslationManager.translateText(
597-
"Stop recording"
597+
"stopRecording"
598598
);
599599
timerLabel.style.display = "block";
600600
} else {
601601
toolbarItem.setAttribute("data-active", "false");
602602
screenRecordingTooltip.innerHTML = GleapTranslationManager.translateText(
603-
"Start recording"
603+
"stopRecording"
604604
);
605605
timerLabel.style.display = "none";
606606
}
607607
} else {
608608
// Recording is not available.
609609
toolbarItem.classList.add(itemInactiveClass);
610610
screenRecordingTooltip.innerHTML = GleapTranslationManager.translateText(
611-
"Browser not supported"
611+
"browserNotSupported"
612612
);
613613
}
614614
break;
@@ -643,7 +643,7 @@ export default class GleapMarkerManager {
643643
this.screenRecorder = new GleapScreenRecorder(
644644
this.captureRenderer.bind(this),
645645
GleapTranslationManager.translateText(
646-
"You denied access to screen sharing. Please turn it on in your browser settings."
646+
"accessToScreenSharingDenied"
647647
)
648648
);
649649
}

src/GleapTranslationManager.js

Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { GleapFrameManager, GleapFeedbackButtonManager, GleapSession } from "./Gleap";
1+
import { GleapFrameManager, GleapFeedbackButtonManager, GleapSession, GleapConfigManager } from "./Gleap";
22

33
export default class GleapTranslationManager {
4-
customTranslation = {};
54
overrideLanguage = "";
65
isRTLLayout = false;
76

@@ -28,26 +27,21 @@ export default class GleapTranslationManager {
2827
*/
2928
setOverrideLanguage(language) {
3029
this.overrideLanguage = language;
31-
32-
//GleapFrameManager.getInstance().sendConfigUpdate();
33-
//this.updateRTLSupport();
3430
}
3531

3632
updateRTLSupport() {
3733
// Update RTL support.
38-
this.isRTLLayout = GleapTranslationManager.translateText("rtlLang") === "true";
34+
const flowConfig = GleapConfigManager.getInstance().getFlowConfig();
35+
36+
this.isRTLLayout = false;
37+
if (flowConfig && flowConfig.localizationOptions && flowConfig.localizationOptions.rtl) {
38+
this.isRTLLayout = true;
39+
}
40+
3941
GleapFeedbackButtonManager.getInstance().updateFeedbackButtonState();
4042
GleapFrameManager.getInstance().updateFrameStyle();
4143
}
42-
43-
/**
44-
* Sets the custom translations.
45-
* @param {*} customTranslation
46-
*/
47-
setCustomTranslation(customTranslation) {
48-
this.customTranslation = customTranslation;
49-
}
50-
44+
5145
getActiveLanguage() {
5246
var language = "en";
5347
if (typeof navigator !== "undefined") {
@@ -61,43 +55,15 @@ export default class GleapTranslationManager {
6155
}
6256

6357
static translateText(key) {
64-
return key;
65-
6658
if (!key) {
6759
return "";
6860
}
6961

70-
const instance = GleapTranslationManager.getInstance();
71-
72-
var language = instance.getActiveLanguage();
73-
74-
const searchForTranslationTable = (langKey) => {
75-
var customTranslation = null;
76-
const translationKeys = Object.keys(instance.customTranslation);
77-
for (var i = 0; i < translationKeys.length; i++) {
78-
const translationKey = translationKeys[i];
79-
if (langKey && translationKey && langKey === translationKey.toLowerCase()) {
80-
if (instance.customTranslation[translationKey]) {
81-
customTranslation = instance.customTranslation[translationKey];
82-
}
83-
}
84-
}
85-
86-
return customTranslation;
87-
}
88-
89-
var customTranslation = searchForTranslationTable(language);
90-
91-
// Extended search for language match only.
92-
if (!customTranslation && language) {
93-
const langKeys = language.split("-");
94-
if (langKeys && langKeys.length > 1) {
95-
customTranslation = searchForTranslationTable(langKeys[0]);
96-
}
97-
}
62+
const flowConfig = GleapConfigManager.getInstance().getFlowConfig();
63+
const staticTranslation = flowConfig.staticTranslations;
9864

99-
if (customTranslation && customTranslation[key]) {
100-
return customTranslation[key];
65+
if (staticTranslation && staticTranslation[key]) {
66+
return staticTranslation[key];
10167
}
10268

10369
return key;

0 commit comments

Comments
 (0)