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
Léo-Paul Géneau
gitlab-ce
Commits
1de135bc
Commit
1de135bc
authored
Apr 19, 2017
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rubocop complains plus some small refactor
parent
302e855f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
8 deletions
+13
-8
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-0
app/views/profiles/show.html.haml
app/views/profiles/show.html.haml
+1
-1
config/initializers/fast_gettext.rb
config/initializers/fast_gettext.rb
+1
-1
db/migrate/20170413035209_add_preferred_language_to_users.rb
db/migrate/20170413035209_add_preferred_language_to_users.rb
+5
-1
lib/gitlab/i18n.rb
lib/gitlab/i18n.rb
+5
-5
No files found.
app/controllers/application_controller.rb
View file @
1de135bc
...
@@ -269,6 +269,7 @@ class ApplicationController < ActionController::Base
...
@@ -269,6 +269,7 @@ class ApplicationController < ActionController::Base
def
set_locale
def
set_locale
requested_locale
=
current_user
&
.
preferred_language
||
request
.
env
[
'HTTP_ACCEPT_LANGUAGE'
]
||
I18n
.
default_locale
requested_locale
=
current_user
&
.
preferred_language
||
request
.
env
[
'HTTP_ACCEPT_LANGUAGE'
]
||
I18n
.
default_locale
locale
=
FastGettext
.
set_locale
(
requested_locale
)
locale
=
FastGettext
.
set_locale
(
requested_locale
)
I18n
.
locale
=
locale
I18n
.
locale
=
locale
end
end
end
end
app/views/profiles/show.html.haml
View file @
1de135bc
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
%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
.
map
{
|
lang
|
[
_
(
lang
[
0
]),
lang
[
1
]
]
},
=
f
.
select
:preferred_language
,
Gitlab
::
I18n
::
AVAILABLE_LANGUAGES
.
map
{
|
value
,
label
|
[
_
(
label
),
value
]
},
{},
class:
"select2"
{},
class:
"select2"
.form-group
.form-group
=
f
.
label
:skype
,
class:
"label-light"
=
f
.
label
:skype
,
class:
"label-light"
...
...
config/initializers/fast_gettext.rb
View file @
1de135bc
FastGettext
.
add_text_domain
'gitlab'
,
path:
'locale'
,
type: :po
FastGettext
.
add_text_domain
'gitlab'
,
path:
'locale'
,
type: :po
FastGettext
.
default_available_locales
=
[
'en'
,
'es'
,
'de'
]
FastGettext
.
default_available_locales
=
Gitlab
::
I18n
::
AVAILABLE_LANGUAGES
.
keys
FastGettext
.
default_text_domain
=
'gitlab'
FastGettext
.
default_text_domain
=
'gitlab'
db/migrate/20170413035209_add_preferred_language_to_users.rb
View file @
1de135bc
...
@@ -8,7 +8,11 @@ class AddPreferredLanguageToUsers < ActiveRecord::Migration
...
@@ -8,7 +8,11 @@ class AddPreferredLanguageToUsers < ActiveRecord::Migration
disable_ddl_transaction!
disable_ddl_transaction!
def
change
def
up
add_column_with_default
:users
,
:preferred_language
,
:string
,
default:
'en'
add_column_with_default
:users
,
:preferred_language
,
:string
,
default:
'en'
end
end
def
down
remove_column
:users
,
:preferred_language
end
end
end
lib/gitlab/i18n.rb
View file @
1de135bc
module
Gitlab
module
Gitlab
module
I18n
module
I18n
AVAILABLE_LANGUAGES
=
[
AVAILABLE_LANGUAGES
=
{
[
'English'
,
'en'
]
,
'en'
=>
'English'
,
[
'Spanish'
,
'es'
]
,
'es'
=>
'Spanish'
,
[
'Deutsch'
,
'de'
]
'de'
=>
'Deutsch'
]
}.
freeze
end
end
end
end
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