From bc4a6417494e33d9887c4cb0ba1cc29a8bacdc05 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Mon, 7 Jan 2019 20:08:19 +0000 Subject: Externalize strings from `/app/views/shared/notes` --- app/views/shared/notes/_comment_button.html.haml | 19 +++--- app/views/shared/notes/_edit.html.haml | 2 +- app/views/shared/notes/_edit_form.html.haml | 8 +-- app/views/shared/notes/_form.html.haml | 6 +- app/views/shared/notes/_hints.html.haml | 12 ++-- app/views/shared/notes/_note.html.haml | 4 +- app/views/shared/notes/_notes_with_form.html.haml | 14 ++--- .../gt-externalize-app-views-shared-notes.yml | 5 ++ locale/gitlab.pot | 69 ++++++++++++++++++++++ 9 files changed, 104 insertions(+), 35 deletions(-) create mode 100644 changelogs/unreleased/gt-externalize-app-views-shared-notes.yml diff --git a/app/views/shared/notes/_comment_button.html.haml b/app/views/shared/notes/_comment_button.html.haml index 0674c822d63..f487c0bf0d5 100644 --- a/app/views/shared/notes/_comment_button.html.haml +++ b/app/views/shared/notes/_comment_button.html.haml @@ -1,30 +1,31 @@ - noteable_name = @note.noteable.human_class_name .float-left.btn-group.append-right-10.droplab-dropdown.comment-type-dropdown.js-comment-type-dropdown - %input.btn.btn-nr.btn-success.comment-btn.js-comment-button.js-comment-submit-button{ type: 'submit', value: 'Comment' } + %input.btn.btn-nr.btn-success.comment-btn.js-comment-button.js-comment-submit-button{ type: 'submit', value: _('Comment') } - if @note.can_be_discussion_note? - = button_tag type: 'button', class: 'btn btn-nr dropdown-toggle comment-btn js-note-new-discussion js-disable-on-submit', data: { 'dropdown-trigger' => '#resolvable-comment-menu' }, 'aria-label' => 'Open comment type dropdown' do + = button_tag type: 'button', class: 'btn btn-nr dropdown-toggle comment-btn js-note-new-discussion js-disable-on-submit', data: { 'dropdown-trigger' => '#resolvable-comment-menu' }, 'aria-label' => _('Open comment type dropdown') do = icon('caret-down', class: 'toggle-icon') %ul#resolvable-comment-menu.dropdown-menu.dropdown-open-top{ data: { dropdown: true } } - %li#comment.droplab-item-selected{ data: { value: '', 'submit-text' => 'Comment', 'close-text' => "Comment & close #{noteable_name}", 'reopen-text' => "Comment & reopen #{noteable_name}" } } + %li#comment.droplab-item-selected{ data: { value: '', 'submit-text' => _('Comment'), 'close-text' => _("Comment & close %{noteable_name}") % { noteable_name: noteable_name }, 'reopen-text' => _("Comment & reopen %{noteable_name}") % { noteable_name: noteable_name } } } %button.btn.btn-transparent = icon('check', class: 'icon') .description - %strong Comment + %strong= _("Comment") %p - Add a general comment to this #{noteable_name}. + = _("Add a general comment to this %{noteable_name}.") % { noteable_name: noteable_name } %li.divider.droplab-item-ignore - %li#discussion{ data: { value: 'DiscussionNote', 'submit-text' => 'Start discussion', 'close-text' => "Start discussion & close #{noteable_name}", 'reopen-text' => "Start discussion & reopen #{noteable_name}" } } + %li#discussion{ data: { value: 'DiscussionNote', 'submit-text' => _('Start discussion'), 'close-text' => _("Start discussion & close %{noteable_name}") % { noteable_name: noteable_name }, 'reopen-text' => _("Start discussion & reopen %{noteable_name}") % { noteable_name: noteable_name } } } %button.btn.btn-transparent = icon('check', class: 'icon') .description - %strong Start discussion + %strong= _("Start discussion") %p = succeed '.' do - Discuss a specific suggestion or question - if @note.noteable.supports_resolvable_notes? - that needs to be resolved + = _('Discuss a specific suggestion or question that needs to be resolved') + - else + = _('Discuss a specific suggestion or question') diff --git a/app/views/shared/notes/_edit.html.haml b/app/views/shared/notes/_edit.html.haml index f4b3aac29b4..84a3ef9d8fe 100644 --- a/app/views/shared/notes/_edit.html.haml +++ b/app/views/shared/notes/_edit.html.haml @@ -1 +1 @@ -%textarea.hidden.js-task-list-field.original-task-list{ data: {update_url: note_url(note) } }= note.note +%textarea.hidden.js-task-list-field.original-task-list{ data: { update_url: note_url(note) } }= note.note diff --git a/app/views/shared/notes/_edit_form.html.haml b/app/views/shared/notes/_edit_form.html.haml index fec966069b9..6fe511c2999 100644 --- a/app/views/shared/notes/_edit_form.html.haml +++ b/app/views/shared/notes/_edit_form.html.haml @@ -3,12 +3,12 @@ = hidden_field_tag :target_id, '', class: 'js-form-target-id' = hidden_field_tag :target_type, '', class: 'js-form-target-type' = render layout: 'projects/md_preview', locals: { url: preview_markdown_path(project), referenced_users: true } do - = render 'projects/zen', attr: 'note[note]', classes: 'note-textarea js-note-text js-task-list-field', placeholder: "Write a comment or drag your files here…" + = render 'projects/zen', attr: 'note[note]', classes: 'note-textarea js-note-text js-task-list-field', placeholder: _("Write a comment or drag your files here…") = render 'shared/notes/hints' .note-form-actions.clearfix .settings-message.note-edit-warning.js-finish-edit-warning - Finish editing this message first! - = submit_tag 'Save comment', class: 'btn btn-nr btn-success js-comment-save-button' + = _("Finish editing this message first!") + = submit_tag _('Save comment'), class: 'btn btn-nr btn-success js-comment-save-button' %button.btn.btn-nr.btn-cancel.note-edit-cancel{ type: 'button' } - Cancel + = _("Cancel") diff --git a/app/views/shared/notes/_form.html.haml b/app/views/shared/notes/_form.html.haml index 493c6241257..6a1eea85fde 100644 --- a/app/views/shared/notes/_form.html.haml +++ b/app/views/shared/notes/_form.html.haml @@ -29,7 +29,7 @@ = render 'projects/zen', f: f, attr: :note, classes: 'note-textarea js-note-text', - placeholder: "Write a comment or drag your files here…", + placeholder: _("Write a comment or drag your files here…"), supports_quick_actions: supports_quick_actions, supports_autocomplete: supports_autocomplete = render 'shared/notes/hints', supports_quick_actions: supports_quick_actions @@ -40,5 +40,5 @@ = yield(:note_actions) - %a.btn.btn-cancel.js-close-discussion-note-form.hide{ role: "button", data: {cancel_text: "Cancel" } } - Cancel + %a.btn.btn-cancel.js-close-discussion-note-form.hide{ role: "button", data: { cancel_text: _("Cancel") } } + = _('Cancel') diff --git a/app/views/shared/notes/_hints.html.haml b/app/views/shared/notes/_hints.html.haml index 00eae553279..46f3f8428f1 100644 --- a/app/views/shared/notes/_hints.html.haml +++ b/app/views/shared/notes/_hints.html.haml @@ -1,10 +1,10 @@ - supports_quick_actions = local_assigns.fetch(:supports_quick_actions, false) .comment-toolbar.clearfix .toolbar-text - = link_to 'Markdown', help_page_path('user/markdown'), target: '_blank', tabindex: -1 + = link_to _('Markdown'), help_page_path('user/markdown'), target: '_blank', tabindex: -1 - if supports_quick_actions and - = link_to 'quick actions', help_page_path('user/project/quick_actions'), target: '_blank', tabindex: -1 + = link_to _('quick actions'), help_page_path('user/project/quick_actions'), target: '_blank', tabindex: -1 are - else is @@ -24,12 +24,12 @@ = icon('file-image-o', class: 'toolbar-button-icon') %span.uploading-error-message -# Populated by app/assets/javascripts/dropzone_input.js - %button.retry-uploading-link{ type: 'button' } Try again + %button.retry-uploading-link{ type: 'button' }= _("Try again") or - %button.attach-new-file.markdown-selector{ type: 'button' } attach a new file + %button.attach-new-file.markdown-selector{ type: 'button' }= _("attach a new file") %button.markdown-selector.button-attach-file{ type: 'button', tabindex: '-1' } = icon('file-image-o', class: 'toolbar-button-icon') - Attach a file + = _("Attach a file") - %button.btn.btn-default.btn-sm.hide.button-cancel-uploading-files{ type: 'button' } Cancel + %button.btn.btn-default.btn-sm.hide.button-cancel-uploading-files{ type: 'button' }= _("Cancel") diff --git a/app/views/shared/notes/_note.html.haml b/app/views/shared/notes/_note.html.haml index e125d7f108a..cb5c64fb91d 100644 --- a/app/views/shared/notes/_note.html.haml +++ b/app/views/shared/notes/_note.html.haml @@ -62,7 +62,7 @@ = render 'award_emoji/awards_block', awardable: note, inline: false - if note.system .system-note-commit-list-toggler.hide - Toggle commit list + = _("Toggle commit list") %i.fa.fa-angle-down - if note.attachment.url .note-attachment @@ -74,5 +74,5 @@ = icon('paperclip') = note.attachment_identifier = link_to delete_attachment_project_note_path(note.project, note), - title: 'Delete this attachment', method: :delete, remote: true, data: { confirm: 'Are you sure you want to remove the attachment?' }, class: 'danger js-note-attachment-delete' do + title: _('Delete this attachment'), method: :delete, remote: true, data: { confirm: _('Are you sure you want to remove the attachment?') }, class: 'danger js-note-attachment-delete' do = icon('trash-o', class: 'cred') diff --git a/app/views/shared/notes/_notes_with_form.html.haml b/app/views/shared/notes/_notes_with_form.html.haml index 4c4050c6054..002189e6ecd 100644 --- a/app/views/shared/notes/_notes_with_form.html.haml +++ b/app/views/shared/notes/_notes_with_form.html.haml @@ -19,20 +19,14 @@ = render "shared/notes/form", view: diff_view, supports_autocomplete: autocomplete - elsif !current_user .disabled-comment.text-center.prepend-top-default - Please - = link_to "register", new_session_path(:user, redirect_to_referer: 'yes', anchor: 'register-pane'), class: 'js-register-link' - or - = link_to "sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'js-sign-in-link' - to comment + - link_to_register = link_to(_("register"), new_session_path(:user, redirect_to_referer: 'yes', anchor: 'register-pane'), class: 'js-register-link') + - link_to_sign_in = link_to(_("sign in"), new_session_path(:user, redirect_to_referer: 'yes'), class: 'js-sign-in-link') + = _("Please %{link_to_register} or %{link_to_sign_in} to comment").html_safe % { link_to_register: link_to_register, link_to_sign_in: link_to_sign_in } - elsif discussion_locked .disabled-comment.text-center.prepend-top-default %span.issuable-note-warning = sprite_icon('lock', size: 16, css_class: 'icon') %span - This - = issuable.class.to_s.titleize.downcase - is locked. Only - %b project members - can comment. + = _("This %{issuable} is locked. Only project members can comment.").html_safe % { issuable: issuable.class.to_s.titleize.downcase } -# haml-lint:disable InlineJavaScript %script.js-notes-data{ type: "application/json" }= initial_notes_data(autocomplete).to_json.html_safe diff --git a/changelogs/unreleased/gt-externalize-app-views-shared-notes.yml b/changelogs/unreleased/gt-externalize-app-views-shared-notes.yml new file mode 100644 index 00000000000..39ca6b67a54 --- /dev/null +++ b/changelogs/unreleased/gt-externalize-app-views-shared-notes.yml @@ -0,0 +1,5 @@ +--- +title: Externalize strings from `/app/views/shared/notes` +merge_request: 23696 +author: Tao Wang +type: other diff --git a/locale/gitlab.pot b/locale/gitlab.pot index f25f9cc531a..6e38425034f 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -372,6 +372,9 @@ msgstr "" msgid "Add README" msgstr "" +msgid "Add a general comment to this %{noteable_name}." +msgstr "" + msgid "Add a homepage to your wiki that contains information about your project and GitLab will display it here instead of this message." msgstr "" @@ -705,6 +708,9 @@ msgstr "" msgid "Are you sure you want to remove %{group_name}?" msgstr "" +msgid "Are you sure you want to remove the attachment?" +msgstr "" + msgid "Are you sure you want to remove this identity?" msgstr "" @@ -759,6 +765,9 @@ msgstr "" msgid "Assignee(s)" msgstr "" +msgid "Attach a file" +msgstr "" + msgid "Attach a file by drag & drop or %{upload_link}" msgstr "" @@ -1893,6 +1902,12 @@ msgstr "" msgid "Comment" msgstr "" +msgid "Comment & close %{noteable_name}" +msgstr "" + +msgid "Comment & reopen %{noteable_name}" +msgstr "" + msgid "Comment & resolve discussion" msgstr "" @@ -2390,6 +2405,9 @@ msgstr "" msgid "Delete list" msgstr "" +msgid "Delete this attachment" +msgstr "" + msgid "Deleted" msgstr "" @@ -2602,6 +2620,12 @@ msgstr "" msgid "Discover projects, groups and snippets. Share your projects with others" msgstr "" +msgid "Discuss a specific suggestion or question" +msgstr "" + +msgid "Discuss a specific suggestion or question that needs to be resolved" +msgstr "" + msgid "Dismiss" msgstr "" @@ -3112,6 +3136,9 @@ msgstr "" msgid "Fingerprints" msgstr "" +msgid "Finish editing this message first!" +msgstr "" + msgid "Finished" msgstr "" @@ -4078,6 +4105,9 @@ msgstr "" msgid "Mark todo as done" msgstr "" +msgid "Markdown" +msgstr "" + msgid "Markdown enabled" msgstr "" @@ -4676,6 +4706,9 @@ msgstr "" msgid "Open Documentation" msgstr "" +msgid "Open comment type dropdown" +msgstr "" + msgid "Open in Xcode" msgstr "" @@ -4970,6 +5003,9 @@ msgstr "" msgid "Play" msgstr "" +msgid "Please %{link_to_register} or %{link_to_sign_in} to comment" +msgstr "" + msgid "Please accept the Terms of Service before continuing." msgstr "" @@ -5832,6 +5868,9 @@ msgstr "" msgid "Save changes" msgstr "" +msgid "Save comment" +msgstr "" + msgid "Save pipeline schedule" msgstr "" @@ -6395,6 +6434,15 @@ msgstr "" msgid "Start date" msgstr "" +msgid "Start discussion" +msgstr "" + +msgid "Start discussion & close %{noteable_name}" +msgstr "" + +msgid "Start discussion & reopen %{noteable_name}" +msgstr "" + msgid "Start the Runner!" msgstr "" @@ -6731,6 +6779,9 @@ msgstr "" msgid "Third party offers" msgstr "" +msgid "This %{issuable} is locked. Only project members can comment." +msgstr "" + msgid "This %{viewer} could not be displayed because %{reason}. You can %{options} instead." msgstr "" @@ -7158,6 +7209,9 @@ msgstr "" msgid "Toggle commit description" msgstr "" +msgid "Toggle commit list" +msgstr "" + msgid "Toggle discussion" msgstr "" @@ -7662,6 +7716,9 @@ msgstr "" msgid "Withdraw Access Request" msgstr "" +msgid "Write a comment or drag your files here…" +msgstr "" + msgid "Yes" msgstr "" @@ -7872,6 +7929,9 @@ msgstr "" msgid "assign yourself" msgstr "" +msgid "attach a new file" +msgstr "" + msgid "branch name" msgstr "" @@ -8203,6 +8263,12 @@ msgstr "" msgid "project" msgstr "" +msgid "quick actions" +msgstr "" + +msgid "register" +msgstr "" + msgid "remaining" msgstr "" @@ -8223,6 +8289,9 @@ msgstr "" msgid "show less" msgstr "" +msgid "sign in" +msgstr "" + msgid "source" msgstr "" -- cgit v1.2.3