From bd86796dd0edae7e5db2bfbb887d3196498ebd49 Mon Sep 17 00:00:00 2001 From: Ruben Davila Date: Wed, 12 Apr 2017 23:23:02 -0500 Subject: [PATCH] Add support to change language in profile form --- app/controllers/profiles_controller.rb | 3 ++- app/views/profiles/show.html.haml | 3 +++ lib/gitlab/i18n.rb | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 lib/gitlab/i18n.rb diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 987b95e89b9..57e23cea00e 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -85,7 +85,8 @@ class ProfilesController < Profiles::ApplicationController :twitter, :username, :website_url, - :organization + :organization, + :preferred_language ) end end diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index c74b3249a13..dc71a04cbf0 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -72,6 +72,9 @@ = f.label :public_email, class: "label-light" = f.select :public_email, options_for_select(@user.all_emails, selected: @user.public_email), { include_blank: 'Do not show on profile' }, class: "select2" %span.help-block This email will be displayed on your public profile. + .form-group + = f.label :preferred_language, class: "label-light" + = f.select :preferred_language, Gitlab::I18n::AVAILABLE_LANGUAGES, {}, class: "select2" .form-group = f.label :skype, class: "label-light" = f.text_field :skype, class: "form-control" diff --git a/lib/gitlab/i18n.rb b/lib/gitlab/i18n.rb new file mode 100644 index 00000000000..8c578aa0b46 --- /dev/null +++ b/lib/gitlab/i18n.rb @@ -0,0 +1,9 @@ +module Gitlab + module I18n + AVAILABLE_LANGUAGES = [ + [_('English'), 'en'], + [_('Spanish'), 'es'], + [_('Deutsch'), 'de'] + ] + end +end