fix(i18n): improve null handling in interpolation
This commit is contained in:
@@ -35,7 +35,8 @@ export class I18n {
|
|||||||
|
|
||||||
private interpolate(template: string, params: TranslationParams): string {
|
private interpolate(template: string, params: TranslationParams): string {
|
||||||
return template.replace(/\{\{(\w+)\}\}/g, (match, key) => {
|
return template.replace(/\{\{(\w+)\}\}/g, (match, key) => {
|
||||||
return params[key]?.toString() || match
|
// Use != null to check for both null and undefined, allow empty strings
|
||||||
|
return params[key] != null ? params[key].toString() : match
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -426,10 +426,7 @@ export class Panel {
|
|||||||
#updateHistory(): void {
|
#updateHistory(): void {
|
||||||
const steps = this.#state.getAllSteps()
|
const steps = this.#state.getAllSteps()
|
||||||
|
|
||||||
this.#historySection.innerHTML = steps
|
this.#historySection.innerHTML = steps.map((step) => this.#createHistoryItem(step)).join('')
|
||||||
.slice(-10) // Only show last 10 items
|
|
||||||
.map((step) => this.#createHistoryItem(step))
|
|
||||||
.join('')
|
|
||||||
|
|
||||||
// Scroll to bottom to show latest records
|
// Scroll to bottom to show latest records
|
||||||
this.#scrollToBottom()
|
this.#scrollToBottom()
|
||||||
@@ -491,7 +488,7 @@ export class Panel {
|
|||||||
const stepLabel = this.#pageAgent.i18n.t('ui.panel.step', {
|
const stepLabel = this.#pageAgent.i18n.t('ui.panel.step', {
|
||||||
number: step.stepNumber.toString(),
|
number: step.stepNumber.toString(),
|
||||||
time,
|
time,
|
||||||
duration: durationText,
|
duration: durationText || '', // Explicitly pass empty string to replace template
|
||||||
})
|
})
|
||||||
|
|
||||||
return `
|
return `
|
||||||
|
|||||||
Reference in New Issue
Block a user