diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 2372887f..92d7238d 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -24,7 +24,7 @@ class AccountsController < ApplicationController @encrypted_config.assign_attributes(app_url_params) unless URI.parse(@encrypted_config.value.to_s).class.in?([URI::HTTP, URI::HTTPS]) - @encrypted_config.errors.add(:value, 'should be a valid URL') + @encrypted_config.errors.add(:value, I18n.t('should_be_a_valid_url')) return render :show, status: :unprocessable_entity end @@ -33,7 +33,7 @@ class AccountsController < ApplicationController Docuseal.refresh_default_url_options! - redirect_to settings_account_path, notice: 'Account information has been updated' + redirect_to settings_account_path, notice: I18n.t('account_information_has_been_updated') rescue ActiveRecord::RecordInvalid render :show, status: :unprocessable_entity end @@ -43,11 +43,12 @@ class AccountsController < ApplicationController true_user.update!(locked_at: Time.current) + # rubocop:disable Layout/LineLength render turbo_stream: turbo_stream.replace( :account_delete_button, - html: helpers.tag.p('Your account removal request will be processed within 2 weeks. ' \ - 'Please contact us if you want to keep your account.') + html: helpers.tag.p(I18n.t('your_account_removal_request_will_be_processed_within_2_weeks_please_contact_us_if_you_want_to_keep_your_account')) ) + # rubocop:enable Layout/LineLength end private diff --git a/app/controllers/api_settings_controller.rb b/app/controllers/api_settings_controller.rb index 7d5c33e2..823db204 100644 --- a/app/controllers/api_settings_controller.rb +++ b/app/controllers/api_settings_controller.rb @@ -12,6 +12,6 @@ class ApiSettingsController < ApplicationController current_user.access_token.save! - redirect_back(fallback_location: settings_api_index_path, notice: 'API token as been updated.') + redirect_back(fallback_location: settings_api_index_path, notice: I18n.t('api_token_has_been_updated')) end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e47840a3..4727550d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -79,7 +79,8 @@ class ApplicationController < ActionController::Base redirect_to setup_index_path unless User.exists? end - def button_title(title: 'Submit', disabled_with: 'Submitting', title_class: '', icon: nil, icon_disabled: nil) + def button_title(title: I18n.t('submit'), disabled_with: I18n.t('submitting'), title_class: '', icon: nil, + icon_disabled: nil) render_to_string(partial: 'shared/button_title', locals: { title:, disabled_with:, title_class:, icon:, icon_disabled: }) end diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index fe309a80..23df8322 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -33,7 +33,7 @@ class DashboardController < ApplicationController account_id: current_user.account_id, key: AccountConfig::FORCE_MFA) - redirect_to mfa_setup_path, notice: 'Setup 2FA to continue' + redirect_to mfa_setup_path, notice: I18n.t('setup_2fa_to_continue') end def maybe_render_landing diff --git a/app/controllers/email_smtp_settings_controller.rb b/app/controllers/email_smtp_settings_controller.rb index a8c76692..6da10172 100644 --- a/app/controllers/email_smtp_settings_controller.rb +++ b/app/controllers/email_smtp_settings_controller.rb @@ -11,7 +11,7 @@ class EmailSmtpSettingsController < ApplicationController if @encrypted_config.update(email_configs) SettingsMailer.smtp_successful_setup(@encrypted_config.value['from_email']).deliver_now! - redirect_to settings_email_index_path, notice: 'Changes have been saved' + redirect_to settings_email_index_path, notice: I18n.t('changes_have_been_saved') else render :index, status: :unprocessable_entity end diff --git a/app/controllers/esign_settings_controller.rb b/app/controllers/esign_settings_controller.rb index 31879d05..6f052eeb 100644 --- a/app/controllers/esign_settings_controller.rb +++ b/app/controllers/esign_settings_controller.rb @@ -48,7 +48,7 @@ class EsignSettingsController < ApplicationController if (@encrypted_config.value && @encrypted_config.value['custom']&.any? { |e| e['name'] == @cert_record.name }) || @cert_record.name == DEFAULT_CERT_NAME - @cert_record.errors.add(:name, 'already exists') + @cert_record.errors.add(:name, I18n.t('already_exists')) return render turbo_stream: turbo_stream.replace(:modal, template: 'esign_settings/new'), status: :unprocessable_entity @@ -56,7 +56,7 @@ class EsignSettingsController < ApplicationController save_new_cert!(@encrypted_config, @cert_record) - redirect_to settings_esign_path, notice: 'Certificate has been successfully added!' + redirect_to settings_esign_path, notice: I18n.t('certificate_has_been_successfully_added_') rescue OpenSSL::PKCS12::PKCS12Error => e Rollbar.error(e) if defined?(Rollbar) @@ -73,7 +73,7 @@ class EsignSettingsController < ApplicationController @encrypted_config.save! - redirect_to settings_esign_path, notice: 'Default certificate has been selected' + redirect_to settings_esign_path, notice: I18n.t('default_certificate_has_been_selected') end def destroy @@ -81,7 +81,7 @@ class EsignSettingsController < ApplicationController @encrypted_config.save! - redirect_to settings_esign_path, notice: 'Certificate has been removed' + redirect_to settings_esign_path, notice: I18m.t('certificate_has_been_removed') end private diff --git a/app/controllers/mfa_setup_controller.rb b/app/controllers/mfa_setup_controller.rb index c65b2006..6ec74ccd 100644 --- a/app/controllers/mfa_setup_controller.rb +++ b/app/controllers/mfa_setup_controller.rb @@ -18,11 +18,11 @@ class MfaSetupController < ApplicationController current_user.otp_required_for_login = true current_user.save! - redirect_to settings_profile_index_path, notice: '2FA has been configured' + redirect_to settings_profile_index_path, notice: I18n.t('2fa_has_been_configured') else @provision_url = current_user.otp_provisioning_uri(current_user.email, issuer: Docuseal.product_name) - @error_message = 'Code is invalid' + @error_message = I18n.t('code_is_invalid') render turbo_stream: turbo_stream.replace(:mfa_form, partial: 'mfa_setup/form'), status: :unprocessable_entity end @@ -32,9 +32,9 @@ class MfaSetupController < ApplicationController if current_user.validate_and_consume_otp!(params[:otp_attempt]) current_user.update!(otp_required_for_login: false, otp_secret: nil) - redirect_to settings_profile_index_path, notice: '2FA has been removed' + redirect_to settings_profile_index_path, notice: I18n.t('2fa_has_been_removed') else - @error_message = 'Code is invalid' + @error_message = I18n.t('code_is_invalid') render turbo_stream: turbo_stream.replace(:modal, template: 'mfa_setup/edit'), status: :unprocessable_entity end @@ -43,7 +43,7 @@ class MfaSetupController < ApplicationController private def set_provision_url - return redirect_to root_path, alert: '2FA has been set up already' if current_user.otp_required_for_login + return redirect_to root_path, alert: I18n.t('2fa_has_been_set_up_already') if current_user.otp_required_for_login current_user.otp_secret ||= User.generate_otp_secret diff --git a/app/controllers/notifications_settings_controller.rb b/app/controllers/notifications_settings_controller.rb index 1a2f97ab..57b030fc 100644 --- a/app/controllers/notifications_settings_controller.rb +++ b/app/controllers/notifications_settings_controller.rb @@ -13,9 +13,9 @@ class NotificationsSettingsController < ApplicationController def create if @account_config.value.present? ? @account_config.save : @account_config.delete - redirect_back fallback_location: settings_notifications_path, notice: 'Changes have been saved' + redirect_back fallback_location: settings_notifications_path, notice: I18n.t('changes_have_been_saved') else - redirect_back fallback_location: settings_notifications_path, alert: 'Unable to save' + redirect_back fallback_location: settings_notifications_path, alert: I18n.t('unable_to_save') end end diff --git a/app/controllers/personalization_settings_controller.rb b/app/controllers/personalization_settings_controller.rb index 9f8b8810..21e1253c 100644 --- a/app/controllers/personalization_settings_controller.rb +++ b/app/controllers/personalization_settings_controller.rb @@ -30,7 +30,7 @@ class PersonalizationSettingsController < ApplicationController @account_config.save! end - redirect_back(fallback_location: settings_personalization_path, notice: 'Settings have been saved.') + redirect_back(fallback_location: settings_personalization_path, notice: I18n.t('settings_have_been_saved')) end private diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index e61a312d..e0adb16e 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -9,7 +9,7 @@ class ProfileController < ApplicationController def update_contact if current_user.update(contact_params) - redirect_to settings_profile_index_path, notice: 'Contact information has been updated' + redirect_to settings_profile_index_path, notice: I18n.t('contact_information_has_been_update') else render :index, status: :unprocessable_entity end @@ -18,7 +18,7 @@ class ProfileController < ApplicationController def update_password if current_user.update(password_params) bypass_sign_in(current_user) - redirect_to settings_profile_index_path, notice: 'Password has been changed' + redirect_to settings_profile_index_path, notice: I18n.t('password_has_been_changed') else render :index, status: :unprocessable_entity end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 0d51f41f..8a7a5e5f 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -12,7 +12,7 @@ class SessionsController < Devise::SessionsController Rollbar.warning('Sign in new user') if defined?(Rollbar) return redirect_to new_registration_path(sign_up: true, user: sign_in_params.slice(:email)), - notice: 'Create a new account' + notice: I18n.t('create_a_new_account') end if User.exists?(email:, otp_required_for_login: true) && sign_in_params[:otp_attempt].blank? diff --git a/app/controllers/setup_controller.rb b/app/controllers/setup_controller.rb index 7d386888..c6a08c58 100644 --- a/app/controllers/setup_controller.rb +++ b/app/controllers/setup_controller.rb @@ -21,7 +21,7 @@ class SetupController < ApplicationController @encrypted_config = EncryptedConfig.new(encrypted_config_params) unless URI.parse(encrypted_config_params[:value].to_s).class.in?([URI::HTTP, URI::HTTPS]) - @encrypted_config.errors.add(:value, 'should be a valid URL') + @encrypted_config.errors.add(:value, I18n.t('should_be_a_valid_url')) return render :index, status: :unprocessable_entity end @@ -66,10 +66,10 @@ class SetupController < ApplicationController end def redirect_to_root_if_signed - redirect_to root_path, notice: 'You are already signed in' + redirect_to root_path, notice: I18n.t('you_are_already_signed_in') end def ensure_first_user_not_created! - redirect_to new_user_session_path, notice: 'Please sign in.' if User.exists? + redirect_to new_user_session_path, notice: I18n.t('please_sign_in') if User.exists? end end diff --git a/app/controllers/start_form_controller.rb b/app/controllers/start_form_controller.rb index 5d969a65..3b7d0c14 100644 --- a/app/controllers/start_form_controller.rb +++ b/app/controllers/start_form_controller.rb @@ -24,7 +24,7 @@ class StartFormController < ApplicationController redirect_to start_form_completed_path(@template.slug, email: submitter_params[:email]) else if filter_undefined_submitters(@template).size > 1 && @submitter.new_record? - @error_message = 'Not found' + @error_message = I18n.t('not_found') return render :show end diff --git a/app/controllers/storage_settings_controller.rb b/app/controllers/storage_settings_controller.rb index c4478a2d..182e8ca8 100644 --- a/app/controllers/storage_settings_controller.rb +++ b/app/controllers/storage_settings_controller.rb @@ -11,7 +11,7 @@ class StorageSettingsController < ApplicationController if @encrypted_config.update(storage_configs) LoadActiveStorageConfigs.reload - redirect_to settings_storage_index_path, notice: 'Changes have been saved' + redirect_to settings_storage_index_path, notice: I18n.t('changes_have_been_saved') else render :index, status: :unprocessable_entity end diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index ceba45f6..76fdc18c 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -49,7 +49,7 @@ class SubmissionsController < ApplicationController Submissions.send_signature_requests(submissions) - redirect_to template_path(@template), notice: 'New recipients have been added' + redirect_to template_path(@template), notice: I18n.t('new_recipients_have_been_added') end def destroy @@ -57,13 +57,13 @@ class SubmissionsController < ApplicationController if params[:permanently].present? @submission.destroy! - 'Submission has been removed' + I18n.t('submission_has_been_deleted') else @submission.update!(archived_at: Time.current) SendSubmissionArchivedWebhookRequestJob.perform_async('submission_id' => @submission.id) - 'Submission has been archived' + I18n.t('submission_has_been_archived') end redirect_back(fallback_location: template_path(@submission.template), notice:) diff --git a/app/controllers/submissions_preview_controller.rb b/app/controllers/submissions_preview_controller.rb index dbf29294..640e6e64 100644 --- a/app/controllers/submissions_preview_controller.rb +++ b/app/controllers/submissions_preview_controller.rb @@ -19,7 +19,7 @@ class SubmissionsPreviewController < ApplicationController @submission ||= Submission.find_by!(slug: params[:slug]) if !@submission.submitters.all?(&:completed_at?) && current_user.blank? - raise ActionController::RoutingError, 'Not Found' + raise ActionController::RoutingError, I18n.t('not_found') end if !submission_valid_ttl?(@submission) && !signature_valid diff --git a/app/controllers/submit_form_controller.rb b/app/controllers/submit_form_controller.rb index 87040e50..0cfebae3 100644 --- a/app/controllers/submit_form_controller.rb +++ b/app/controllers/submit_form_controller.rb @@ -46,18 +46,21 @@ class SubmitFormController < ApplicationController submitter = Submitter.find_by!(slug: params[:slug]) if submitter.completed_at? - return render json: { error: 'Form has been completed already.' }, status: :unprocessable_entity + return render json: { error: I18n.t('form_has_been_completed_already') }, status: :unprocessable_entity end if submitter.template.archived_at? || submitter.submission.archived_at? - return render json: { error: 'Form has been archived.' }, status: :unprocessable_entity + return render json: { error: I18n.t('form_has_been_archived') }, status: :unprocessable_entity end if submitter.submission.expired? - return render json: { error: 'Form has been expired.' }, status: :unprocessable_entity + return render json: { error: I18n.t('form_has_been_expired') }, status: :unprocessable_entity end - return render json: { error: 'Form has been declined.' }, status: :unprocessable_entity if submitter.declined_at? + if submitter.declined_at? + return render json: { error: I18n.t('form_has_been_declined') }, + status: :unprocessable_entity + end Submitters::SubmitValues.call(submitter, params, request) diff --git a/app/controllers/submitters_send_email_controller.rb b/app/controllers/submitters_send_email_controller.rb index 97cc393d..910a4d69 100644 --- a/app/controllers/submitters_send_email_controller.rb +++ b/app/controllers/submitters_send_email_controller.rb @@ -10,7 +10,7 @@ class SubmittersSendEmailController < ApplicationController Rollbar.warning("Already sent: #{@submitter.id}") if defined?(Rollbar) return redirect_back(fallback_location: submission_path(@submitter.submission), - alert: 'Email has been sent already.') + alert: I18n.t('email_has_been_sent_already')) end SendSubmitterInvitationEmailJob.perform_async('submitter_id' => @submitter.id) @@ -18,6 +18,6 @@ class SubmittersSendEmailController < ApplicationController @submitter.sent_at ||= Time.current @submitter.save! - redirect_back(fallback_location: submission_path(@submitter.submission), notice: 'Email has been sent') + redirect_back(fallback_location: submission_path(@submitter.submission), notice: I18n.t('email_has_been_sent')) end end diff --git a/app/controllers/template_documents_controller.rb b/app/controllers/template_documents_controller.rb index c4af0e82..abd72010 100644 --- a/app/controllers/template_documents_controller.rb +++ b/app/controllers/template_documents_controller.rb @@ -5,7 +5,7 @@ class TemplateDocumentsController < ApplicationController def create if params[:blobs].blank? && params[:files].blank? - return render json: { error: 'File is missing' }, status: :unprocessable_entity + return render json: { error: I18n.t('file_is_missing') }, status: :unprocessable_entity end old_fields_hash = @template.fields.hash @@ -28,6 +28,6 @@ class TemplateDocumentsController < ApplicationController ) } rescue Templates::CreateAttachments::PdfEncrypted - render json: { error: 'PDF encrypted' }, status: :unprocessable_entity + render json: { error: 'PDF encrypted', status: 'pdf_encrypted' }, status: :unprocessable_entity end end diff --git a/app/controllers/template_folders_controller.rb b/app/controllers/template_folders_controller.rb index 80b81632..bd1981f2 100644 --- a/app/controllers/template_folders_controller.rb +++ b/app/controllers/template_folders_controller.rb @@ -15,9 +15,9 @@ class TemplateFoldersController < ApplicationController def update if @template_folder != current_account.default_template_folder && @template_folder.update(template_folder_params) - redirect_to folder_path(@template_folder), notice: 'Folder name has been updated' + redirect_to folder_path(@template_folder), notice: I18n.t('folder_name_has_been_updated') else - redirect_to folder_path(@template_folder), alert: 'Unable to rename folder' + redirect_to folder_path(@template_folder), alert: I18n.t('unable_to_rename_folder') end end diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index d998111d..253eede8 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -21,7 +21,7 @@ class TemplatesController < ApplicationController end def new - @template.name = "#{@base_template.name} (Clone)" if @base_template + @template.name = "#{@base_template.name} (#{I18n.t('clone')})" if @base_template end def edit @@ -87,11 +87,11 @@ class TemplatesController < ApplicationController if params[:permanently].present? @template.destroy! - 'Template has been removed.' + I18n.t('template_has_been_removed') else @template.update!(archived_at: Time.current) - 'Template has been archived.' + I18n.t('template_has_been_archived') end redirect_back(fallback_location: root_path, notice:) @@ -123,7 +123,7 @@ class TemplatesController < ApplicationController if template.account == current_account redirect_to(edit_template_path(@template)) else - redirect_back(fallback_location: root_path, notice: 'Template has been cloned') + redirect_back(fallback_location: root_path, notice: I18n.t('template_has_been_cloned')) end end diff --git a/app/controllers/templates_folders_controller.rb b/app/controllers/templates_folders_controller.rb index 70b6e341..3fdcc873 100644 --- a/app/controllers/templates_folders_controller.rb +++ b/app/controllers/templates_folders_controller.rb @@ -9,9 +9,9 @@ class TemplatesFoldersController < ApplicationController @template.folder = TemplateFolders.find_or_create_by_name(current_user, params[:name]) if @template.save - redirect_back(fallback_location: template_path(@template), notice: 'Document template has been moved') + redirect_back(fallback_location: template_path(@template), notice: I18n.t('document_template_has_been_moved')) else - redirect_back(fallback_location: template_path(@template), notice: 'Unable to move template into folder') + redirect_back(fallback_location: template_path(@template), notice: I18n.t('unable_to_move_template_into_folder')) end end diff --git a/app/controllers/templates_restore_controller.rb b/app/controllers/templates_restore_controller.rb index 2d1f80cf..9072e84d 100644 --- a/app/controllers/templates_restore_controller.rb +++ b/app/controllers/templates_restore_controller.rb @@ -6,6 +6,6 @@ class TemplatesRestoreController < ApplicationController def create @template.update!(archived_at: nil) - redirect_to template_path(@template), notice: 'Template has been unarchived' + redirect_to template_path(@template), notice: I18n.t('template_has_been_unarchived') end end diff --git a/app/controllers/templates_uploads_controller.rb b/app/controllers/templates_uploads_controller.rb index 620860cb..daefcc67 100644 --- a/app/controllers/templates_uploads_controller.rb +++ b/app/controllers/templates_uploads_controller.rb @@ -33,7 +33,7 @@ class TemplatesUploadsController < ApplicationController raise if Rails.env.local? - redirect_to root_path, alert: 'Unable to upload file' + redirect_to root_path, alert: I18n.t('unable_to_update_file') end private diff --git a/app/controllers/timestamp_server_controller.rb b/app/controllers/timestamp_server_controller.rb index 814331a3..d664a976 100644 --- a/app/controllers/timestamp_server_controller.rb +++ b/app/controllers/timestamp_server_controller.rb @@ -14,12 +14,12 @@ class TimestampServerController < ApplicationController test_timeserver_url(@encrypted_config.value) if @encrypted_config.value.present? if @encrypted_config.value.present? ? @encrypted_config.save : @encrypted_config.delete - redirect_back fallback_location: settings_notifications_path, notice: 'Changes have been saved' + redirect_back fallback_location: settings_notifications_path, notice: I18n.t('changes_have_been_saved') else - redirect_back fallback_location: settings_notifications_path, alert: 'Unable to save' + redirect_back fallback_location: settings_notifications_path, alert: I18n.t('unable_to_save') end rescue SocketError, TimestampError, OpenSSL::Timestamp::TimestampError - redirect_back fallback_location: settings_notifications_path, alert: 'Invalid Timeserver' + redirect_back fallback_location: settings_notifications_path, alert: t('invalid_timeserver') end private diff --git a/app/controllers/user_initials_controller.rb b/app/controllers/user_initials_controller.rb index b8ba23e5..b2db409b 100644 --- a/app/controllers/user_initials_controller.rb +++ b/app/controllers/user_initials_controller.rb @@ -9,7 +9,7 @@ class UserInitialsController < ApplicationController def update file = params[:file] - return redirect_to settings_profile_index_path, notice: 'Unable to save initials' if file.blank? + return redirect_to settings_profile_index_path, notice: I18n.t('unable_to_save_initials') if file.blank? blob = ActiveStorage::Blob.create_and_upload!(io: file.open, filename: file.original_filename, @@ -22,16 +22,16 @@ class UserInitialsController < ApplicationController ) if @user_config.update(value: attachment.uuid) - redirect_to settings_profile_index_path, notice: 'Initials has been saved' + redirect_to settings_profile_index_path, notice: I18n.t('initials_has_been_saved') else - redirect_to settings_profile_index_path, notice: 'Unable to save initials' + redirect_to settings_profile_index_path, notice: I18n.t('unable_to_save_initials') end end def destroy @user_config.destroy - redirect_to settings_profile_index_path, notice: 'Initials has been removed' + redirect_to settings_profile_index_path, notice: I18n.t('initials_has_been_removed') end private diff --git a/app/controllers/user_signatures_controller.rb b/app/controllers/user_signatures_controller.rb index e7c5b962..1588e935 100644 --- a/app/controllers/user_signatures_controller.rb +++ b/app/controllers/user_signatures_controller.rb @@ -9,7 +9,7 @@ class UserSignaturesController < ApplicationController def update file = params[:file] - return redirect_to settings_profile_index_path, notice: 'Unable to save signature' if file.blank? + return redirect_to settings_profile_index_path, notice: I18n.t('Unable to save signature') if file.blank? blob = ActiveStorage::Blob.create_and_upload!(io: file.open, filename: file.original_filename, @@ -22,16 +22,16 @@ class UserSignaturesController < ApplicationController ) if @user_config.update(value: attachment.uuid) - redirect_to settings_profile_index_path, notice: 'Signature has been saved' + redirect_to settings_profile_index_path, notice: I18n.t('signature_has_been_saved') else - redirect_to settings_profile_index_path, notice: 'Unable to save signature' + redirect_to settings_profile_index_path, notice: I18n.t('Unable to save signature') end end def destroy @user_config.destroy - redirect_to settings_profile_index_path, notice: 'Signature has been removed' + redirect_to settings_profile_index_path, notice: I18n.t('signature_has_been_removed') end private diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7e18e686..cf37d24c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -35,14 +35,14 @@ class UsersController < ApplicationController if @user.save UserMailer.invitation_email(@user).deliver_later! - redirect_back fallback_location: settings_users_path, notice: 'User has been invited' + redirect_back fallback_location: settings_users_path, notice: I18n.t('user_has_been_invited') else render turbo_stream: turbo_stream.replace(:modal, template: 'users/new'), status: :unprocessable_entity end end def update - return redirect_to settings_users_path, notice: 'Unable to update user.' if Docuseal.demo? + return redirect_to settings_users_path, notice: I18n.t('unable_to_update_user') if Docuseal.demo? attrs = user_params.compact_blank.merge(user_params.slice(:archived_at)) attrs.delete(:role) if !role_valid?(attrs[:role]) || current_user == @user @@ -56,7 +56,7 @@ class UsersController < ApplicationController end if @user.update(attrs) - redirect_back fallback_location: settings_users_path, notice: 'User has been updated' + redirect_back fallback_location: settings_users_path, notice: I18n.t('user_has_been_updated') else render turbo_stream: turbo_stream.replace(:modal, template: 'users/edit'), status: :unprocessable_entity end @@ -64,12 +64,12 @@ class UsersController < ApplicationController def destroy if Docuseal.demo? || @user.id == current_user.id - return redirect_to settings_users_path, notice: 'Unable to remove user' + return redirect_to settings_users_path, notice: I18n.t('unable_to_remove_user') end @user.update!(archived_at: Time.current) - redirect_back fallback_location: settings_users_path, notice: 'User has been removed' + redirect_back fallback_location: settings_users_path, notice: I18n.t('user_has_been_removed') end private diff --git a/app/controllers/verify_pdf_signature_controller.rb b/app/controllers/verify_pdf_signature_controller.rb index 69e6098b..a81a6da8 100644 --- a/app/controllers/verify_pdf_signature_controller.rb +++ b/app/controllers/verify_pdf_signature_controller.rb @@ -14,6 +14,6 @@ class VerifyPdfSignatureController < ApplicationController render turbo_stream: turbo_stream.replace('result', partial: 'result', locals: { pdfs:, files: params[:files], trusted_certs: }) rescue HexaPDF::MalformedPDFError - render turbo_stream: turbo_stream.replace('result', html: helpers.tag.div('Invalid PDF', id: 'result')) + render turbo_stream: turbo_stream.replace('result', html: helpers.tag.div(I18n.t('invalid_pdf'), id: 'result')) end end diff --git a/app/controllers/webhook_secret_controller.rb b/app/controllers/webhook_secret_controller.rb index 12c1edae..cd5bbefa 100644 --- a/app/controllers/webhook_secret_controller.rb +++ b/app/controllers/webhook_secret_controller.rb @@ -13,7 +13,7 @@ class WebhookSecretController < ApplicationController @encrypted_config.value.present? ? @encrypted_config.save! : @encrypted_config.delete - redirect_back(fallback_location: settings_webhooks_path, notice: 'Webhook Secret has been saved.') + redirect_back(fallback_location: settings_webhooks_path, notice: I18n.t('webhook_secret_has_been_saved')) end private diff --git a/app/controllers/webhook_settings_controller.rb b/app/controllers/webhook_settings_controller.rb index 4c0f7101..475e830f 100644 --- a/app/controllers/webhook_settings_controller.rb +++ b/app/controllers/webhook_settings_controller.rb @@ -11,7 +11,7 @@ class WebhookSettingsController < ApplicationController @encrypted_config.value.present? ? @encrypted_config.save! : @encrypted_config.delete - redirect_back(fallback_location: settings_webhooks_path, notice: 'Webhook URL has been saved.') + redirect_back(fallback_location: settings_webhooks_path, notice: I18n.t('webhook_url_has_been_saved')) end def update @@ -20,7 +20,7 @@ class WebhookSettingsController < ApplicationController SendFormCompletedWebhookRequestJob.perform_async({ 'submitter_id' => submitter.id, 'encrypted_config_id' => @encrypted_config.id }) - redirect_back(fallback_location: settings_webhooks_path, notice: 'Webhook request has been sent.') + redirect_back(fallback_location: settings_webhooks_path, notice: I18n.t('webhook_request_has_been_sent')) end private diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index 4334aa8e..8f28f547 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -131,7 +131,7 @@ class="flex items-center justify-center space-x-2" > - Save and Preview + {{ t('save_and_preview') }}
  • @@ -142,7 +142,7 @@ @click="closeDropdown" > - Preferences + {{ t('preferences') }}
  • diff --git a/app/javascript/template_builder/conditions_modal.vue b/app/javascript/template_builder/conditions_modal.vue index db70dad3..d934f864 100644 --- a/app/javascript/template_builder/conditions_modal.vue +++ b/app/javascript/template_builder/conditions_modal.vue @@ -26,7 +26,7 @@ href="https://www.docuseal.co/pricing" target="_blank" class="link" - >Available in Pro + >{{ t('available_in_pro') }}
    diff --git a/app/javascript/template_builder/formula_modal.vue b/app/javascript/template_builder/formula_modal.vue index 0ceb9811..2f35e762 100644 --- a/app/javascript/template_builder/formula_modal.vue +++ b/app/javascript/template_builder/formula_modal.vue @@ -26,7 +26,7 @@ href="https://www.docuseal.co/pricing" target="_blank" class="link" - >Available in Pro + >{{ t('available_in_pro') }}
    Learn more + >{{ t('learn_more') }}
  • <%= link_to settings_profile_index_path, class: 'flex items-center' do %> <%= svg_icon('adjustments', class: 'w-5 h-5 flex-shrink-0 stroke-2') %> - Profile + <%= t('profile') %> <% end %>
  • <% if !Docuseal.demo? && can?(:manage, EncryptedConfig) %>
  • <%= link_to Docuseal.multitenant? ? console_redirect_index_path : Docuseal::CONSOLE_URL, data: { prefetch: false }, class: 'flex items-center' do %> <%= svg_icon('terminal', class: 'w-5 h-5 stroke-2') %> - Console + <%= t('console') %> <% end %>
  • <% end %> @@ -45,14 +45,14 @@
  • <%= link_to settings_esign_path, class: 'flex items-center' do %> <%= svg_icon('zoom_check', class: 'w-5 h-5 stroke-2') %> - Verify PDF + <%= t('verify_pdf') %> <% end %>
  • <% end %>
  • <%= button_to destroy_user_session_path, method: :delete, data: { turbo: false }, class: 'flex items-center' do %> <%= svg_icon('logout', class: 'w-5 h-5 stroke-2 mr-2 inline') %> - Sign out + <%= t('sign_out') %> <% end %>
  • @@ -71,7 +71,7 @@ <% if Docuseal.multitenant? && !request.path.in?([registration_path, new_registration_path]) %> <%= link_to registration_path({ lang: params[:lang] }.compact_blank), class: 'btn btn-neutral btn-sm btn-outline' do %> - + <%= t('sign_up') %> <% end %> diff --git a/app/views/shared/_navbar_buttons.html.erb b/app/views/shared/_navbar_buttons.html.erb index 4c81abd7..785b7300 100644 --- a/app/views/shared/_navbar_buttons.html.erb +++ b/app/views/shared/_navbar_buttons.html.erb @@ -1,5 +1,5 @@ <%= link_to Docuseal.multitenant? ? console_redirect_index_path(redir: "#{Docuseal::CONSOLE_URL}/plans") : "#{Docuseal::CLOUD_URL}/sign_up?#{{ redir: "#{Docuseal::CONSOLE_URL}/on_premise" }.to_query}", class: 'hidden md:inline-flex btn btn-warning btn-sm', data: { prefetch: false } do %> - Upgrade + <%= t('upgrade') %> <% end %> <% if signed_in? && current_user != true_user %> diff --git a/app/views/shared/_pagination.html.erb b/app/views/shared/_pagination.html.erb index 75025895..e53128e1 100644 --- a/app/views/shared/_pagination.html.erb +++ b/app/views/shared/_pagination.html.erb @@ -12,7 +12,7 @@ « <% end %> - Page <%= @pagy.page %> + <%= t('page_number', number: @pagy.page) %> <% if @pagy.next %> <%== link.call(@pagy.next, '»', classes: 'join-item btn min-h-full h-10') %> diff --git a/app/views/shared/_powered_by.html.erb b/app/views/shared/_powered_by.html.erb index 3e4bc78e..68cc40eb 100644 --- a/app/views/shared/_powered_by.html.erb +++ b/app/views/shared/_powered_by.html.erb @@ -2,12 +2,12 @@ <% if local_assigns[:with_counter] %> <% count = Submitter.where.not(completed_at: nil).distinct.count(:submission_id) %> <% if count > 1 %> - <%= count %> documents signed with + <%= t('count_documents_signed_with_html', count:) %> <% else %> - Powered by + <%= t('powered_by') %> <% end %> <% else %> - Powered by + <%= t('powered_by') %> <% end %> <%= Docuseal.product_name %> - open source documents software diff --git a/app/views/shared/_settings_nav.html.erb b/app/views/shared/_settings_nav.html.erb index 2995cf5c..4cb677d1 100644 --- a/app/views/shared/_settings_nav.html.erb +++ b/app/views/shared/_settings_nav.html.erb @@ -2,23 +2,25 @@