Add locales
This commit is contained in:
parent
9d00ae10fc
commit
7c6124a327
|
@ -0,0 +1,17 @@
|
||||||
|
li.locale {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.locale {
|
||||||
|
background: grey;
|
||||||
|
padding: 0.3em 10px 0.3em 10px;
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.locale:hover {
|
||||||
|
background: #eee;
|
||||||
|
}
|
|
@ -2,9 +2,24 @@ class ApplicationController < ActionController::Base
|
||||||
# Prevent CSRF attacks by raising an exception.
|
# Prevent CSRF attacks by raising an exception.
|
||||||
# For APIs, you may want to use :null_session instead.
|
# For APIs, you may want to use :null_session instead.
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
before_action :set_locale
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_locale
|
||||||
|
I18n.locale = params[:locale] || I18n.default_locale
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def self.default_url_options(options={})
|
||||||
|
if I18n.locale != I18n.default_locale
|
||||||
|
options.merge({locale: I18n.locale})
|
||||||
|
else
|
||||||
|
options
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def current_ip_address
|
def current_ip_address
|
||||||
# request.env['HTTP_X_FORWARDED_FOR'] ||
|
# request.env['HTTP_X_FORWARDED_FOR'] ||
|
||||||
request.remote_ip
|
request.remote_ip
|
||||||
|
|
|
@ -23,7 +23,27 @@
|
||||||
<li>
|
<li>
|
||||||
<%= t 'generic.press_submit' %>
|
<%= t 'generic.press_submit' %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<% unless I18n.locale == :en %>
|
||||||
|
<li class="locale">
|
||||||
|
<%= link_to url_for(request.query_parameters.merge(locale: 'en')), hreflang: 'en' do %>
|
||||||
|
<span class="locale">
|
||||||
|
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAIAAAD5gJpuAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHzSURBVHjaYkxOP8IAB//+Mfz7w8Dwi4HhP5CcJb/n/7evb16/APL/gRFQDiAAw3JuAgAIBEDQ/iswEERjGzBQLEru97ll0g0+3HvqMn1SpqlqGsZMsZsIe0SICA5gt5a/AGIEarCPtFh+6N/ffwxA9OvP/7//QYwff/6fZahmePeB4dNHhi+fGb59Y4zyvHHmCEAAAW3YDzQYaJJ93a+vX79aVf58//69fvEPlpIfnz59+vDhw7t37968efP3b/SXL59OnjwIEEAsDP+YgY53b2b89++/awvLn98MDi2cVxl+/vl6mituCtBghi9f/v/48e/XL86krj9XzwEEEENy8g6gu22rfn78+NGs5Ofr16+ZC58+fvyYwX8rxOxXr169fPny+fPn1//93bJlBUAAsQADZMEBxj9/GBxb2P/9+S/R8u3vzxuyaX8ZHv3j8/YGms3w8ycQARmi2eE37t4ACCDGR4/uSkrKAS35B3TT////wADOgLOBIaXIyjBlwxKAAGKRXjCB0SOEaeu+/y9fMnz4AHQxCP348R/o+l+//sMZQBNLEvif3AcIIMZbty7Ly6t9ZmXl+fXj/38GoHH/UcGfP79//BBiYHjy9+8/oUkNAAHEwt1V/vI/KBY/QSISFqM/GBg+MzB8A6PfYC5EFiDAABqgW776MP0rAAAAAElFTkSuQmCC">
|
||||||
</span>
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<% unless I18n.locale == :bg %>
|
||||||
|
<li class="locale">
|
||||||
|
<%= link_to url_for(request.query_parameters.merge(locale: 'bg')), hreflang: 'bg' do %>
|
||||||
|
<span class="locale">
|
||||||
|
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAIAAAD5gJpuAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFgSURBVHjaYvz69SsDEvj37x+ERGbAwZ9//wACiAUoysXFBST///8P0QOm//+HU0jgxYsXAAHEAlP0H5nxHxtgZGQEWgIQQCx3Pt2RYZL5+/8vQobh/z8gBIN/MAhErEwst77dAgggRoZmhjKXskefH/359weIfv/7DUJ/f//6CyR//fr7C8j99QdEyvPKH5x0ECAAhWOQAgAMg7D+/8nWNVMQDwmCvWTessZJ9VWHCIns0yWxc/MF4FgMUgCAYRBmpf9/sDqY2yWEQBbEYcK0ZuKxIY0FGZ98Z/8KFlcAsTAcYZDX/M369tefv3/+/AGSIJf8+fMbxPgDYoC4QOP//JER+XPqIANAALH83M7ALPvn3z2gcSBTQK4AOwRKQhh/fjP8+cuo8reOgQEggFiA0cP0+w+DpCRQDijK8AekE+SuP38YICQQ/f0LQUDFAAHECIznf0iIAZWLJgUEAAEGADzQZYYqa4w6AAAAAElFTkSuQmCC">
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="leftbox">
|
<div class="leftbox">
|
||||||
|
|
|
@ -18,7 +18,8 @@ module Gauge
|
||||||
|
|
||||||
# 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.available_locales = [:bg, :en]
|
||||||
|
config.i18n.default_locale = :bg
|
||||||
|
|
||||||
# Do not swallow errors in after_commit/after_rollback callbacks.
|
# Do not swallow errors in after_commit/after_rollback callbacks.
|
||||||
config.active_record.raise_in_transactional_callbacks = true
|
config.active_record.raise_in_transactional_callbacks = true
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
bg:
|
||||||
|
generic:
|
||||||
|
title: Гласуване за лекции на OpenFest 2015
|
||||||
|
submit: Изпрати
|
||||||
|
store_and_submit_changes: Запази локално промените и ги изпрати, ако е възможно
|
||||||
|
help_us_reduce_the_conflicts: Помогнете ни да намалим конфликтите в програмата на OpenFest
|
||||||
|
click_on_the_talks_you_would_like_to_watch: Кликнете върху лекциите, които искате да посетите.
|
||||||
|
press_submit: Натиснете „Изпрати“.
|
||||||
|
filter_events: Търсене
|
Loading…
Reference in New Issue