clean logs

This commit is contained in:
Mehdi Benadel 2024-05-25 14:41:29 +02:00
parent 854bb8fb27
commit 7c9e869e96

View File

@ -37,7 +37,6 @@ export class TranslationDirective extends AsyncDirective {
.pipe(map(registerClientOptions => registerClientOptions.peertubeHelpers)) .pipe(map(registerClientOptions => registerClientOptions.peertubeHelpers))
.subscribe((registerClientHelpers: RegisterClientHelpers) => { .subscribe((registerClientHelpers: RegisterClientHelpers) => {
this._peertubeHelpers = registerClientHelpers this._peertubeHelpers = registerClientHelpers
console.log(`we got PeertubeHelpers ! ${JSON.stringify(registerClientHelpers)}`)
this._asyncUpdateTranslation().then(() => {}, () => {}) this._asyncUpdateTranslation().then(() => {}, () => {})
}) })
} }
@ -51,22 +50,18 @@ export class TranslationDirective extends AsyncDirective {
this._translatedValue = locId this._translatedValue = locId
} }
console.log('rendering')
this._asyncUpdateTranslation().then(() => {}, () => {}) this._asyncUpdateTranslation().then(() => {}, () => {})
return this._internalRender() return this._internalRender()
} }
private readonly _internalRender = (): unknown => { private readonly _internalRender = (): unknown => {
console.log(`internalRender ${this._translatedValue}`)
return this._allowUnsafeHTML ? html`${unsafeHTML(this._translatedValue)}` : this._translatedValue return this._allowUnsafeHTML ? html`${unsafeHTML(this._translatedValue)}` : this._translatedValue
} }
private readonly _asyncUpdateTranslation = async (): Promise<true> => { private readonly _asyncUpdateTranslation = async (): Promise<true> => {
const newValue = await this._peertubeHelpers?.translate(this._localizationId) ?? '' const newValue = await this._peertubeHelpers?.translate(this._localizationId) ?? ''
console.log(`asyncUpdateTranslation ${newValue}`)
if (newValue !== '' && newValue !== this._translatedValue) { if (newValue !== '' && newValue !== this._translatedValue) {
this._translatedValue = newValue this._translatedValue = newValue
this.setValue(this._internalRender()) this.setValue(this._internalRender())