Reorder translations and add missing prefixes

- files should be prefixed with code_ocean/
- the markdown editor is part of the application (helper)
This commit is contained in:
Sebastian Serth
2024-04-14 12:08:44 +02:00
committed by Sebastian Serth
parent 1589c9472b
commit e551c8a699
98 changed files with 2687 additions and 2357 deletions

View File

@ -8,7 +8,7 @@
const BACKTICK = 192;
// These counters can be global. Scoping them to each editor becomes redundant
// since they are reset to this state when switching editors.
// since they are reset to this state when switching editors.
// Read more: https://github.com/openHPI/codeocean/pull/2242#discussion_r1576617432
let backtickPressedCount = 0;
let justInsertedCodeBlock = false;
@ -180,14 +180,14 @@ const setResizeBtn = (formInput, editor) => {
editor.setHeight("auto");
editor.setMinHeight("400px");
resizeBtn.classList.add("markdown-editor__resize-btn--collapse");
resizeBtn.title = I18n.t("markdown_editor.collapse");
resizeBtn.ariaLabel = I18n.t("markdown_editor.collapse");
resizeBtn.title = I18n.t("application.markdown_editor.collapse");
resizeBtn.ariaLabel = I18n.t("application.markdown_editor.collapse");
} else {
editor.setHeight("300px");
editor.setMinHeight("300px");
resizeBtn.classList.remove("markdown-editor__resize-btn--collapse");
resizeBtn.title = I18n.t("markdown_editor.expand");
resizeBtn.ariaLabel = I18n.t("markdown_editor.expand");
resizeBtn.title = I18n.t("application.markdown_editor.expand");
resizeBtn.ariaLabel = I18n.t("application.markdown_editor.expand");
}
});
};

View File

@ -66,7 +66,7 @@ module CodeOcean
else
filename = "#{@object.path || ''}/#{@object.name || ''}#{@object.file_type.try(:file_extension) || ''}"
format.html do
flash[:danger] = t('files.error.filename', name: filename)
flash[:danger] = t('code_ocean/files.error.filename', name: filename)
redirect_to(options[:path])
end
format.json { render(json: @object.errors, status: :unprocessable_entity) }

View File

@ -30,7 +30,7 @@ class MarkdownFormBuilder < ActionView::Helpers::FormBuilder
def resize_btn
@template.tag.button(class: 'markdown-editor__resize-btn fa-solid', type: 'button', id: "#{label_target}-resize",
title: I18n.t(:'markdown_editor.expand'), aria_label: I18n.t(:'markdown_editor.expand'))
title: I18n.t(:'application.markdown_editor.expand'), aria_label: I18n.t(:'application.markdown_editor.expand'))
end
def base_id

View File

@ -1,19 +1,19 @@
= form_for(CodeOcean::File.new) do |f|
.mb-3
= f.label(:name, t('activerecord.attributes.file.name'), class: 'form-label')
= f.label(:name, class: 'form-label')
= f.text_field(:name, class: 'form-control', required: true)
.mb-3
= f.label(:path, t('activerecord.attributes.file.path'), class: 'form-label')
= f.label(:path, class: 'form-label')
| &nbsp;
a.toggle-input data={text_initial: t('shared.new'), text_toggled: t('shared.back')} href='#' = t('shared.new')
.original-input = f.select(:path, @paths, {}, class: 'form-control')
= f.text_field(:path, class: 'alternative-input form-control', disabled: true)
.mb-3
= f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'), class: 'form-label')
= f.label(:file_type_id, class: 'form-label')
= f.collection_select(:file_type_id, FileType.where(binary: false).order(:name), :id, :name, {selected: @exercise.execution_environment.file_type.try(:id)}, class: 'form-control')
- if FileTemplate.any?
.mb-3
= f.label(:file_template_id, t('activerecord.attributes.file.file_template_id'), class: 'form-label')
= f.label(:file_template_id, class: 'form-label')
= f.collection_select(:file_template_id, FileTemplate.order(:name), :id, :name, {include_blank: true}, class: 'form-control')
= f.hidden_field(:context_id)
.d-none#noTemplateLabel data-text=t('file_template.no_template_label')

View File

@ -1,5 +1,5 @@
.mb-3
= form.label(attribute, label, class: 'form-label')
= form.label(attribute, class: 'form-label')
= form.text_area(attribute, class: 'code-field form-control', rows: 16, style: 'display:none;')
= render partial: 'editor_edit', locals: {exercise: @exercise}
.card.border-warning.p-2.my-2

View File

@ -14,38 +14,38 @@ li.card.mt-2
.clearfix
.btn.btn-warning.btn-sm.float-end.delete-file data-file-url=code_ocean_file_path(id) = t('shared.destroy')
.mb-3
= f.label(:name, t('activerecord.attributes.file.name'), class: 'form-label')
= f.label(:name, class: 'form-label')
= f.text_field(:name, class: 'form-control')
.mb-3
= f.label(:path, t('activerecord.attributes.file.path'), class: 'form-label')
= f.label(:path, class: 'form-label')
= f.text_field(:path, class: 'form-control')
.help-block.form-text = t('.hints.path')
.mb-3
= f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'), class: 'form-label')
= f.label(:file_type_id, class: 'form-label')
= f.collection_select(:file_type_id, @file_types, :id, :name, {}, class: 'form-control')
.mb-3
= f.label(:role, t('activerecord.attributes.file.role'), class: 'form-label')
= f.select(:role, CodeOcean::File::TEACHER_DEFINED_ROLES.map {|role| [t("files.roles.#{role}"), role] }, {}, class: 'form-control')
= f.label(:role, class: 'form-label')
= f.select(:role, CodeOcean::File::TEACHER_DEFINED_ROLES.map {|role| [t("code_ocean/files.roles.#{role}"), role] }, {}, class: 'form-control')
.form-check
label.form-check-label
= f.check_box(:hidden, class: 'form-check-input')
= t('activerecord.attributes.file.hidden')
= f.label(:hidden, class: 'form-label mb-0')
.form-check
label.form-check-label
= f.check_box(:read_only, class: 'form-check-input')
= t('activerecord.attributes.file.read_only')
= f.label(:read_only, class: 'form-label mb-0')
.test-related-fields style="display: #{f.object.teacher_defined_assessment? ? 'initial' : 'none'};"
.mb-3
.form-check
label.form-check-label
= f.check_box(:hidden_feedback, class: 'form-check-input')
= f.label(:hidden_feedback, t('activerecord.attributes.file.hidden_feedback'), class: 'form-label mb-0')
= f.label(:hidden_feedback, class: 'form-label mb-0')
.help-block.form-text.mb-0 = t('.hints.hidden_feedback')
.mb-3
= f.label(:name, t('activerecord.attributes.file.feedback_message'), class: 'form-label')
= f.label(:name, class: 'form-label')
= f.text_area(:feedback_message, class: 'form-control', maxlength: 255)
.help-block.form-text = t('.hints.feedback_message')
.mb-3
= f.label(:role, t('activerecord.attributes.file.weight'), class: 'form-label')
= f.label(:role, class: 'form-label')
= f.number_field(:weight, class: 'form-control', min: 0, step: 'any')
= render('code_field', attribute: :content, form: f, label: t('activerecord.attributes.file.content'))
= render('code_field', attribute: :content, form: f)

View File

@ -1,11 +1,11 @@
= row(label: 'file.name', value: file.name)
= row(label: 'file.path', value: file.path)
= row(label: 'file.file_type', value: link_to_if(policy(file).show?, file.file_type, file.file_type))
= row(label: 'file.role', value: file.role? ? t("files.roles.#{file.role}") : '')
= row(label: 'file.hidden', value: file.hidden)
= row(label: 'file.read_only', value: file.read_only)
= row(label: 'code_ocean/file.name', value: file.name)
= row(label: 'code_ocean/file.path', value: file.path)
= row(label: 'code_ocean/file.file_type', value: link_to_if(policy(file).show?, file.file_type, file.file_type))
= row(label: 'code_ocean/file.role', value: file.role? ? t("code_ocean/files.roles.#{file.role}") : '')
= row(label: 'code_ocean/file.hidden', value: file.hidden)
= row(label: 'code_ocean/file.read_only', value: file.read_only)
- if file.teacher_defined_assessment?
= row(label: 'file.hidden_feedback', value: file.hidden_feedback)
= row(label: 'file.feedback_message', value: render_markdown(file.feedback_message), class: 'm-0')
= row(label: 'file.weight', value: file.weight)
= row(label: 'file.content', value: file.native_file? ? link_to_if(policy(file).show?, file.native_file.file.filename, protected_upload_path(id: file.id, filename: file.filepath)) : code_tag(file.content, file.file_type.programming_language))
= row(label: 'code_ocean/file.hidden_feedback', value: file.hidden_feedback)
= row(label: 'code_ocean/file.feedback_message', value: render_markdown(file.feedback_message), class: 'm-0')
= row(label: 'code_ocean/file.weight', value: file.weight)
= row(label: 'code_ocean/file.content', value: file.native_file? ? link_to_if(policy(file).show?, file.native_file.file.filename, protected_upload_path(id: file.id, filename: file.filepath)) : code_tag(file.content, file.file_type.programming_language))

View File

@ -11,5 +11,5 @@ h1
= row(label: 'tip.title', value: @tip.title)
= row(label: 'tip.description', value: render_markdown(@tip.description), class: 'm-0')
= row(label: 'file.file_type', value: @tip.file_type_id? ? link_to_if(policy(@tip.file_type).show?, @tip.file_type.name, @tip.file_type) : '')
= row(label: 'code_ocean/file.file_type', value: @tip.file_type_id? ? link_to_if(policy(@tip.file_type).show?, @tip.file_type.name, @tip.file_type) : '')
= row(label: 'tip.example', value: @tip.file_type_id? ? code_tag(@tip.example, @tip.file_type.programming_language) : '')