BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
8 deletions
+13
-8
application_controller.rb
app/controllers/application_controller.rb
+1
-0
show.html.haml
app/views/profiles/show.html.haml
+1
-1
fast_gettext.rb
config/initializers/fast_gettext.rb
+1
-1
20170413035209_add_preferred_language_to_users.rb
db/migrate/20170413035209_add_preferred_language_to_users.rb
+5
-1
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
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/views/profiles/show.html.haml
View file @
1de135bc
...
...
@@ -74,7 +74,7 @@
%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
.
map
{
|
lang
|
[
_
(
lang
[
0
]),
lang
[
1
]
]
},
=
f
.
select
:preferred_language
,
Gitlab
::
I18n
::
AVAILABLE_LANGUAGES
.
map
{
|
value
,
label
|
[
_
(
label
),
value
]
},
{},
class:
"select2"
.form-group
=
f
.
label
:skype
,
class:
"label-light"
...
...
config/initializers/fast_gettext.rb
View file @
1de135bc
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'
db/migrate/20170413035209_add_preferred_language_to_users.rb
View file @
1de135bc
...
...
@@ -8,7 +8,11 @@ class AddPreferredLanguageToUsers < ActiveRecord::Migration
disable_ddl_transaction!
def
change
def
up
add_column_with_default
:users
,
:preferred_language
,
:string
,
default:
'en'
end
def
down
remove_column
:users
,
:preferred_language
end
end
lib/gitlab/i18n.rb
View file @
1de135bc
module
Gitlab
module
I18n
AVAILABLE_LANGUAGES
=
[
[
'English'
,
'en'
]
,
[
'Spanish'
,
'es'
]
,
[
'Deutsch'
,
'de'
]
]
AVAILABLE_LANGUAGES
=
{
'en'
=>
'English'
,
'es'
=>
'Spanish'
,
'de'
=>
'Deutsch'
}.
freeze
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