Skip to content

Task Properties dialog: raw i18n keys and $Resources tab title #2800

@mspinolaeie

Description

@mspinolaeie

Summary

Two related i18n issues in the Task Properties dialog introduced with the new JavaFX properties panel.


Bug 1 — Field labels shown as raw translation keys

File: ganttproject/src/main/java/net/sourceforge/ganttproject/gui/taskproperties/MainPropertiesPanel.kt

All field labels in the General tab display as raw keys (name.label, startDate.label, progress.label, etc.) instead of the localized strings ("Name", "Begin date", "Progress", …).

Root cause

The private val i18n at the bottom of the file builds a 4-step fallback chain, but master only has 3 steps:

Step Looks up Result for e.g. name.label
1 option.taskProperties.main.name.label in current locale ❌ key not in translation file
2 name (legacy transform) in current locale ❌ may not resolve
3 option.taskProperties.main.name.label in RootLocalizer ❌ key not in file
4 (missing) name (legacy transform) in RootLocalizer ✅ "Name" found

Step 4 is absent. Because RootLocalizer is a DefaultLocalizer backed by the Eclipsito translation registry (which loads i18n.properties from the classpath), RootLocalizer.formatTextOrNull("name") always resolves to "Name" (English). Without step 4, field labels fall through all steps unresolved and are rendered as-is.

Note: section titles (section.main, section.view, section.documents) already have structured keys in i18n.properties, so they resolve at step 1 and are unaffected.

Fix

Add the missing fallback step to the chain in MainPropertiesPanel.kt:

private val i18n = i18n {
  default(withFallback = false)
  prefix("option.taskProperties.main") {
    default(withFallback = false)
    transform(legacyKeyTransform)
    fallback {
      default()
      prefix("option.taskProperties.main")
      fallback {
        // NEW: fall back to English legacy key via RootLocalizer
        default()
        transform(legacyKeyTransform)
      }
    }
  }
}

Bug 2 — Resources tab title shows $Resources

File: ganttproject/src/main/java/net/sourceforge/ganttproject/gui/taskproperties/TaskResourcesPanel.kt

The Resources tab in the Task Properties dialog shows $Resources (or $Risorse in Italian) instead of the plain string.

Root cause

// line 105 — master
val title: String = i18n.formatText("human")

The translation key human has value $Resources (EN) / $Risorse (IT) — the $ is a legacy Swing mnemonic marker, historically stripped by GanttLanguage.correctLabel(). The new JavaFX code calls RootLocalizer.formatText() directly, bypassing that stripping.

Fix

val title: String = i18n.formatText("human").removeMnemonicsPlaceholder()

removeMnemonicsPlaceholder() is already defined in Internationalization.kt.


Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions