Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
7acaa674b856
Commit
73d0730d
authored
Apr 13, 2017
by
Ruben Davila
Browse files
Set locale through controller filter
parent
457c13a42d18
Changes
11
Hide whitespace changes
Inline
Side-by-side
app/controllers/application_controller.rb
View file @
7acaa674
...
...
@@ -265,4 +265,10 @@ def gitlab_project_import_enabled?
def
u2f_app_id
request
.
base_url
end
def
set_locale
requested_locale
=
current_user
&
.
preferred_language
||
request
.
env
[
'HTTP_ACCEPT_LANGUAGE'
]
||
I18n
.
default_locale
locale
=
FastGettext
.
set_locale
(
requested_locale
)
I18n
.
locale
=
locale
end
end
app/controllers/profiles_controller.rb
View file @
7acaa674
...
...
@@ -3,6 +3,7 @@ class ProfilesController < Profiles::ApplicationController
before_action
:user
before_action
:authorize_change_username!
,
only: :update_username
before_action
:set_locale
,
only: :show
skip_before_action
:require_email
,
only:
[
:show
,
:update
]
def
show
...
...
app/views/profiles/show.html.haml
View file @
7acaa674
...
...
@@ -74,7 +74,8 @@
%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"
=
f
.
select
:preferred_language
,
Gitlab
::
I18n
::
AVAILABLE_LANGUAGES
.
map
{
|
lang
|
[
_
(
lang
[
0
]),
lang
[
1
]]
},
{},
class:
"select2"
.form-group
=
f
.
label
:skype
,
class:
"label-light"
=
f
.
text_field
:skype
,
class:
"form-control"
...
...
lib/gitlab/i18n.rb
View file @
7acaa674
module
Gitlab
module
I18n
AVAILABLE_LANGUAGES
=
[
[
_
(
'English'
)
,
'en'
],
[
_
(
'Spanish'
)
,
'es'
],
[
_
(
'Deutsch'
)
,
'de'
]
[
'English'
,
'en'
],
[
'Spanish'
,
'es'
],
[
'Deutsch'
,
'de'
]
]
end
end
locale/de/gitlab.edit.po
View file @
7acaa674
...
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-1
2 22:36
-0500\n"
"POT-Creation-Date: 2017-04-1
3 00:01
-0500\n"
"PO-Revision-Date: 2017-04-12 22:37-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: German\n"
...
...
@@ -17,3 +17,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
msgid "Deutsch"
msgstr ""
msgid "English"
msgstr ""
msgid "Spanish"
msgstr ""
locale/de/gitlab.po
View file @
7acaa674
...
...
@@ -16,3 +16,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
msgid "Deutsch"
msgstr ""
msgid "English"
msgstr ""
msgid "Spanish"
msgstr ""
locale/en/gitlab.edit.po
View file @
7acaa674
...
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-1
2 22:36
-0500\n"
"POT-Creation-Date: 2017-04-1
3 00:01
-0500\n"
"PO-Revision-Date: 2017-04-12 22:36-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: English\n"
...
...
@@ -17,3 +17,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
msgid "Deutsch"
msgstr ""
msgid "English"
msgstr ""
msgid "Spanish"
msgstr ""
locale/en/gitlab.po
View file @
7acaa674
...
...
@@ -16,3 +16,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
msgid "Deutsch"
msgstr ""
msgid "English"
msgstr ""
msgid "Spanish"
msgstr ""
locale/es/gitlab.edit.po
View file @
7acaa674
...
...
@@ -7,13 +7,22 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-12 22:36-0500\n"
"PO-Revision-Date: 2017-04-12 22:37-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"PO-Revision-Date: 2017-04-13 00:07-0500\n"
"Language-Team: Spanish\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
"POT-Creation-Date: 2017-04-13 00:01-0500\n"
"Last-Translator: \n"
"X-Generator: Poedit 2.0.1\n"
msgid "Deutsch"
msgstr "Alemán"
msgid "English"
msgstr "Inglés"
msgid "Spanish"
msgstr "Español"
locale/es/gitlab.po
View file @
7acaa674
...
...
@@ -7,12 +7,21 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2017-04-12 22:37-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"PO-Revision-Date: 2017-04-13 00:07-0500\n"
"Language-Team: Spanish\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
"Last-Translator: \n"
"X-Generator: Poedit 2.0.1\n"
msgid "Deutsch"
msgstr "Alemán"
msgid "English"
msgstr "Inglés"
msgid "Spanish"
msgstr "Español"
locale/gitlab.pot
View file @
7acaa674
...
...
@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-1
2 22:36
-0500\n"
"PO-Revision-Date: 2017-04-1
2 22:36
-0500\n"
"POT-Creation-Date: 2017-04-1
3 00:01
-0500\n"
"PO-Revision-Date: 2017-04-1
3 00:01
-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
...
...
@@ -17,3 +17,12 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
msgid "Deutsch"
msgstr ""
msgid "English"
msgstr ""
msgid "Spanish"
msgstr ""
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment