From 8021efb72de27d968af2b8305f49be43e1c42086 Mon Sep 17 00:00:00 2001 From: antony liu Date: Thu, 9 May 2019 08:39:08 +0000 Subject: i18n: externalize strings from user profile settings --- app/controllers/profiles_controller.rb | 6 ++--- app/views/layouts/nav/sidebar/_profile.html.haml | 2 +- app/views/profiles/show.html.haml | 14 +++++----- .../unreleased/antonyliu-i18n-user-profile.yml | 5 ++++ locale/gitlab.pot | 30 ++++++++++++++++++++++ 5 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 changelogs/unreleased/antonyliu-i18n-user-profile.yml diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index d3746248bd3..1d16ddb1608 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -15,7 +15,7 @@ class ProfilesController < Profiles::ApplicationController result = Users::UpdateService.new(current_user, user_params.merge(user: @user)).execute if result[:status] == :success - message = "Profile was successfully updated" + message = s_("Profiles|Profile was successfully updated") format.html { redirect_back_or_default(default: { action: 'show' }, options: { notice: message }) } format.json { render json: { message: message } } @@ -31,7 +31,7 @@ class ProfilesController < Profiles::ApplicationController user.reset_incoming_email_token! end - flash[:notice] = "Incoming email token was successfully reset" + flash[:notice] = s_("Profiles|Incoming email token was successfully reset") redirect_to profile_personal_access_tokens_path end @@ -41,7 +41,7 @@ class ProfilesController < Profiles::ApplicationController user.reset_feed_token! end - flash[:notice] = 'Feed token was successfully reset' + flash[:notice] = s_('Profiles|Feed token was successfully reset') redirect_to profile_personal_access_tokens_path end diff --git a/app/views/layouts/nav/sidebar/_profile.html.haml b/app/views/layouts/nav/sidebar/_profile.html.haml index 1e3bb8f1224..2061eac917f 100644 --- a/app/views/layouts/nav/sidebar/_profile.html.haml +++ b/app/views/layouts/nav/sidebar/_profile.html.haml @@ -4,7 +4,7 @@ = link_to profile_path, title: _('Profile Settings') do .avatar-container.s40.settings-avatar = image_tag avatar_icon_for_user(current_user, 40), class: "avatar s40 avatar-tile", alt: current_user.name - .sidebar-context-title User Settings + .sidebar-context-title= _('User Settings') %ul.sidebar-top-level-items = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do = link_to profile_path do diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 45b6453b5ff..917e7acc353 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -92,8 +92,8 @@ = f.text_field :name, required: true, readonly: true, wrapper: { class: 'col-md-9 qa-full-name' }, help: s_("Profiles|Your name was automatically set based on your %{provider_label} account, so people you know can recognize you") % { provider_label: attribute_provider_label(:name) } - else - = f.text_field :name, label: 'Full name', required: true, title: s_("Profiles|Using emojis in names seems fun, but please try to set a status message instead"), wrapper: { class: 'col-md-9 qa-full-name' }, help: s_("Profiles|Enter your name, so people you know can recognize you") - = f.text_field :id, readonly: true, label: 'User ID', wrapper: { class: 'col-md-3' } + = f.text_field :name, label: s_('Profiles|Full name'), required: true, title: s_("Profiles|Using emojis in names seems fun, but please try to set a status message instead"), wrapper: { class: 'col-md-9 qa-full-name' }, help: s_("Profiles|Enter your name, so people you know can recognize you") + = f.text_field :id, readonly: true, label: s_('Profiles|User ID'), wrapper: { class: 'col-md-3' } = render_if_exists 'profiles/email_settings', form: f = f.text_field :skype, class: 'input-md', placeholder: s_("Profiles|username") @@ -103,18 +103,18 @@ - if @user.read_only_attribute?(:location) = f.text_field :location, readonly: true, help: s_("Profiles|Your location was automatically set based on your %{provider_label} account") % { provider_label: attribute_provider_label(:location) } - else - = f.text_field :location, class: 'input-lg', placeholder: s_("Profiles|City, country") - = f.text_field :organization, class: 'input-md', help: s_("Profiles|Who you represent or work for") - = f.text_area :bio, rows: 4, maxlength: 250, help: s_("Profiles|Tell us about yourself in fewer than 250 characters") + = f.text_field :location, label: s_('Profiles|Location'), class: 'input-lg', placeholder: s_("Profiles|City, country") + = f.text_field :organization, label: s_('Profiles|Organization'), class: 'input-md', help: s_("Profiles|Who you represent or work for") + = f.text_area :bio, label: s_('Profiles|Bio'), rows: 4, maxlength: 250, help: s_("Profiles|Tell us about yourself in fewer than 250 characters") %hr - %h5= ("Private profile") + %h5= s_("Private profile") .checkbox-icon-inline-wrapper - private_profile_label = capture do = s_("Profiles|Don't display activity-related personal information on your profiles") = f.check_box :private_profile, label: private_profile_label, inline: true, wrapper_class: 'mr-0' = link_to icon('question-circle'), help_page_path('user/profile/index.md', anchor: 'private-profile') %h5= s_("Profiles|Private contributions") - = f.check_box :include_private_contributions, label: 'Include private contributions on my profile', wrapper_class: 'mb-2', inline: true + = f.check_box :include_private_contributions, label: s_('Profiles|Include private contributions on my profile'), wrapper_class: 'mb-2', inline: true .help-block = s_("Profiles|Choose to show contributions of private projects on your public profile without any project, repository or organization information") .prepend-top-default.append-bottom-default diff --git a/changelogs/unreleased/antonyliu-i18n-user-profile.yml b/changelogs/unreleased/antonyliu-i18n-user-profile.yml new file mode 100644 index 00000000000..f9065ee5697 --- /dev/null +++ b/changelogs/unreleased/antonyliu-i18n-user-profile.yml @@ -0,0 +1,5 @@ +--- +title: 'i18n: externalize strings from user profile settings' +merge_request: 28088 +author: Antony Liu +type: other diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 6a3184175f4..71ec8bcb9ba 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -7061,6 +7061,9 @@ msgstr "" msgid "Private - The group and its projects can only be viewed by members." msgstr "" +msgid "Private profile" +msgstr "" + msgid "Private projects can be created in your personal namespace with:" msgstr "" @@ -7100,6 +7103,9 @@ msgstr "" msgid "Profiles|Avatar will be removed. Are you sure?" msgstr "" +msgid "Profiles|Bio" +msgstr "" + msgid "Profiles|Change username" msgstr "" @@ -7160,6 +7166,18 @@ msgstr "" msgid "Profiles|Enter your name, so people you know can recognize you" msgstr "" +msgid "Profiles|Feed token was successfully reset" +msgstr "" + +msgid "Profiles|Full name" +msgstr "" + +msgid "Profiles|Include private contributions on my profile" +msgstr "" + +msgid "Profiles|Incoming email token was successfully reset" +msgstr "" + msgid "Profiles|Increase your account's security by enabling Two-Factor Authentication (2FA)" msgstr "" @@ -7172,6 +7190,9 @@ msgstr "" msgid "Profiles|Learn more" msgstr "" +msgid "Profiles|Location" +msgstr "" + msgid "Profiles|Made a private contribution" msgstr "" @@ -7181,6 +7202,9 @@ msgstr "" msgid "Profiles|No file chosen" msgstr "" +msgid "Profiles|Organization" +msgstr "" + msgid "Profiles|Path" msgstr "" @@ -7190,6 +7214,9 @@ msgstr "" msgid "Profiles|Private contributions" msgstr "" +msgid "Profiles|Profile was successfully updated" +msgstr "" + msgid "Profiles|Public Avatar" msgstr "" @@ -7253,6 +7280,9 @@ msgstr "" msgid "Profiles|Use a private email - %{email}" msgstr "" +msgid "Profiles|User ID" +msgstr "" + msgid "Profiles|Username change failed - %{message}" msgstr "" -- cgit v1.2.1