-
Notifications
You must be signed in to change notification settings - Fork 500
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
5202 - Internationalization for breadcrumbs , alert messages #5299
Conversation
@@ -6,7 +6,7 @@ | |||
xmlns:p="http://primefaces.org/ui" | |||
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" | |||
xmlns:jsf="http://xmlns.jcp.org/jsf"> | |||
|
|||
<f:view locale="#{dataverseLocaleBean.localeCode}"> |
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.
When researching this approach (http://jdevelopment.nl/internationalization-jsf-utf8-encoded-properties-files/) it appears that the html
tag has the lang
attribute using the same dynamic value. Our xhtml pgs do not have this attribute, but instead it is found on the dataverse_template.xhtml
file. This PR should also review the use of this attribute and what is best moving forward. Will review with @scolapasta for a more detailed recommendation.
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.
While reviewing the use of lang
in the dataverse_template.xhtml
, we should also look at the meta element http-equiv="Content-Language" content="en"
. According to the W3C this should no longer be used in HTML5 (https://www.w3.org/International/questions/qa-html-language-declarations).
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.
After a quick test locally, it appears that the lang
html attribute is required in the dataverses_template.xhtml
file, because it does not get passed to the browser source code if it defined on the individual xhtml pgs like this ThemeAndWidgets.xhtml
pg.
@JayanthyChengan, Thank you for your efforts in delivering this functionality. Sorry for the delay in getting you more concrete feedback, but I have been reviewing your PR changes with @scolapasta and learning more about the Gustavo and I agree with your approach of applying the Here is our list of to-do's based on our code review.
Also, with the
|
Thanks @mheppler and @scolapasta . I will do the changes and submit it. |
…ding to language selection
@mheppler I have done the changes as mentioned above. Please review the code. Also note that I haven't added <f:view in dataverse.xhtml, since it results in below error: |
@JayanthyChengan thank you for the updates. I've got two items for you. First, we need both the
Second, hopefully we can find a solution to add the Reviewing this issue with @scolapasta, we didn't hit on any solid feedback to give you. Gustavo suspected it to could with the location of the I did some digging on StackOverflow, and this suggestion by BalusC might shed some light on our problem. Good luck. |
@mheppler Thanks for the review and stackOverflow link. I have done the changes, please review the code. |
@JayanthyChengan thank you for your latest revisions. I see that the Also, it appears that an unexpected result of the changes to the If you have any ideas or questions, hopefully @scolapasta can better guide from this point on. We've long since past the limits of my JSF know-how. |
OK, so I did some more digging and have some info that could help: I tried first to see why the info message on the dataverse page does not translate. I think I know why. If you look at the info message on the Dataset page, it calls: JH.addMessage(FacesMessage.SEVERITY_INFO, JH.localize("dataset.message.editMetadata")); while the DataversePage calls: FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, BundleUtil.getStringFromBundle("dataverse.edit.msg") , BundleUtil.getStringFromBundle("dataverse.edit.detailmsg"))); Notice how Dataset is using JH.localize. That said, if you look at the JSFHelper class, this localize message is deprecated:
So, we can solve the Dataverse page issue using this method (I think), BUT we really should be finding a different solution verall, using the more flexible BundleUtil methods. I also wonder if we changed the code to use these BundleUtil messages (which is what the none messages code already does), if we could then go back to just having the jsf:view on the template, and not every single page. @JayanthyChengan would you be able to experiment with this? Please let me know if you need more guidance on what to try and I can help figure it out. |
Since the URL(http://localhost:8080/dataset.xhtml?persistentId=doi:10.5072/FK2/NS8XGA) remains same in both viewing dataset and editing dataset, so, when the language toggle is changed, it's reloading the page to viewing mode, how to handle this behaviour? |
… bundle from DataversePage.java [ref IQSS#5202]
@JayanthyChengan thank you for catching that msg was originating from the With that said, we can scratch item 3 from your list above, as my mistake. @scolapasta is going to provide some feedback for item 2. That leaves item 1, which I have fixed for you! You should see that I have created a new branch with the changes to the dataverse pg, and sent a pull request to your branch. I was able to remove the text from the javascript, and changed the dataverse pg to instead receive the msg from the bundle via the One suggestion that I will make about the French bundle is that now there are two hyphens and no trailing period on the last sentence. I didn't want to edit the bundle myself, but instead thought a note here would be more appropriate. Let me know if you have any questions. I have also made a comment regarding the changes in the issue for javascript Internationalization #4679. (Also added a reference to a fix for a few of the other text+javascript examples in your comment!) |
@mheppler Thanks for the detailed explanation and pull request. I will take care of french bundle file. |
5202 Changed display of edit dataverse pg info msg to bundle
@JayanthyChengan I would make the changes to not use localize in this PR. Since that helper is used only for messages (I'm pretty sure this is true) and that what's this issue is for, it makes sense to me to do this fully the first time. I also think that this may allow for the jsf:view to only be on the template* and would appreciate if you could experiment some with that to get it to work.
|
@scolapasta
src/main/webapp/dataverse_template.xhtml But I don't see the language toggle in the messages and breadcrumbs , for example in dataverseuser.xhtml After adding <f:view to dataverseuser.xhtml page, the messages toggle with language selection |
@JayanthyChengan so unfortunately, not using localize did not solve the issue with having to use f:view on every page. Oh well, at this point, we can leave that for some other day. Could you make one of these PRs (or even a new one) have all the changes, and then close the other one(s)? That will make it straightforward to do what should be one final review and then QA. The final PR should have |
…into 5202-alert-messages
…-messages # Conflicts: # src/main/java/edu/harvard/iq/dataverse/ManageGroupsPage.java
@scolapasta @mheppler |
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.
Looks good, @JayanthyChengan! Thank you! Moving to QA.
…-messages # Conflicts: # src/main/webapp/dataset.xhtml
@JayanthyChengan One down, one to go |
Related Issues
Pull Request Checklist