Skip to content

Commit 8afe8ef

Browse files
committed
Add locale support on custom import view*
Should update it on the project page in Example9 on http://fivell.github.io/active_admin_import/ ``` <p> <%= raw(@active_admin_import_model.hint) %> </p> <%= semantic_form_for @active_admin_import_model, url: {action: :do_import}, html: {multipart: true} do |f| %> <%= f.inputs do %> <%= f.input :file, as: :file, label: t('active_admin_import.file') %> <% end %> <%= f.inputs t("active_admin_import.csv_options"), for: [:csv_options, OpenStruct.new(@active_admin_import_model.csv_options)] do |csv| %> <% csv.with_options input_html: {style: 'width:40px;'} do |opts| %> <%= opts.input :col_sep, label: t("active_admin_import.col_sep") %> <%= opts.input :row_sep, label: t("active_admin_import.row_sep") %> <%= opts.input :quote_char, label: t("active_admin_import.quote_char") %> <% end %> <% end %> <%= f.actions do %> <%= f.action :submit, label: t("active_admin_import.import_btn"), button_html: {disable_with: t("active_admin_import.import_btn_disabled")} %> <% end %> <% end %> ``` Conflicts: config/locales/en.yml
1 parent 3809ca9 commit 8afe8ef

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

config/locales/en.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ en:
22
active_admin:
33
import: "Import"
44
active_admin_import:
5+
file: 'File'
56
file_error: "Error: %{message}"
67
file_format_error: "You can import only valid csv file"
78
file_empty_error: "You can't import empty file"
@@ -15,4 +16,8 @@ en:
1516
other: "Failed to import %{count} %{plural_model}"
1617
import_model: "Import %{plural_model}"
1718
import_btn: "Import"
18-
import_btn_disabled: "Wait..."
19+
import_btn_disabled: "Wait..."
20+
csv_options: "CSV options"
21+
col_sep: 'Col sep'
22+
row_sep: 'Row sep'
23+
quote_char: 'Quote char'

config/locales/zh-CN.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ zh-CN:
33
import: "导入"
44
do_import: "导入"
55
active_admin_import:
6+
file: '文件'
67
file_error: "导入错误: %{message}"
78
file_format_error: "请您上传 CSV 格式的文件"
89
file_empty_error: "您上传的文件为空"
@@ -17,3 +18,7 @@ zh-CN:
1718
import_model: "导入%{plural_model}"
1819
import_btn: "导入"
1920
import_btn_disabled: "请稍等..."
21+
csv_options: "选项"
22+
col_sep: '列分隔符'
23+
row_sep: '行分隔符'
24+
quote_char: '引用字符'

0 commit comments

Comments
 (0)