Skip to content

Commit

Permalink
Merge pull request #924 from bullet-train-co/jeremy/file-field-transl…
Browse files Browse the repository at this point in the history
…ation-fix

Make file fields reference 'files' not 'documents'
  • Loading branch information
jagthedrummer authored Oct 17, 2024
2 parents 397cb81 + d38b9d3 commit dc2dd63
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ persisted_files = options[:multiple] ? form.object.send(method) : [form.object.s
</span>
<%= link_to url_for(file), class: 'button download-file mr-3', data: {'fields--file-item-target': 'downloadFileButton'} do %>
<i class="leading-none mr-2 text-base ti ti-download"></i>
<span><%= t('fields.download_document') %></span>
<span><%= t('fields.download_file') %></span>
<% end %>
<div class="button-alternative cursor-pointer mr-3" data-action="click->fields--file-item#removeFile" data-fields--file-item-target="removeFileButton">
<i class="leading-none mr-2 text-base ti ti-trash"></i>
<span><%= t('fields.remove_document') %></span>
<span><%= t('fields.remove_file') %></span>
</div>
<div class="button-alternative cursor-pointer mr-3 hidden" data-action="click->fields--file-item#cancelRemoveFile" data-fields--file-item-target="cancelRemoveFileButton">
<i class="leading-none mr-2 text-base ti ti-na"></i>
<span><%= t('fields.cancel_remove_document') %></span>
<span><%= t('fields.cancel_remove_file') %></span>
</div>
</div>
<% end %>
Expand All @@ -71,13 +71,13 @@ persisted_files = options[:multiple] ? form.object.send(method) : [form.object.s
<i class="leading-none mr-2 text-base ti ti-upload dark:text-white" data-fields--file-field-target="selectFileButtonIcon"></i>
<span class="dark:text-white" data-fields--file-field-target="selectFileButtonText">
<% if form.object.send(method).attached? && !options[:multiple] %>
<%= t('fields.replace_document') %>
<%= t('fields.replace_file') %>
<% elsif form.object.send(method).attached? && options[:multiple] %>
<%= t('fields.add_another_document') %>
<%= t('fields.add_another_file') %>
<% elsif options[:multiple] %>
<%= t('fields.upload_documents') %>
<%= t('fields.upload_file') %>
<% else %>
<%= t('fields.upload_document') %>
<%= t('fields.upload_file') %>
<% end %>
</span>
</div>
Expand Down
25 changes: 18 additions & 7 deletions bullet_train-themes-tailwind_css/config/locales/en/fields.en.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
en:
fields:
download_document: Download Current Document
upload_document: Upload New Document
upload_documents: Upload New Documents
add_another_document: Add Another Document
replace_document: Replace Document
remove_document: Remove Current Document
cancel_remove_document: Cancel Removal
download_file: Download Current File
upload_file: Upload New File
upload_files: Upload New Files
add_another_file: Add Another File
replace_file: Replace File
remove_file: Remove Current File
cancel_remove_file: Cancel Removal
download_image: Download Current Image
upload_image: Upload New Image
upload_images: Upload New Images
Expand All @@ -15,3 +15,14 @@ en:
remove_image: Remove Current Image
cancel_remove_image: Cancel Removal
select_different_file: Select A Different File
# NOTE: These _document translations were the original keys uses for file fields.
# We've changed all of the templates to reference the _file versions, but we're
# leaving the _document variants here so that we don't break things for people
# who have ejected the file field partial.
download_document: Download Current File
upload_document: Upload New File
upload_documents: Upload New Files
add_another_document: Add Another File
replace_document: Replace File
remove_document: Remove Current File
cancel_remove_document: Cancel Removal
6 changes: 3 additions & 3 deletions bullet_train/config/locales/en/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ en:
date_and_time: '%m/%d/%Y %l:%M %p'
file_fields:
download: Download File
download_current: Download Current Document
remove: Remove Current Document
upload: Upload New Document
download_current: Download Current File
remove: Remove Current File
upload: Upload New File
bulk_select:
all: All

Expand Down

0 comments on commit dc2dd63

Please sign in to comment.