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
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

- Fixed landing page content and links for fr-CA locale [#405](https://github.com/portagenetwork/roadmap/pull/405)

- Address missing French translations throughout application [#404](https://github.com/portagenetwork/roadmap/issues/404)

- 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.


### Changed

- Merged [v3.3.1](https://github.com/DMPRoadmap/roadmap/releases/tag/v3.3.1)
Expand Down
10 changes: 6 additions & 4 deletions app/presenters/research_output_presenter.rb
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.

Original file line number Diff line number Diff line change
Expand Up @@ -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.

end

# Returns the access options for a select tag
def selectable_access_types
ResearchOutput.accesses
.map { |k, _v| [k.humanize, k] }
.map { |k, _v| [_(k.humanize), k] } # k.humanize is sync'd to translation.io via _research_output.erb
end

# Returns the options for file size units
Expand Down Expand Up @@ -54,6 +54,7 @@ def byte_sizable?
end

# Returns the options for subjects for the repository filter
# rubocop:disable Metrics/AbcSize
def self.selectable_subjects
[
'23-Agriculture, Forestry, Horticulture and Veterinary Medicine',
Expand All @@ -71,7 +72,8 @@ def self.selectable_subjects
'12-Social and Behavioural Sciences',
'42-Thermal Engineering/Process Engineering'
].map do |subject|
[subject.split('-').last, subject.gsub('-', ' ')]
# subject.split('-').last is sync'd to translation.io via _research_output.erb
[_(subject.split('-').last), subject.gsub('-', ' ')]
end
end

Expand All @@ -85,7 +87,7 @@ def self.selectable_repository_types
end

# Converts the byte_size into a more friendly value (e.g. 15.4 MB)
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
# rubocop:disable Metrics/CyclomaticComplexity
def converted_file_size(size:)
return { size: nil, unit: 'mb' } unless size.present? && size.is_a?(Numeric) && size.positive?
return { size: size / 1.petabytes, unit: 'pb' } if size >= 1.petabytes
Expand Down
2 changes: 1 addition & 1 deletion app/views/plans/_project_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ethics_report_tooltip = _("Link to a protocol from a meeting with an ethics comm
<div class="col-md-8">
<%= form.label(:research_domain_id, _("Research domain"), class: "control-label") %>

<% options = research_domains.map { |rd| [rd.label, rd.id] } %>
<% options = research_domains.map { |rd| [_(rd.label), rd.id] } %> <%# rd.label is sync'd to translation.io via config.db_fields %>
<%= form.select :research_domain_id, options_for_select(options, form.object.research_domain_id),
{
include_blank: _("- Please select one -"),
Expand Down
2 changes: 1 addition & 1 deletion app/views/research_outputs/licenses/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
default_guidance = "https://choosealicense.com/"

preferred_licenses = presenter.preferred_licenses
preferred_licenses << ["- Other Licenses - will load a complete list -", "0"]
preferred_licenses << [_("- Other Licenses - will load a complete list -"), "0"]

preferred_guidance = Rails.configuration.x.madmp.preferred_licenses_guidance_url
preferred_guidance = default_guidance if preferred_guidance.nil? || preferred_guidance.empty?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<%= render partial: "layouts/modal_search/form",
locals: {
namespace: "metadata_standards",
label: "Metadata Standard",
search_examples: "(e.g. DataCite, Dublin, Biological, etc.)",
label: _("Metadata Standard"),
search_examples: _("(e.g. DataCite, Dublin, Biological, etc.)"),
lagoan marked this conversation as resolved.
Show resolved Hide resolved
model_instance: research_output,
search_path: plan_metadata_standard_search_path(research_output.plan),
search_method: :get
Expand Down
4 changes: 2 additions & 2 deletions app/views/research_outputs/repositories/_search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<%= render partial: "layouts/modal_search/form",
locals: {
namespace: "repositories",
label: "Repository",
search_examples: "(e.g. DNA, titanium, FAIR, etc.)",
label: _("Repository"),
search_examples: _("(e.g. DNA, titanium, FAIR, etc.)"),
model_instance: research_output,
search_path: plan_repository_search_path(research_output.plan),
search_method: :get
Expand Down
9 changes: 5 additions & 4 deletions app/views/static_pages/about_us.html.erb
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.

Original file line number Diff line number Diff line change
Expand Up @@ -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.

<p><%= _("If you do not have a %{application_name} account, click on") % {application_name: ApplicationService.application_name} %> <a href="<%= root_path %>"><%= _('Sign up') %></a> <%= _("on the homepage.") %></p>
lagoan marked this conversation as resolved.
Show resolved Hide resolved
<p><%= _("Please visit the") %> <a href="<%= help_path %>"><%= _('Help') %></a> <%= _("page for guidance.") %></p>

-->
<p>
<% sign_up_url = request.base_url %>
<%= sanitize(_('If you do not have a DMP Assistant account, click on <a href="%{sign_up_url}"> \'Sign up\' </a> on the homepage.') % { sign_up_url: sign_up_url} ) %>
Expand All @@ -48,8 +49,8 @@
</p>

<p>
<% help_url = "help_url" %>
<%= sanitize(_('Please visit the <a href="%{help_url}"> \'Help\' </a> page for guidance.') % {help_url: help_url}) %>
<% help_url = help_path %>
<%= sanitize(_('Please visit the <a href="%{help_url}"> \'Help\' </a> page for guidance.') % {help_url: help_path}) %>
</p>

<h2 class="fontsize-h3"><%= _('Feedback') %></h2>
Expand Down
2 changes: 1 addition & 1 deletion app/views/super_admin/api_clients/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<a href="<%= new_super_admin_api_client_path %>"
class="btn btn-primary pull-right"><%= _('Create Api Client') %></a>
</h1>
<p>Manage API access for external applications</p>
<p><%= _('Manage API access for external applications') %></p>
</div>
</div>
<div class="row">
Expand Down
30 changes: 26 additions & 4 deletions app/views/translation_io_exports/_research_output.erb
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@

<%=

# output_type
_('Audiovisual')
_('Collection')
_('Data_paper')
_('Data paper')
_('Dataset')
_('Event')
_('Image')
_('Interactive_resource')
_('Model_representation')
_('Physical_object')
_('Interactive resource')
_('Model representation')
_('Physical object')
_('Service')
_('Software')
_('Sound')
_('Text')
_('Workflow')
_('Other')

# access
_('Open')
_('Embargoed')
_('Restricted')
_('Closed')

# selectable_subjects
_('Agriculture, Forestry, Horticulture and Veterinary Medicine')
_('Biology')
_('Chemistry')
_('Computer Science, Electrical and System Engineering')
_('Construction Engineering and Architecture')
_('Geosciences (including Geography)')
_('Humanities')
_('Materials Science and Engineering')
_('Mathematics')
_('Mechanical and industrial Engineering')
_('Medicine')
_('Physics')
_('Social and Behavioural Sciences')
_('Thermal Engineering/Process Engineering')
%>
3 changes: 2 additions & 1 deletion config/initializers/translation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def ignore_paths
'Phase' => %w[title description],
'Section' => %w[title description],
'Question' => %w[text default_value],
'Annotation' => ['text']
'Annotation' => ['text'],
'ResearchDomain' => ['label']
}
# Find other useful usage information here:
# https://github.com/translation/rails#readme
Expand Down
Loading