psu-libraries / etda_workflow

Electronic Theses and Dissertations Application: Admin, Author, and Committee Member workflows.
MIT License
3 stars 1 forks source link

updates dissertation language #776

Closed Smullz622 closed 6 months ago

Smullz622 commented 6 months ago

Fixes #764 - adds logic to use the correct language with the correct graduate degree type

title_for and description_for are used for all filters in each instance, but we only want to change it for the grad school instance for dissertation degree types on the filters that have the word thesis/dissertation. The logic feels a little clunky, but the only alternative I could think if was to add thesis_description to the translation for all of the filters which would be redundant/unnecessary for a lot of them. I considered using interpolation, but since capitalization varies by filter (Dissertation vs dissertation), it felt like the logic to handle that wouldn't be an improvement.

jlandiseigsti commented 6 months ago

Yeah, I see what you mean wrt capitalization being an issue with interpolation. I played around with it a bit, since I generally like interpolation, but didn't come up with a solution I liked...there's not a way, as far I could tell, to just have the string in the yaml file automatically be sentence case. Plus there's plural vs. singular potentially screwing things up as well. I think your solution makes sense.

jlandiseigsti commented 6 months ago

I think you can use #capitalize to properly capitalize a sentence. So maybe we could do interpolation here, but use #capitalize on the whole string returned by I18n?

I'm just not too sure how I feel about this logic: && !thesis_title.match?(/Translation missing/).

There is also the complication of irregular pluralization going on: 'Thesis' turning into 'theses', which would add another step to interpolation. But I do agree that matching on the 'Translation missing' string feels brittle – it would break if I18n changed the error message wording.

ajkiessl commented 6 months ago

There is also the complication of irregular pluralization going on: 'Thesis' turning into 'theses', which would add another step to interpolation. But I do agree that matching on the 'Translation missing' string feels brittle – it would break if I18n changed the error message wording.

Oh right. What if we change Thesis drafts to be reviewed to Draft theses to be reviewed. Then they'd all be plural.

Smullz622 commented 6 months ago

That would work; I'll change that wording & then try interpolation with #capitalize