Skip to content

feat: role based translations - #1649

Merged
Scott-James-Hurley merged 13 commits into
developfrom
1519_dynamic_translations
Sep 2, 2026
Merged

feat: role based translations#1649
Scott-James-Hurley merged 13 commits into
developfrom
1519_dynamic_translations

Conversation

@Scott-James-Hurley

Copy link
Copy Markdown
Contributor

Ref: UserOfficeProject/issue-tracker#1519

Motivation

Another facility at STFC would like to use the Xpress functionality but need uses of the term "technique" to be changed to "facility". ISIS would like to retain the use of the term "technique", so a way to change translations for different users is needed.

How It Works

The first tag associated with the user's current role (we're assuming the role only has one tag) is used to determine what translation to use for the term "technique". A nested object in the translation file with the same name as the tag allows the correct translation to be used.

For example, given tag,name = CLF

and the following in translation.json:

"CLF": {
    "Technique": "Facility"
}

The term "Technique" will be translated to "Facility"

This PR introduces a new environment variable to point to the translation file in the backend. If it's not set, it could cause the "Technique" column header in the technique proposals export to appear incorrectly.

How Has This Been Tested

Tested manually

Changes

  • Adds i18n to backend
  • Adds tags associated with roles in user context
  • Translation added for "Technique" header name for technique proposals spreadsheet export
  • Translation added for instances of "Technique" on technique proposals page

@Scott-James-Hurley Scott-James-Hurley added enhancement New feature or request review: please breaking:change A change that could disrupt external dependencies labels Jul 16, 2026
@Scott-James-Hurley
Scott-James-Hurley marked this pull request as ready for review July 17, 2026 12:27
@Scott-James-Hurley
Scott-James-Hurley requested a review from a team as a code owner July 17, 2026 12:27
@Scott-James-Hurley
Scott-James-Hurley requested review from ACLay and removed request for a team July 17, 2026 12:27
Comment thread apps/frontend/src/components/common/proposalFilters/TechniqueFilter.tsx Outdated
Comment thread apps/backend/src/models/Role.ts
const techniquesColumns = () => [
{
title: 'Technique',
title: i18n.t(`${currentRoleFirstTagName}.Technique`),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The i18n call in TechniqueFilter.tsx was changed to not have the . after Jekab's review, but it's still here in this use.

@Scott-James-Hurley
Scott-James-Hurley merged commit 163d1f6 into develop Sep 2, 2026
26 checks passed
@Scott-James-Hurley
Scott-James-Hurley deleted the 1519_dynamic_translations branch September 2, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking:change A change that could disrupt external dependencies enhancement New feature or request review: please

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants