Skip to content
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

Aaron/issues/translation #409

Merged
merged 16 commits into from
Aug 16, 2023
Merged

Conversation

aaronskiba
Copy link
Collaborator

@aaronskiba aaronskiba commented Aug 1, 2023

This addresses "About Us" bug mentioned in issue #404
Enables proper export to translation.io
Need this for translation "Research domain" dropdown elements in "Project Details" panel of Plan
@github-actions
Copy link

github-actions bot commented Aug 1, 2023

1 Warning
⚠️ There are code changes, but no corresponding tests. Please include tests if this PR introduces any modifications in behavior.

Generated by 🚫 Danger

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe refactoring is needed for the array in def self.selectable_subjects? If the elements didn't contain commas and other symbols, I would've created enum selectable_subject in class ResearchOutput. Also, I'm not sure if the prepended XX- can be removed from each of the array elements.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This remedies issue #407. No translations are currently available for the "Sign up" and "Help" messages I commented out here. Otherwise, I probably would've kept them and commented out the other "Sign up" and "Help" messages.

Copy link
Collaborator

@lagoan lagoan left a comment

Choose a reason for hiding this comment

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

The changes are looking good! I just have a few questions about the approach for some minor parts of the code.

Looking forward to reading your responses!

app/presenters/research_output_presenter.rb Outdated Show resolved Hide resolved
Comment on lines 60 to 73
"23-#{_('Agriculture, Forestry, Horticulture and Veterinary Medicine')}",
"21-#{_('Biology')}",
"31-#{_('Chemistry')}",
"44-#{_('Computer Science, Electrical and System Engineering')}",
"45-#{_('Construction Engineering and Architecture')}",
"34-#{_('Geosciences (including Geography)')}",
"11-#{_('Humanities')}",
"43-#{_('Materials Science and Engineering')}",
"33-#{_('Mathematics')}",
"41-#{_('Mechanical and industrial Engineering')}",
"22-#{_('Medicine')}",
"32-#{_('Physics')}",
"12-#{_('Social and Behavioural Sciences')}",
"42-#{_('Thermal Engineering/Process Engineering')}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont think the hashtag notation will work for this. In previous times we have used the format method so that gettext can identify the keys. Translation gem is using gettext which uses the full string as a key in a hash object to look up the translations. so if a key is missing it wont translate.

So it should be something like _('23-Agriculture, Forestry, Horticulture and Veterinary Medicine').

Or you can try something like format("23-%{subject}", subject : _(Agriculture, Forestry, Horticulture and Veterinary Medicine')) which could make it more general. I am not 100% sure it works though.

Give it a try on the test project and talk with @200455939-yashu .

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Screenshot 2023-08-01 at 3 00 58 PM Screenshot 2023-08-01 at 3 00 17 PM

Cool, good to double check. I just tried creating a couple translations in dmp-assistant-test. I guess the current code format is ok for translation.io to pick up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, although it is getting picked up, this will still probably need to be fixed. When .map do |subject| [subject.split('-').last, subject.gsub('-', ' ')] is applied to the array, both elements in the array receive the translation. However, subject.gsub('-', ' ') should not be receiving the translation.

app/views/static_pages/about_us.html.erb Outdated Show resolved Hide resolved
@@ -34,10 +34,11 @@

<h2 class="fontsize-h3"><%= _('Getting started') %></h2>

<p><%= _("If you have an account please sign in and start creating or editing your DMP.") %></p>
<p><%= _("If you have an account, please sign in and start creating or editing your DMP.") %></p>
<!--
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, why are we commenting out this next part? If we don't need it we should remove it, but it looks like this code is something we do want here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All good. This related to #407. Currently, the "Sign Up" and "Help" messages are repeated in the "Getting Started" section of the "About Us" page https://assistant.portagenetwork.ca/about_us.

I'm thinking we'll need to remove one of the "Sign Up" messages and one of the "Help" messages. But I actually prefer the code I commented out in comparison to what I kept. However, translations aren't currently available for the code that I do prefer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can double-check with @isawil to see which copy we like best. We can leave just one instead of waiting for the translation for the missing piece.

Does this make sense?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cool, yes, that makes sense. I'll verify which one we should keep.

@aaronskiba
Copy link
Collaborator Author

The changes are looking good! I just have a few questions about the approach for some minor parts of the code.

Looking forward to reading your responses!

Awesome, thank you! Translation.io is a little peculiar so I appreciate any questions/concerns.

It looks like all of the proposed changes are currently working for the translations, though. Maybe you'd still prefer for something to be refactored, though? Also, I don't know if you have a preference as to how we should proceed with this #409 (comment)? Thanks!

Perhaps the best solution would be to add 'enum selectable_subject' to ResearchOutput. That way we could implement the same logic we used for ResearchOuput.output_types and ResearchOutput.accesses.
@aaronskiba aaronskiba force-pushed the aaron/issues/translation branch from e42ce36 to 07741d2 Compare August 2, 2023 19:21
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need these files ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question. I want to test the translations in UAT, but there are a few things I'm unsure about:

  1. Does UAT use the test key or the prod key for translation.io?
  2. Do I need to provide the po files for UAT deployment?
  3. When translations are provided to translation.io, are those changes automatically sync'd back to UAT? And if not, should we deploy another UAT instance, or should we execute the translation:sync task within the existing UAT instance?

Copy link
Collaborator

Choose a reason for hiding this comment

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

As per my knowledge,

  1. UAT uses the prod key.
  2. No, PO files are not needed for the UAT deployment.
  3. Everything available in Translation.io are directly available to the UAT.

@aaronskiba
Copy link
Collaborator Author

It looks like all of the proposed changes are currently working for the translations, though. Maybe you'd still prefer for something to be refactored, though? Also, I don't know if you have a preference as to how we should proceed with this #409 (comment)? Thanks!

Or so I thought, haha. There was an issue that was addressed with the following commit: 07741d2

Also, sorry, I have a question here: #409 (comment)

200455939-yashu
200455939-yashu previously approved these changes Aug 8, 2023
Copy link
Collaborator

@200455939-yashu 200455939-yashu left a comment

Choose a reason for hiding this comment

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

Good work

@200455939-yashu 200455939-yashu dismissed their stale review August 8, 2023 17:23

Please remove the PO files

Copy link
Collaborator

@lagoan lagoan left a comment

Choose a reason for hiding this comment

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

Great work @aaronskiba , I found some very minor changes that we can make and then it will be good to go.

@@ -11,13 +11,13 @@ def initialize(research_output:)
# Returns the output_type list for a select_tag
def selectable_output_types
ResearchOutput.output_types
.map { |k, _v| [k.humanize, k] }
.map { |k, _v| [_(k.humanize), k] } # k.humanize is sync'd to translation.io via _research_output.erb
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like how you are referencing where we need to look for the translations in case we ever need to update them.

CHANGELOG.md Outdated

- Removed repeated "Sign-up" and "Help" text in "About Us" [#407](https://github.com/portagenetwork/roadmap/issues/407)

- Fixed broken "Help" link [402](https://github.com/portagenetwork/roadmap/issues/412)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor change, add the # simbol to the link.

@@ -34,10 +34,11 @@

<h2 class="fontsize-h3"><%= _('Getting started') %></h2>

<p><%= _("If you have an account please sign in and start creating or editing your DMP.") %></p>
<p><%= _("If you have an account, please sign in and start creating or editing your DMP.") %></p>
<!--
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can double-check with @isawil to see which copy we like best. We can leave just one instead of waiting for the translation for the missing piece.

Does this make sense?

app/views/static_pages/about_us.html.erb Outdated Show resolved Hide resolved
The commented out code is related to issue #407. It was decided that the commented code is what will be removed.
@aaronskiba
Copy link
Collaborator Author

Hi @lagoan, I did the changelog cleanup. Also, after discussing the repeated About Us text with @isawil, the commented-out code is what we will not be keeping. As a result, it has been removed.

Copy link
Collaborator

@lagoan lagoan left a comment

Choose a reason for hiding this comment

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

LGTM

@aaronskiba aaronskiba merged commit cf914f7 into deployment-portage Aug 16, 2023
@aaronskiba aaronskiba deleted the aaron/issues/translation branch August 16, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants