Added pt-br Locale
This commit is contained in:
		@@ -7,12 +7,20 @@ class ApplicationController < ActionController::Base
 | 
				
			|||||||
	before_filter :set_variables
 | 
						before_filter :set_variables
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# set up some variables across the entire application
 | 
						# set up some variables across the entire application
 | 
				
			||||||
	def set_variables
 | 
					  def set_variables
 | 
				
			||||||
		# hard code locale as english
 | 
					    @locale ||= get_locale
 | 
				
			||||||
		I18n.locale = 'en'
 | 
					    I18n.locale = ALLOWED_LOCALES.include?(@locale) ? @locale : I18n.default_locale
 | 
				
			||||||
		# sets timezone for current user, all DateTime outputs will be automatically formatted
 | 
					    # sets timezone for current user, all DateTime outputs will be automatically formatted
 | 
				
			||||||
		Time.zone = current_user.time_zone if current_user
 | 
					    Time.zone = current_user.time_zone if current_user
 | 
				
			||||||
	end
 | 
					  end
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  # get the locale, but don't fail if header value doesn't exist
 | 
				
			||||||
 | 
					  def get_locale
 | 
				
			||||||
 | 
					    locale = get_header_value('HTTP_ACCEPT_LANGUAGE')
 | 
				
			||||||
 | 
					    # only look for 'pt-br' as first 5 letters, can make more robust in future if other languages are needed
 | 
				
			||||||
 | 
					    locale = locale[0..4].downcase if locale
 | 
				
			||||||
 | 
					    return locale
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private
 | 
					  private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,7 @@ module Thingspeak
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
 | 
					    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
 | 
				
			||||||
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
 | 
					    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
 | 
				
			||||||
    # config.i18n.default_locale = :de
 | 
					    config.i18n.default_locale = :en
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # JavaScript files you want as :defaults (application.js is always included).
 | 
					    # JavaScript files you want as :defaults (application.js is always included).
 | 
				
			||||||
    # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
 | 
					    # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,6 @@
 | 
				
			|||||||
# allow updates via HTTP GET by setting this to true;
 | 
					# allow updates via HTTP GET by setting this to true;
 | 
				
			||||||
# set to false to only allow updates via HTTP POST
 | 
					# set to false to only allow updates via HTTP POST
 | 
				
			||||||
GET_SUPPORT = true
 | 
					GET_SUPPORT = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# allow only these additional locales (use downcase, easier to parse)
 | 
				
			||||||
 | 
					ALLOWED_LOCALES = ['pt-br']
 | 
				
			||||||
@@ -123,6 +123,7 @@ en:
 | 
				
			|||||||
  email: "Email"
 | 
					  email: "Email"
 | 
				
			||||||
  email_form_add: "Add Email"
 | 
					  email_form_add: "Add Email"
 | 
				
			||||||
  featured_channels: "Featured Channels"
 | 
					  featured_channels: "Featured Channels"
 | 
				
			||||||
 | 
					  features: "Features"
 | 
				
			||||||
  field: "Field"
 | 
					  field: "Field"
 | 
				
			||||||
  footer: "This is the footer message."
 | 
					  footer: "This is the footer message."
 | 
				
			||||||
  forgot: "Forgot your password?"
 | 
					  forgot: "Forgot your password?"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user