Skip to content

Introduce i18n API for the frontend#631

Merged
timja merged 21 commits intojenkinsci:mainfrom
lewisbirks:fix-internationalisation-of-timing
Apr 23, 2025
Merged

Introduce i18n API for the frontend#631
timja merged 21 commits intojenkinsci:mainfrom
lewisbirks:fix-internationalisation-of-timing

Conversation

@lewisbirks
Copy link
Contributor

@lewisbirks lewisbirks commented Apr 19, 2025

Introduce an API to get the internationalised messages to be called and used within the TS frontend. The frontend handles the formatting using the messageformat library, however there is a difference between how it manages plurality. The Java MessageFormat class uses a choice keyword whereas the JS library uses they keyword plurality and has a different parsing logic so I've tried to replicate Java's implementation here as a custom format.

Fixes #630

Testing done

Changed browser language to Polish

Before

image

After

image

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@lewisbirks
Copy link
Contributor Author

If there are any other suggestions on approach I would be happy to pivot to that

@janfaracik
Copy link
Member

janfaracik commented Apr 19, 2025

Signed-off-by: lewisbirks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: lewisbirks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: lewisbirks <22620804+lewisbirks@users.noreply.github.com>
Comment on lines +13 to +19
const YEAR = "Util.year";
const MONTH = "Util.month";
const HOURS = "Util.hour";
const DAY = "Util.day";
const MINUTE = "Util.minute";
const SECOND = "Util.second";
const MILLIS = "Util.millisecond";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should these become predefined types?

Signed-off-by: lewisbirks <22620804+lewisbirks@users.noreply.github.com>
@lewisbirks lewisbirks marked this pull request as ready for review April 23, 2025 13:05
@lewisbirks lewisbirks requested a review from a team as a code owner April 23, 2025 13:05
@timja timja added the enhancement New feature or request label Apr 23, 2025
@timja timja enabled auto-merge (squash) April 23, 2025 16:01
@timja timja merged commit 4471731 into jenkinsci:main Apr 23, 2025
15 checks passed
@lewisbirks lewisbirks deleted the fix-internationalisation-of-timing branch April 24, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in internationalised timings

3 participants