@@ -4,6 +4,9 @@ class SettingsController < ApplicationController |
||
4 | 4 |
l = params[:locale].to_s.strip.to_sym |
5 | 5 |
l = I18n.default_locale unless I18n.available_locales.include?(l) |
6 | 6 |
cookies.permanent[:avalanche_locale] = l |
7 |
+ if user_signed_in? |
|
8 |
+ current_user.update(language: l) |
|
9 |
+ end |
|
7 | 10 |
redirect_to :back || root_url |
8 | 11 |
end |
9 | 12 |
|
@@ -6,18 +6,22 @@ class MissionMailer < ActionMailer::Base |
||
6 | 6 |
|
7 | 7 |
def step_validation_notification(step) |
8 | 8 |
@step = step |
9 |
- mail :to => step.mission_agent.user.email, |
|
10 |
- :subject => "#{t 'step.step_validated'} - #{step.title}", |
|
11 |
- :from => "mission_control@avalanche.network", |
|
12 |
- :from_name => "Mission Control - Avalanche Network" |
|
9 |
+ I18n.with_locale(@step.mission_agent.user.language) do |
|
10 |
+ mail :to => step.mission_agent.user.email, |
|
11 |
+ :subject => "#{t 'step.step_validated'} - #{step.title}", |
|
12 |
+ :from => "mission_control@avalanche.network", |
|
13 |
+ :from_name => "Avalanche Mission Control" |
|
14 |
+ end |
|
13 | 15 |
end |
14 | 16 |
|
15 | 17 |
def step_denied_notification(step) |
16 | 18 |
@step = step |
17 |
- mail :to => step.mission_agent.user.email, |
|
18 |
- :subject => "#{t 'step.step_denied'} - #{step.title}", |
|
19 |
- :from => "mission_control@avalanche.network", |
|
20 |
- :from_name => "Mission Control - Avalanche Network" |
|
19 |
+ I18n.with_locale(@step.mission_agent.user.language) do |
|
20 |
+ mail :to => step.mission_agent.user.email, |
|
21 |
+ :subject => "#{t 'step.step_denied'} - #{step.title}", |
|
22 |
+ :from => "mission_control@avalanche.network", |
|
23 |
+ :from_name => "Avalanche Mission Control" |
|
24 |
+ end |
|
21 | 25 |
end |
22 | 26 |
|
23 | 27 |
end |
@@ -12,7 +12,7 @@ class User < ActiveRecord::Base |
||
12 | 12 |
|
13 | 13 |
mount_uploader :avatar, AvatarUploader |
14 | 14 |
process_in_background :avatar |
15 |
- |
|
15 |
+ |
|
16 | 16 |
def full_name |
17 | 17 |
name = self.first_name.to_s + ' ' + self.last_name.to_s |
18 | 18 |
return name |
@@ -32,6 +32,8 @@ class User < ActiveRecord::Base |
||
32 | 32 |
# Mixpanel Tracking Analytics |
33 | 33 |
@analytics = Analytics.new(self.full_name) |
34 | 34 |
@analytics.track_user_registration(self) |
35 |
+ # Save user current language |
|
36 |
+ self.uplade(language: cookies[:avalanche_locale]) |
|
35 | 37 |
end |
36 | 38 |
|
37 | 39 |
def incomplete_step_count |
@@ -107,6 +107,7 @@ |
||
107 | 107 |
font-weight: 300; |
108 | 108 |
margin-top: 0px; |
109 | 109 |
margin-bottom: 7px; |
110 |
+ text-transform: uppercase; |
|
110 | 111 |
} |
111 | 112 |
|
112 | 113 |
.page-header h3 { |
@@ -75,6 +75,7 @@ |
||
75 | 75 |
font-size: 28px; |
76 | 76 |
color: #000000; |
77 | 77 |
line-height: 38px; |
78 |
+ |
|
78 | 79 |
} |
79 | 80 |
|
80 | 81 |
.bodyTable, .bodyCell { margin: 0px; padding: 0px;} |
@@ -106,6 +107,7 @@ |
||
106 | 107 |
font-weight: 300; |
107 | 108 |
margin-top: 0px; |
108 | 109 |
margin-bottom: 7px; |
110 |
+ text-transform: uppercase; |
|
109 | 111 |
} |
110 | 112 |
|
111 | 113 |
.page-header h3 { |
@@ -1,4 +1,4 @@ |
||
1 |
-pt-Br: |
|
1 |
+pt-BR: |
|
2 | 2 |
mission: |
3 | 3 |
mission: 'Missão' |
4 | 4 |
missions: 'Missões' |
@@ -0,0 +1,5 @@ |
||
1 |
+class AddLangToUser < ActiveRecord::Migration |
|
2 |
+ def change |
|
3 |
+ add_column :users, :language, :string |
|
4 |
+ end |
|
5 |
+end |
@@ -11,7 +11,7 @@ |
||
11 | 11 |
# |
12 | 12 |
# It's strongly recommended that you check this file into your version control system. |
13 | 13 |
|
14 |
-ActiveRecord::Schema.define(version: 20150224042225) do |
|
14 |
+ActiveRecord::Schema.define(version: 20150227021951) do |
|
15 | 15 |
|
16 | 16 |
# These are extensions that must be enabled in order to support this database |
17 | 17 |
enable_extension "plpgsql" |
@@ -263,6 +263,7 @@ ActiveRecord::Schema.define(version: 20150224042225) do |
||
263 | 263 |
t.string "avatar_tmp" |
264 | 264 |
t.boolean "avatar_processing", default: false, null: false |
265 | 265 |
t.string "bio" |
266 |
+ t.string "language" |
|
266 | 267 |
end |
267 | 268 |
|
268 | 269 |
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree |