Merge pull request #8771 from tsara27/8458-missing-translation

Missing translation: table headers in product import validation table #8458
This commit is contained in:
Filipe
2022-01-26 17:22:44 +00:00
committed by GitHub
3 changed files with 61 additions and 1 deletions

View File

@@ -107,7 +107,11 @@ module ProductImport
end
def table_headings
@entries.first.displayable_attributes.keys.map(&:humanize) if @entries.first
return unless @entries.first
@entries.first.displayable_attributes.keys.map do |key|
I18n.t "admin.product_import.product_headings.#{key}"
end
end
def products_created_count

View File

@@ -749,6 +749,21 @@ en:
import_again: Upload Another File
view_products: Go To Products Page
view_inventory: Go To Inventory Page
product_headings:
producer: Producer
sku: SKU
name: Name
display_name: Display Name
category: Category
description: Description
units: Units
unit_type: Unit Type
variant_unit_name: Variant Unit Name
price: Price
on_hand: On Hand
on_demand: On Demand
shipping_category: Shipping Category
tax_category: Tax Category
variant_overrides:
loading_flash:

View File

@@ -565,6 +565,47 @@ describe "Product Import", js: true do
expect(page).to have_no_selector 'input[type=submit][value="Save"]'
end
context 'when using other language than English' do
around do |example|
original_default_locale = I18n.default_locale
# Set the language to Spanish
I18n.default_locale = 'es'
example.run
I18n.default_locale = original_default_locale
end
it 'returns the header in selected language' do
csv_data = CSV.generate do |csv|
csv << ["name", "producer", "category", "on_hand", "price", "units", "unit_type",
"shipping_category"]
csv << ["Carrots", "User Enterprise", "Vegetables", "5", "3.20", "1", "lb",
shipping_category_id_str]
csv << ["Potatoes", "User Enterprise", "Vegetables", "6", "6.50", "8", "oz",
shipping_category_id_str]
end
File.write('/tmp/test.csv', csv_data)
visit main_app.admin_product_import_path
expect(page).to have_content 'Importación de productos'
expect(page).to have_content 'Selecciona una hoja de cálculo para subir'
attach_file 'file', '/tmp/test.csv'
click_button 'Subir'
find('a.button.proceed').click
within('.panel-header .header-caret') { find('i').click }
within('.panel-content .table-wrap') do
product_headings = ['producer', 'category', 'units', 'unit_type',
'price', 'on_hand', 'shipping_category', 'name']
product_headings.each do |heading|
expect(page).to have_content I18n.t("admin.product_import.product_headings.#{heading}").upcase
end
end
end
end
end
describe "when dealing with uploaded files" do