Skip to content

Commit ee65c7f

Browse files
author
Sebi Nemeth
committed
fix this reference
1 parent fa23956 commit ee65c7f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

dist/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,14 @@ class LiveTranslatorManager {
139139
document.body.appendChild(this._enableButton);
140140
// initialize encode
141141
const originalFormatter = this._options.i18n.formatter;
142+
const self = this;
142143
this._options.i18n.formatter = {
143144
interpolate(message, values, path) {
144145
const meta = ZeroWidthEncoder.encode(JSON.stringify({
145146
message,
146147
values,
147148
path,
148-
locale: this._options.i18n.locale,
149+
locale: self._options.i18n.locale,
149150
}));
150151
const original = originalFormatter.interpolate(message, values, path);
151152
return (original && this._enabled) ? [meta, ...original] : original;

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,15 @@ class LiveTranslatorManager {
162162

163163
// initialize encode
164164
const originalFormatter = this._options.i18n.formatter
165+
const self = this
165166
this._options.i18n.formatter = {
166167
interpolate (message, values, path) {
167168
const meta = ZeroWidthEncoder.encode(
168169
JSON.stringify({
169170
message,
170171
values,
171172
path,
172-
locale: this._options.i18n.locale,
173+
locale: self._options.i18n.locale,
173174
}),
174175
)
175176
const original = originalFormatter.interpolate(message, values, path) as unknown[] | null

0 commit comments

Comments
 (0)