Skip to content

front : fix added missing translation keys to sdd DetailsBox - #18094

Open
BabuBahir wants to merge 1 commit into
OpenRailAssociation:devfrom
BabuBahir:fix/sdd-reticle-translations
Open

front : fix added missing translation keys to sdd DetailsBox#18094
BabuBahir wants to merge 1 commit into
OpenRailAssociation:devfrom
BabuBahir:fix/sdd-reticle-translations

Conversation

@BabuBahir

@BabuBahir BabuBahir commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

WHAT
Fixes #14931

How
Keys were added to speedDistanceSettings .json for the Details Box in SDD

So now the translation Appears

Reulst
image

Formatted

Caution :

There already exists a key simulationResults.electricalProfiles.incompatible . I added a simulationResults.speedDistanceSettings.incompatible . So does this makes simulationResults.electricalProfiles.incompatible redundant . Was this key intentionally added ?

@BabuBahir
BabuBahir requested a review from a team as a code owner August 11, 2026 21:33
@github-actions github-actions Bot added area:front Work on Standard OSRD Interface modules area:ui Work on UI labels Aug 11, 2026
@BabuBahir

Copy link
Copy Markdown
Contributor Author

@theocrsb would you like to have a first look at the PR :)

@BabuBahir

Copy link
Copy Markdown
Contributor Author

/review @SharglutDev

@theocrsb theocrsb left a comment

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.

Thanks for the PR

Comment thread front/public/locales/fr/operational-studies.json Outdated
@theocrsb

Copy link
Copy Markdown
Contributor

After correcting the translation, everything LGTM :)

@BabuBahir
BabuBahir force-pushed the fix/sdd-reticle-translations branch from 69b7fde to ba2d511 Compare August 13, 2026 06:24
@BabuBahir
BabuBahir requested a review from theocrsb August 13, 2026 06:25

@theocrsb theocrsb left a comment

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.

Tested

@SharglutDev SharglutDev left a comment

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.

Thank you for the contribution ! Left some comments

Comment thread start-front.ps1 Outdated
"speedDistanceDiagram": "GEV",
"speedDistanceSettings": {
"accelerating": "En accélération",
"coasting": "En roue libre",

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.

Haha this is indeed the literal translation but definitely not the one we want to use.
This is also a french expression meaning something like : "ffa" / "doing crazy things".

The business term for that is "Marche sur l'erre"

"speedDistanceDiagram": "GSD",
"speedDistanceSettings": {
"accelerating": "Beschleunigung",
"coasting": "Ausrollen",

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.

Business says this is more accurate

Suggested change
"coasting": "Ausrollen",
"coasting": "Auslauf",

Comment on lines +72 to +82
const reticleValues = translations?.detailsBoxDisplay.reticleValues;
const translatedModeText =
modeText === '--'
? modeText
: (reticleValues?.[modeText as keyof typeof reticleValues] ?? modeText);
const translatedEffortText =
reticleValues?.[effortText as keyof typeof reticleValues] ?? effortText;
const translatedElectricalProfileText =
electricalProfileText === 'incompatible'
? (reticleValues?.incompatible ?? electricalProfileText)
: electricalProfileText;

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.

This doesn't look very clean since we compute first the text and replace it some times with the translations.

Maybe it would be better if we could pass translations directly in drawCursor to use them over there to compute the text. Do you think it's acceptable for osrd-ui @emersion ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK as in movieng out the null/Undefined checking to the parent ,

or how about

const reticleValues = translations?.detailsBoxDisplay.reticleValues as Record<string, string> | undefined;

const translatedModeText = reticleValues?.[modeText] ?? modeText;
const translatedEffortText = reticleValues?.[effortText] ?? effortText;
const translatedElectricalProfileText = reticleValues?.[electricalProfileText] ?? electricalProfileText; 

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.

I get the point about compute-then-replace, but I'm not sure passing translations down to drawCursor is the right move : it's a canvas drawing function running on every mousemove, and we'd have to thread translations through DrawFunctionParams, which is shared with all the other draw* functions.

To me the actual issue is that modeText and effortText are typed as plain string in TrainDetails. That's what forces the as keyof typeof reticleValues cast. If we type them as unions instead :

export type ReticleMode = 'electric' | '--';
export type ReticleEffort = 'coasting' | 'accelerating' | 'decelerating';

the lookup gets simple, no cast and no '--' special case :

const reticleValues = translations?.detailsBoxDisplay.reticleValues;
const translatedEffortText = reticleValues?.[effortText] ?? effortText;
...

What do you think ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

can we have a look @kmer2016 @SharglutDev

@BabuBahir
BabuBahir force-pushed the fix/sdd-reticle-translations branch from 618e3c0 to e71771d Compare August 13, 2026 17:14
@BabuBahir
BabuBahir requested a review from a team as a code owner August 13, 2026 17:14
@github-actions github-actions Bot added the area:editoast Work on Editoast Service label Aug 13, 2026
@BabuBahir
BabuBahir force-pushed the fix/sdd-reticle-translations branch from e71771d to e6c3d7a Compare August 13, 2026 17:16
@github-actions github-actions Bot removed the area:editoast Work on Editoast Service label Aug 13, 2026
@theocrsb
theocrsb requested a review from kmer2016 August 17, 2026 06:31
@BabuBahir
BabuBahir force-pushed the fix/sdd-reticle-translations branch from e6c3d7a to 1942bef Compare August 25, 2026 16:42
@github-actions github-actions Bot added the area:editoast Work on Editoast Service label Aug 25, 2026

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.

I believe the changes on this file is a mistake.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am seeing a lot of file changes which I feel wasn't done ...

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.

Github shows the file changed, but if I ignore the whitespace, it looks like no line has changed, and yet, the file is shown. I wonder if you (by mistake), didn’t change the permissions of the file (read/write/executable also known as rwx)? Anyway, if you’re sure no useful change has been done on this file, a git restore <the file> should help.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed now

@BabuBahir
BabuBahir marked this pull request as draft September 2, 2026 12:43
@BabuBahir
BabuBahir force-pushed the fix/sdd-reticle-translations branch from dd93b75 to 7b3a884 Compare September 7, 2026 16:05
@github-actions github-actions Bot removed the area:editoast Work on Editoast Service label Sep 7, 2026
@BabuBahir
BabuBahir marked this pull request as ready for review September 7, 2026 16:42
@BabuBahir
BabuBahir force-pushed the fix/sdd-reticle-translations branch from 7ed5204 to abc0b2f Compare September 7, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:front Work on Standard OSRD Interface modules area:ui Work on UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing translation for SDD reticular

5 participants