Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
73d0730d
Commit
73d0730d
authored
Apr 13, 2017
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set locale through controller filter
parent
020e12a6
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
86 additions
and
15 deletions
+86
-15
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+6
-0
app/controllers/profiles_controller.rb
app/controllers/profiles_controller.rb
+1
-0
app/views/profiles/show.html.haml
app/views/profiles/show.html.haml
+2
-1
lib/gitlab/i18n.rb
lib/gitlab/i18n.rb
+3
-3
locale/de/gitlab.edit.po
locale/de/gitlab.edit.po
+10
-1
locale/de/gitlab.po
locale/de/gitlab.po
+9
-0
locale/en/gitlab.edit.po
locale/en/gitlab.edit.po
+10
-1
locale/en/gitlab.po
locale/en/gitlab.po
+9
-0
locale/es/gitlab.edit.po
locale/es/gitlab.edit.po
+13
-4
locale/es/gitlab.po
locale/es/gitlab.po
+12
-3
locale/gitlab.pot
locale/gitlab.pot
+11
-2
No files found.
app/controllers/application_controller.rb
View file @
73d0730d
...
@@ -265,4 +265,10 @@ class ApplicationController < ActionController::Base
...
@@ -265,4 +265,10 @@ class ApplicationController < ActionController::Base
def
u2f_app_id
def
u2f_app_id
request
.
base_url
request
.
base_url
end
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
end
app/controllers/profiles_controller.rb
View file @
73d0730d
...
@@ -3,6 +3,7 @@ class ProfilesController < Profiles::ApplicationController
...
@@ -3,6 +3,7 @@ class ProfilesController < Profiles::ApplicationController
before_action
:user
before_action
:user
before_action
:authorize_change_username!
,
only: :update_username
before_action
:authorize_change_username!
,
only: :update_username
before_action
:set_locale
,
only: :show
skip_before_action
:require_email
,
only:
[
:show
,
:update
]
skip_before_action
:require_email
,
only:
[
:show
,
:update
]
def
show
def
show
...
...
app/views/profiles/show.html.haml
View file @
73d0730d
...
@@ -74,7 +74,8 @@
...
@@ -74,7 +74,8 @@
%span
.help-block
This email will be displayed on your public profile.
%span
.help-block
This email will be displayed on your public profile.
.form-group
.form-group
=
f
.
label
:preferred_language
,
class:
"label-light"
=
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
.form-group
=
f
.
label
:skype
,
class:
"label-light"
=
f
.
label
:skype
,
class:
"label-light"
=
f
.
text_field
:skype
,
class:
"form-control"
=
f
.
text_field
:skype
,
class:
"form-control"
...
...
lib/gitlab/i18n.rb
View file @
73d0730d
module
Gitlab
module
Gitlab
module
I18n
module
I18n
AVAILABLE_LANGUAGES
=
[
AVAILABLE_LANGUAGES
=
[
[
_
(
'English'
)
,
'en'
],
[
'English'
,
'en'
],
[
_
(
'Spanish'
)
,
'es'
],
[
'Spanish'
,
'es'
],
[
_
(
'Deutsch'
)
,
'de'
]
[
'Deutsch'
,
'de'
]
]
]
end
end
end
end
locale/de/gitlab.edit.po
View file @
73d0730d
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \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"
"PO-Revision-Date: 2017-04-12 22:37-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: German\n"
"Language-Team: German\n"
...
@@ -17,3 +17,12 @@ msgstr ""
...
@@ -17,3 +17,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
"\n"
msgid "Deutsch"
msgstr ""
msgid "English"
msgstr ""
msgid "Spanish"
msgstr ""
locale/de/gitlab.po
View file @
73d0730d
...
@@ -16,3 +16,12 @@ msgstr ""
...
@@ -16,3 +16,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
"\n"
msgid "Deutsch"
msgstr ""
msgid "English"
msgstr ""
msgid "Spanish"
msgstr ""
locale/en/gitlab.edit.po
View file @
73d0730d
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \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"
"PO-Revision-Date: 2017-04-12 22:36-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: English\n"
"Language-Team: English\n"
...
@@ -17,3 +17,12 @@ msgstr ""
...
@@ -17,3 +17,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
"\n"
msgid "Deutsch"
msgstr ""
msgid "English"
msgstr ""
msgid "Spanish"
msgstr ""
locale/en/gitlab.po
View file @
73d0730d
...
@@ -16,3 +16,12 @@ msgstr ""
...
@@ -16,3 +16,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"\n"
"\n"
msgid "Deutsch"
msgstr ""
msgid "English"
msgstr ""
msgid "Spanish"
msgstr ""
locale/es/gitlab.edit.po
View file @
73d0730d
...
@@ -7,13 +7,22 @@ msgid ""
...
@@ -7,13 +7,22 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-12 22:36-0500\n"
"PO-Revision-Date: 2017-04-13 00:07-0500\n"
"PO-Revision-Date: 2017-04-12 22:37-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Spanish\n"
"Language-Team: Spanish\n"
"Language: es\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\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 @
73d0730d
...
@@ -7,12 +7,21 @@ msgid ""
...
@@ -7,12 +7,21 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2017-04-12 22:37-0500\n"
"PO-Revision-Date: 2017-04-13 00:07-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Spanish\n"
"Language-Team: Spanish\n"
"Language: es\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\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 @
73d0730d
...
@@ -8,8 +8,8 @@ msgid ""
...
@@ -8,8 +8,8 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \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-1
2 22:36
-0500\n"
"PO-Revision-Date: 2017-04-1
3 00:01
-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"Language: \n"
...
@@ -17,3 +17,12 @@ msgstr ""
...
@@ -17,3 +17,12 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\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