Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20: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"
|
||||
none: "We couldn't find a wizard at that address."
|
||||
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:
|
||||
wizard_redirect_exclude_paths: "Routes excluded from wizard redirects."
|
||||
|
|
|
@ -10,7 +10,7 @@ class CustomWizard::TransferController < ::ApplicationController
|
|||
wizards = params['wizards']
|
||||
wizard_objects = []
|
||||
if wizards.nil?
|
||||
render json: {error: 'Please select atleast one wizard'}
|
||||
render json: {error: I18n.t('wizard.export.error.select_one')}
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -33,17 +33,19 @@ class CustomWizard::TransferController < ::ApplicationController
|
|||
def import
|
||||
file = File.read(params['file'].tempfile)
|
||||
if file.nil?
|
||||
render json: {error: "No file selected"}
|
||||
render json: {error: I18n.t('wizard.import.error.no_file')}
|
||||
return
|
||||
end
|
||||
fileSize = file.size
|
||||
maxFileSize = 512 * 1024
|
||||
if maxFileSize < fileSize
|
||||
render json: {error: "File too large"}
|
||||
render json: {error: I18n.t('wizard.import.error.file_large')}
|
||||
return
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
jsonObject = JSON.parse file
|
||||
|
@ -64,7 +66,7 @@ class CustomWizard::TransferController < ::ApplicationController
|
|||
end
|
||||
|
||||
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
|
||||
render json: {success: success_ids, failed: failed_ids}
|
||||
end
|
||||
|
|
Laden …
In neuem Issue referenzieren