-
Notifications
You must be signed in to change notification settings - Fork 438
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
Allow retrieval from languageHashes using environment in order to side-load i18n assets without rebuilding the application #2703
base: main
Are you sure you want to change the base?
Conversation
c581ccc
to
fb22f7d
Compare
fb22f7d
to
2e76ba3
Compare
Hi @mahnkong, |
This seems to be a custom use case for your institution. I'm not convinced this should be part of the community codebase. Hashes in the environment file that need to be updated by hand seem to be something that can cause unnecessary confusion: if users think they need to set them, and forget to update them after a rebuild it will break And requiring a rebuild to have hashes automatically generated as they are now, doesn't seem like a big issue for most institutions. What do you think @tdonohue? |
It depends, I think. Updating them by hand of course may lead to confusion. That's why we automate all these steps and hat do modify the dspace-angular application in order to support the use case. Having the opportunity to maintain the language files outside of the dspace-angular project and beeing able to generate the language files using userfriendly tooling nevertheless may be a use case which may be a valid one for other institutions, too. |
@mahnkong : I agree with @artlowel at this point that I don't feel this change is the correct direction for DSpace at this time. You are correct that it would be nice if sites could update language files without rebuilding the application. This is something many sites would likely agree with. However, the approach taken in this PR seems like it may not be the "best practice" to achieving this goal. This implementation is simple, but could involve a lot of unnecessary confusion. Any sites that use it will encounter errors in the application if they forget to update the Overall, there are pros/cons to both approaches:
Overall, I feel that I have a slight preference for DSpace's existing approach as it's more "stable" and less likely to result in human error. It's possible this could change over time if we find other sites need your solution or have found ways to better automate it to avoid human error. Moving this off the 8.0 board for now. Additional discussion is still welcome & I'll keep this PR open for now. Waiting on feedback from others that this is something they need. |
c81e7db
to
83d4e0a
Compare
I made a change to the |
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.
@mahnkong thanks for the effort, but it doesn't seem to work for me
If I set the DYNAMIC_LANGUAGE_HASHES
env var to true, start the server and then change the language files. I get errors such as
ERROR Error: Uncaught (in promise): Error: ENOENT: no such file or directory, open 'dist/server/assets/i18n/en.1bdafd1af91adc3f1d61bda29057afa9.json'
Where 1bdafd1af91adc3f1d61bda29057afa9
refers to the previous hash
Even restarting the server doesn't seem to fix that.
But ultimately, even you got this change to work, I'm not convinced it belongs in the dspace code base. We can't expect people to manually determine the hash, generate br and gz files, put them in both the browser and server folders etc.
All of that is something that would need to be scripted. As a matter of fact It is already scripted, by webpack. That's why it requires a rebuild. I'm not convinced it's worth maintaining an alternative to that.
Hi @artlowel, please see comments below:
The env var should be
Exactly this generation of hash, br and gz files is scripted at our end, based on the contents of a CSV file maintained by non - IT personal. And this is the key benefit we have using this approach. But if there is no benefit for others I'm fine with that. |
Hi @mahnkong, |
e40b59c
to
a763fe4
Compare
Hi @mahnkong, |
Hi @artlowel , is there anything you expect me to change? (the PR still has changes requested, but we could solve the issue you had in the conversation) |
No. Code wise it's fine. I'll bring it up in today's developer meeting to see if we want to include it in the codebase |
@mahnkong : We discussed this PR in our Developers Meeting today. Overall, developers agree with the general idea that it'd be nice to be able to "side-load" (or update without a rebuild) these i18n files again. However, there's some concern about whether this PR is the right approach as it requires either external scripts or manual updates. Therefore, I'm pressing "pause" on this PR as we feel it needs more feedback. The approach you've taken seems to work, but it also seems to require scripts that are specific to your institution in order to fully "automate it". Any other institution would need to have a similar process built or would need to do these updates more manually. I've assigned some other developers to take a look at this when they get the chance. For now, this is |
@tdonohue thanks, the process you mentioned sounds good to me. |
Hi @mahnkong, |
08559f3
to
8d686be
Compare
8d686be
to
cf9c1b3
Compare
References
Description
The code inside the angular application was changed to also consider the
environment
for obtaining the languageHashes instead of only considering theprocess.env.languageHash
variable prepared by webpack.The "languageHashes" environment key is populated by the
buildAppConfig
method ofconfig.server.ts
, but only if the angular server process has the environment variableDSPACE_DYNAMIC_LANGUAGE_HASHES
set and it's value is set to betrue
Instructions for Reviewers
Create a i18n asset folders to be mounted to the appropiate location inside the dspace-angular container:
example for server:
example for browser/
Create volume mount:
Configure server application's environment:
When loading the application, the side-loaded language files are fetched by the client.
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
yarn lint
yarn check-circ-deps
)package.json
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.