Skip to content

Commit

Permalink
Prevent translation of subject.gsub('-', ' ')
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aaronskiba committed Aug 2, 2023
1 parent cd8ab7f commit 07741d2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
31 changes: 16 additions & 15 deletions app/presenters/research_output_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,23 @@ def byte_sizable?
# rubocop:disable Metrics/AbcSize
def self.selectable_subjects
[
"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')}"
'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'
].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 Down
16 changes: 16 additions & 0 deletions app/views/translation_io_exports/_research_output.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,20 @@ _('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')
%>

0 comments on commit 07741d2

Please sign in to comment.