Skip to content

Commit

Permalink
Make configuration defaults use I18n locale.
Browse files Browse the repository at this point in the history
Any overrides of these defaults in initializers would remove the ability
to support multiple languages as pointed out by @j-dornbusch in #4285.
  • Loading branch information
cjcolvar authored and Tom Johnson committed Apr 24, 2020
1 parent a734f83 commit 84c7973
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 9 additions & 0 deletions config/locales/hyrax.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,15 @@ en:
terms_page: Terms of Use
updated: Pages updated.
passive_consent_to_agreement: By saving this work I agree to the
permission_levels:
edit: "Edit access"
read: "View/Download"
owner:
edit: "Edit access"
options:
edit: "Edit"
none: "Choose Access"
read: "View/Download"
search:
button:
html: <span class="glyphicon glyphicon-search" aria-hidden="true"></span> Go
Expand Down
12 changes: 6 additions & 6 deletions lib/hyrax/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,20 +488,20 @@ def google_analytics_id

attr_writer :permission_levels
def permission_levels
@permission_levels ||= { "View/Download" => "read",
"Edit access" => "edit" }
@permission_levels ||= { I18n.t('hyrax.permission_levels.read') => "read",
I18n.t('hyrax.permission_levels.edit') => "edit" }
end

attr_writer :owner_permission_levels
def owner_permission_levels
@owner_permission_levels ||= { "Edit access" => "edit" }
@owner_permission_levels ||= { I18n.t('hyrax.permission_levels.owner.edit') => "edit" }
end

attr_writer :permission_options
def permission_options
@permission_options ||= { "Choose Access" => "none",
"View/Download" => "read",
"Edit" => "edit" }
@permission_options ||= { I18n.t('hyrax.permission_levels.options.none') => "none",
I18n.t('hyrax.permission_levels.options.read') => "read",
I18n.t('hyrax.permission_levels.options.edit') => "edit" }
end

attr_writer :publisher
Expand Down

0 comments on commit 84c7973

Please sign in to comment.