Skip to content

using translated string for displaying role#1291

Merged
tmorrell merged 1 commit intoinveniosoftware:masterfrom
Ducica:hardcoded-role-display-fix
Jun 10, 2025
Merged

using translated string for displaying role#1291
tmorrell merged 1 commit intoinveniosoftware:masterfrom
Ducica:hardcoded-role-display-fix

Conversation

@Ducica
Copy link
Contributor

@Ducica Ducica commented Apr 4, 2025

❤️ Thank you for your contribution!

Description

There is an issue here that role is hardcoded in the members result list item


image

Therefore, it is not possible to really change the content + not possible to localize.

This PR introduces a fix where we just additionally pass all roles to the ResultListItem and then we find the appropriate role's title. The users can configure the content of the text from invenio.cfg by using COMMUNITIES_ROLES variable.

Copy link
Contributor

@tmorrell tmorrell left a comment

Choose a reason for hiding this comment

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

Thanks! Seems sensible to me, but it will need another review to get merged.

@tmorrell tmorrell added this to v14 Apr 4, 2025
@tmorrell tmorrell moved this to 👀 In review in v14 Apr 4, 2025
@Ducica
Copy link
Contributor Author

Ducica commented Apr 6, 2025

Thanks! Seems sensible to me, but it will need another review to get merged.

Thanks Tom

label={i18next.t("Role") + " " + result.role}
/>
) : (
config?.allRoles?.find((role) => role.name === result.role)?.title ||
Copy link
Contributor

Choose a reason for hiding this comment

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

could we move config?.allRoles?.find((role) => role.name === result.role)?.title || _upperFirst(result.role) before of the return statement. it is hard to read when this things are calculated directly within the jsx part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@utnapischtim Thanks, I made the requested change + I wrapped some strings used in UI in i18next. Hope that is OK. Please let me know.

@Ducica Ducica force-pushed the hardcoded-role-display-fix branch from afd2b0f to 44b5908 Compare May 14, 2025 09:27
@tmorrell tmorrell merged commit 52f5463 into inveniosoftware:master Jun 10, 2025
3 checks passed
@tmorrell
Copy link
Contributor

All comments have been resolved, seems like an improvement we want in before v13 so merging.

@github-project-automation github-project-automation bot moved this from 👀 In review to To release 🤖 in v14 Jun 10, 2025
@Ducica
Copy link
Contributor Author

Ducica commented Jun 10, 2025

@tmorrell Thank you very much!

@utnapischtim utnapischtim moved this from To release 🤖 to Released ✔ in v14 Jul 3, 2025
@utnapischtim utnapischtim removed this from v14 Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants