-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #724 from berkmancenter/translations-in-db
Move site language to database
- Loading branch information
Showing
110 changed files
with
839 additions
and
676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'validates_automatically' | ||
|
||
class Translation < ApplicationRecord | ||
include ValidatesAutomatically | ||
|
||
validates :key, presence: true | ||
validates_uniqueness_of :key | ||
|
||
after_save do | ||
self.class.load_all | ||
end | ||
|
||
@@translations = nil | ||
|
||
def self.load_all | ||
@@translations = Translation.all | ||
end | ||
|
||
def self.t(key) | ||
@@translations | ||
&.select { |translation| translation.key == key } | ||
&.first | ||
&.body | ||
&.html_safe || | ||
'' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<span class="private">[Private]</span> | ||
<span class="private"><%= Translation.t('notice_entity_private') %></span> | ||
<span> | ||
<%= [entity.city, entity.state, entity.zip, entity.country_code&.upcase].reject { |item| item&.blank? }.join (', ') %> | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<%= render 'entities/address', entity: entity %> | ||
|
||
<% if date_sent(notice) != date_received(notice) %> | ||
<span class="date received">Received on <%= date_received(notice) %></span> | ||
<span class="date received"><%= Translation.t('notice_entity_recipient_received') %> <%= date_received(notice) %></span> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
Hi, | ||
|
||
your submitter plugin access request has been approved. | ||
|
||
Your plugin private key is: <%= @user.widget_public_key %> | ||
|
||
You can use it to configure the plugin. Integration documentation of the plugin is located here: https://github.com/berkmancenter/lumendatabase/blob/master/doc/submitter_javascript_widget.md. | ||
|
||
Thank you, | ||
Lumen Database team | ||
<%= format( | ||
Translation.t('mailers_api_submitter_request_approved'), | ||
widget_public_key: @user.widget_public_key | ||
).html_safe | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
Hi, | ||
|
||
your submitter plugin access request has been rejected. | ||
|
||
If you want to appeal contact the Lumen staff at [email protected]. | ||
|
||
Thank you, | ||
Lumen Database team | ||
<%= Translation.t('mailers_api_submitter_request_rejected') %> |
22 changes: 8 additions & 14 deletions
22
app/views/mailers/notice_file_uploads_updates_notification.text.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
Hi, | ||
|
||
You are getting this notification because documents have been updated for this notice: <%= @notice.title %>. | ||
|
||
This is a single-use link: <%= notice_url(@notice, access_token: @token_url.token, host: Chill::Application.config.site_host) %>. | ||
|
||
Using this link you can download the documents. | ||
|
||
Be aware that you can use it for the next <%= pluralize(@hours_active, 'hour') %> only. | ||
|
||
To disable notifications about document updates click here: <%= disable_documents_notification_token_url_url(@token_url, host: Chill::Application.config.site_host, token: @token_url.token) %>. | ||
|
||
Thank you, | ||
Lumen Database team | ||
<%= format( | ||
Translation.t('mailers_notice_file_uploads_notifications'), | ||
single_use_link: notice_url(@notice, access_token: @token_url.token, host: Chill::Application.config.site_host), | ||
time: pluralize(@hours_active, 'hour'), | ||
disable_notification_link: disable_documents_notification_token_url_url(@token_url, host: Chill::Application.config.site_host, token: @token_url.token), | ||
notice_title: @notice.title | ||
).html_safe | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
Hi, | ||
|
||
this is a single-use link you requested on the Lumen Database website: <%= notice_url(@notice, access_token: @token_url.token, host: Chill::Application.config.site_host) %>. | ||
|
||
Using this link you can see full details of <%= notice_url(@notice, host: Chill::Application.config.site_host) %>. | ||
|
||
Be aware that you can use it for the next <%= pluralize(@hours_active, 'hour') %> only. | ||
<%= format( | ||
Translation.t('mailers_new_token_url_part_1'), | ||
single_use_link: notice_url(@notice, access_token: @token_url.token, host: Chill::Application.config.site_host), | ||
normal_link: notice_url(@notice, host: Chill::Application.config.site_host), | ||
time: pluralize(@hours_active, 'hour') | ||
).html_safe | ||
%> | ||
|
||
<% if @token_url.documents_notification %> | ||
To disable notifications about document updates click here: <%= disable_documents_notification_token_url_url(@token_url, host: Chill::Application.config.site_host, token: @token_url.token) %>. | ||
|
||
<%= format( | ||
Translation.t('mailers_new_token_url_part_2'), | ||
disable_notifications_link: disable_documents_notification_token_url_url(@token_url, host: Chill::Application.config.site_host, token: @token_url.token) | ||
) | ||
%> | ||
<% end %> | ||
Thank you, | ||
Lumen Database team | ||
<%= Translation.t('mailers_new_token_url_part_3') %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
Thank you for your recent submission to Lumen Database with subject "<%= @notice.subject %>". | ||
|
||
You can link to the notice using the following URL: https://www.lumendatabase.org/notices/<%= @notice.id %> | ||
|
||
At the moment, that is likely a placeholder page, but if the notice is annotated and published, the link will resolve to the published notice. | ||
|
||
If you have any questions, please contact our team, [email protected]. | ||
|
||
Lumen Database | ||
<%= format( | ||
Translation.t('mailers_youtube_confirmation'), | ||
subject: @notice.subject, | ||
notice_id: @notice.id | ||
).html_safe | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
Thank you for your recent submission to Lumen Database with subject "<%= @notice.subject %>". | ||
|
||
You can link to the notice using the following URL: https://www.lumendatabase.org/notices/<%= @notice.id %> | ||
|
||
At the moment, that is likely a placeholder page, but if the notice is annotated and published, the link will resolve to the published notice. | ||
|
||
If you have any questions, please contact our team, [email protected]. | ||
|
||
Lumen Database | ||
<%= format( | ||
Translation.t('mailers_youtube_confirmation'), | ||
subject: @notice.subject, | ||
notice_id: @notice.id | ||
).html_safe | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.