-
Notifications
You must be signed in to change notification settings - Fork 512
Enhance FileSizePipe to support localization #5055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| transform(bytes: number = 0, precision: number = 2): string { | ||
| return filesize(bytes, { standard: 'jedec', round: precision }); | ||
| return fileSize(bytes, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should stay with JEDEC (e.g., 1 MB = 1024 KB) or SI (e.g., 1 MB = 1000 KB). Even though I'm personally all for JEDEC, I believe most people in the world are familiar with the SI and expect SI units
Or maybe it should be moved to the configuration, so users could decide by themselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MMilosz , could you please create a new issue for this aspect.
|
@saschaszott : This PR looks to be invalid, as it contains a large number of unrelated commits. Did you maybe submit this to the wrong branch? (I see the branch you are submitting against is set to |
|
@tdonohue , I originally implemented the extension of the FileSizePipe for DSpace CRIS 2024.02.03, which is based on DSpace 8.2. It took a few iterations to make it work with DSpace 10 as well. It should be working now. If we want to backport this change to older DSpace versions, the code will need to be adapted. |
|
I unfortunately have to pause at this point, as I currently don’t have a DSpace 10 development instance available. There seems to be an issue with the dependency injection of |
|
I have now set up a local DSpace Angular 10 test instance and applied the change there. In Chrome, I don’t see any error messages, and the desired result (localized display of the file size) is also visible. Therefore, the build error must have other causes. |
|
I think I have found the cause: the |
|
@tdonohue , the PR is now finished; all spec tests are passing again. Should I create a new PR with one or two commits containing all changes, or will you squash all commits when merging? Also, there is currently a general issue with running the E2E tests on GitHub (see my question on Slack). |
|
@saschaszott : If you have a chance, I'd prefer you squash the commits yourself in this PR. This is possible to do by just doing a rebase on the branch this PR is based on (to squash the commits however you like) and do a "force push" to update the branch in this PR. That preferable just because I sometimes forget to squash PRs when merging them. |
528e6bf to
d6af4ad
Compare
|
@tdonohue , this PR is ready for review! |
tdonohue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks @saschaszott ! The code looks good and I also gave it a test. Works well. Because this is a tiny change and relates to i18n, I'm going to attempt to auto-backport this to 9.x as well.
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-9_x
git worktree add -d .worktree/backport-5055-to-dspace-9_x origin/dspace-9_x
cd .worktree/backport-5055-to-dspace-9_x
git switch --create backport-5055-to-dspace-9_x
git cherry-pick -x d6af4addca63e3c3620d04f0b1cdcf94865ecb52 |
|
The backport failed. If someone has an interest in backporting this to 9.x, I think we could consider this a "bug fix" to i18n. (I wasn't planning to backport it further though because this area of the code is not quite the same in older releases) |
|
@tdonohue , I can create a backport of this PR for DSpace version 7–9. Should I open a new PR for that? |
|
@saschaszott : Yes, please open a new PR for backporting this to earlier versions. At a minimum, it'd be nice to backport this to 9.x. But, if we can backport it further, that's fine with me. |




Fixes #5054 .