Skip to content

Conversation

@HDinger
Copy link
Contributor

@HDinger HDinger commented Jan 5, 2026

Ticket

https://community.openproject.org/wp/69972

What are you trying to accomplish?

Omit the word "project" from the widget titles since they also apply for programs and portfolios

@HDinger HDinger added this to the 17.0.x milestone Jan 5, 2026

def title
Project.human_attribute_name(:status_code)
I18n.t("attributes.status")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
I18n.t("attributes.status")
Project.human_attribute_name(:status)

does the same thing, but will also error if the translation is missing for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit of using that over the I18n variant?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the same thing, but will also error if the translation is missing for some reason.

Sorry! My earlier statement was inaccurate.

I18n.t("attributes.status") will also raise an error if I18n is configured to do so (for example, in test mode).

That said, model_name.human_attribute_name(:attribute) is still preferable, in my opinion, because it applies intelligent fallback resolution. Specifically, it resolves translations in the following order:

- en.activerecord.attributes.project.status
- en.attributes.status
- en.activerecord.models.status

This means it will fall back to the global status translation by default, while still allowing model-specific overrides. For example, if we later decide that “status” in the context of Project should be renamed to something more specific (e.g., “state” or “condition”), this approach supports that cleanly without affecting other models.

Copy link
Contributor

@myabc myabc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your changes work just fine. However I'm not sure we need to override widgetName in this way.

I started working on this before the Christmas break but stopped because of another blocking issue (OP # 69921 - now fixed).

I would suggest we just update the title in the translations (js-en.yml):

Image

This would of course also update the text in the "Add widget" dialog, but I think that's probably ok (and perhaps even desirable)?

Image

I guess could also define a separate name translation for widgets.service.ts, but I don't 100% understand its purpose

Image

}

public get widgetName() {
return this.i18n.t('js.label_description');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's important to use translations rather than generic translations. A hypothetical example: although description might usually translate to "Beschreibung" in German, in the context of a Project / Project Widget, we might prefer to use the terms "Bezeichnung" or "Langtext".

This is the same reasoning human_attribute_name is preferable. https://github.com/opf/openproject/pull/21539/changes#r2664928430

Hope that makes sense!

@myabc
Copy link
Contributor

myabc commented Jan 6, 2026

FYI, #21555 touches the same code - we may want to hold off for that PR to be merged.

@HDinger HDinger force-pushed the bug/69972-inconsistent-widget-name-for-project-description-widget-on-project-home-page branch from efd51e5 to 107d2cf Compare January 7, 2026 09:44
@HDinger HDinger requested a review from myabc January 7, 2026 09:44
Copy link
Contributor

@myabc myabc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@myabc myabc merged commit a4fa05c into release/17.0 Jan 8, 2026
17 checks passed
@myabc myabc deleted the bug/69972-inconsistent-widget-name-for-project-description-widget-on-project-home-page branch January 8, 2026 08:48
@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

3 participants