Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-23 01:40:29 +01:00
converted all the server side strings to translation ready strings
Dieser Commit ist enthalten in:
Ursprung
bf9ceb6dd3
Commit
e4de1d4145
2 geänderte Dateien mit 16 neuen und 5 gelöschten Zeilen
|
@ -10,6 +10,15 @@ en:
|
||||||
too_short: "%{label} must be at least %{min} characters"
|
too_short: "%{label} must be at least %{min} characters"
|
||||||
none: "We couldn't find a wizard at that address."
|
none: "We couldn't find a wizard at that address."
|
||||||
no_skip: "Wizard can't be skipped"
|
no_skip: "Wizard can't be skipped"
|
||||||
|
export:
|
||||||
|
error:
|
||||||
|
select_one: "Please select atleast one wizard"
|
||||||
|
import:
|
||||||
|
error:
|
||||||
|
no_file: "No file selected"
|
||||||
|
file_large: "File too large"
|
||||||
|
invalid_json: "File is not a valid json file"
|
||||||
|
no_valid_wizards: "File doesn't contain any valid wizards"
|
||||||
|
|
||||||
site_settings:
|
site_settings:
|
||||||
wizard_redirect_exclude_paths: "Routes excluded from wizard redirects."
|
wizard_redirect_exclude_paths: "Routes excluded from wizard redirects."
|
||||||
|
|
|
@ -10,7 +10,7 @@ class CustomWizard::TransferController < ::ApplicationController
|
||||||
wizards = params['wizards']
|
wizards = params['wizards']
|
||||||
wizard_objects = []
|
wizard_objects = []
|
||||||
if wizards.nil?
|
if wizards.nil?
|
||||||
render json: {error: 'Please select atleast one wizard'}
|
render json: {error: I18n.t('wizard.export.error.select_one')}
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,17 +33,19 @@ class CustomWizard::TransferController < ::ApplicationController
|
||||||
def import
|
def import
|
||||||
file = File.read(params['file'].tempfile)
|
file = File.read(params['file'].tempfile)
|
||||||
if file.nil?
|
if file.nil?
|
||||||
render json: {error: "No file selected"}
|
render json: {error: I18n.t('wizard.import.error.no_file')}
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
fileSize = file.size
|
fileSize = file.size
|
||||||
maxFileSize = 512 * 1024
|
maxFileSize = 512 * 1024
|
||||||
if maxFileSize < fileSize
|
if maxFileSize < fileSize
|
||||||
render json: {error: "File too large"}
|
render json: {error: I18n.t('wizard.import.error.file_large')}
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
unless is_json file
|
unless is_json file
|
||||||
render json: {error: "File is not a valid json file"}
|
render json: {error: I18n.t('wizard.import.error.invalid_json')}
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
jsonObject = JSON.parse file
|
jsonObject = JSON.parse file
|
||||||
|
@ -64,7 +66,7 @@ class CustomWizard::TransferController < ::ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if countValid == 0
|
if countValid == 0
|
||||||
render json: {error: "File doesn't contain any valid wizards"}
|
render json: {error: I18n.t('wizard.import.error.no_valid_wizards')}
|
||||||
else
|
else
|
||||||
render json: {success: success_ids, failed: failed_ids}
|
render json: {success: success_ids, failed: failed_ids}
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren