Replaced Gibberish by Rails 2.2+ I18n
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
@@ -23,7 +24,7 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
helper :all
|
||||
before_filter :startup
|
||||
before_filter :set_timezone
|
||||
#before_filter :set_timezone
|
||||
|
||||
# Força o login para algumas áreas do sistema
|
||||
before_filter :require_login, :only => [ :edit, :new, :create, :update, :delete, :destroy ]
|
||||
@@ -63,10 +64,10 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
end
|
||||
|
||||
def set_timezone
|
||||
#Time.zone = session[:user].tz
|
||||
Time.zone = "America/Fortaleza"
|
||||
end
|
||||
#def set_timezone
|
||||
# #Time.zone = session[:user].tz
|
||||
# Time.zone = "America/Fortaleza"
|
||||
#end
|
||||
|
||||
def startup
|
||||
if session[:user_id]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
@@ -47,7 +48,7 @@ class AttachmentsController < ApplicationController
|
||||
@attachment.save!
|
||||
|
||||
AttachmentCreateLogEntry.create!(:target_id => @attachment.id, :user => @current_user, :course => @course)
|
||||
flash[:notice] = 'Attachment created'[]
|
||||
flash[:notice] = t(:attachment_created)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to course_attachment_url(@course, @attachment) }
|
||||
@@ -73,7 +74,7 @@ class AttachmentsController < ApplicationController
|
||||
@attachment.last_modified = Time.now.utc
|
||||
@attachment.save!
|
||||
AttachmentEditLogEntry.create!(:target_id => @attachment.id, :user => @current_user, :course => @course)
|
||||
flash[:notice] = 'Attachment updated'[]
|
||||
flash[:notice] = t(:attachment_updated)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
@@ -84,7 +85,7 @@ class AttachmentsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
@attachment.destroy
|
||||
flash[:notice] = 'Attachment removed'[]
|
||||
flash[:notice] = t(:attachment_removed)
|
||||
|
||||
log = AttachmentDeleteLogEntry.create!(:target_id => @attachment.id, :user => @current_user, :course => @course)
|
||||
flash[:undo] = undo_course_log_url(@course, log)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
@@ -49,7 +50,7 @@ class CoursesController < ApplicationController
|
||||
|
||||
def create
|
||||
@course.save!
|
||||
flash[:notice] = 'Course created'[]
|
||||
flash[:notice] = t(:course_created)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to course_path(@course) }
|
||||
@@ -64,7 +65,7 @@ class CoursesController < ApplicationController
|
||||
@course.attributes = params[:course]
|
||||
@course.save!
|
||||
|
||||
flash[:notice] = 'Course updated'[]
|
||||
flash[:notice] = t(:course_updated)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to course_path(@course) }
|
||||
format.xml { head :ok }
|
||||
@@ -73,7 +74,7 @@ class CoursesController < ApplicationController
|
||||
|
||||
def destroy
|
||||
@course.destroy
|
||||
flash[:notice] = 'Course removed'[]
|
||||
flash[:notice] = t(:course_removed)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to courses_path }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
@@ -45,7 +46,7 @@ class EventsController < ApplicationController
|
||||
@event.course_id = @course.id
|
||||
@event.created_by = session[:user_id]
|
||||
@event.save!
|
||||
flash[:notice] = 'Event created'[]
|
||||
flash[:notice] = t(:event_created)
|
||||
|
||||
EventCreateLogEntry.create!(:target_id => @event.id, :user => @current_user, :course => @course, :version => @event.version)
|
||||
|
||||
@@ -63,7 +64,7 @@ class EventsController < ApplicationController
|
||||
@event.attributes = params[:event]
|
||||
dirty = @event.changed?
|
||||
@event.save!
|
||||
flash[:notice] = 'Event updated'[]
|
||||
flash[:notice] = t(:event_updated)
|
||||
|
||||
EventEditLogEntry.create!(:target_id => @event.id, :user => @current_user, :course => @course, :version => @event.version) if dirty
|
||||
|
||||
@@ -75,7 +76,7 @@ class EventsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
@event.destroy
|
||||
flash[:notice] = 'Event removed'[]
|
||||
flash[:notice] = t(:event_removed)
|
||||
|
||||
log = EventDeleteLogEntry.create!(:target_id => @event.id, :user => @current_user, :course => @course, :version => @event.version)
|
||||
flash[:undo] = undo_course_log_url(@course, log)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
@@ -47,7 +48,7 @@ class NewsController < ApplicationController
|
||||
@news.sender_id = session[:user_id]
|
||||
@news.timestamp = Time.now.utc
|
||||
@news.save!
|
||||
flash[:notice] = 'News created'[]
|
||||
flash[:notice] = t(:news_created)
|
||||
|
||||
NewsCreateLogEntry.create!(:target_id => @news.id, :user => @current_user, :course => @course, :version => @news.version)
|
||||
|
||||
@@ -66,7 +67,7 @@ class NewsController < ApplicationController
|
||||
@news.timestamp = Time.now.utc
|
||||
dirty = @news.changed?
|
||||
@news.save!
|
||||
flash[:notice] = 'News updated'[]
|
||||
flash[:notice] = t(:news_updated)
|
||||
|
||||
NewsEditLogEntry.create!(:target_id => @news.id, :user => @current_user, :course => @course, :version => @news.version) if dirty
|
||||
|
||||
@@ -78,7 +79,7 @@ class NewsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
@news.destroy
|
||||
flash[:notice] = 'News removed'[]
|
||||
flash[:notice] = t(:news_removed)
|
||||
|
||||
log = NewsDeleteLogEntry.create!(:target_id => @news.id, :user => @current_user, :course => @course, :version => @news.version)
|
||||
flash[:undo] = undo_course_log_url(@course, log)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
@@ -46,7 +47,7 @@ class UsersController < ApplicationController
|
||||
|
||||
@user.attributes = params[:user]
|
||||
@user.save!
|
||||
flash[:notice] = 'User account updated'[]
|
||||
flash[:notice] = t(:user_account_updated)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to user_path(@user) }
|
||||
@@ -56,7 +57,7 @@ class UsersController < ApplicationController
|
||||
|
||||
def destroy
|
||||
@user.destroy
|
||||
flash[:notice] = 'User account removed'[]
|
||||
flash[:notice] = t(:user_account_removed)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to users_path }
|
||||
@@ -71,7 +72,7 @@ class UsersController < ApplicationController
|
||||
@user.last_seen = Time.now.utc
|
||||
@user.save!
|
||||
setup_session(@user)
|
||||
flash[:message] = 'User account created'[]
|
||||
flash[:message] = t(:user_account_created)
|
||||
redirect_to dashboard_url
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
flash[:warning] = 'Não foi possível cadastrar a conta.'
|
||||
@@ -86,7 +87,7 @@ class UsersController < ApplicationController
|
||||
@user.attributes = params[:user]
|
||||
@user.save!
|
||||
@color = @user.pref_color
|
||||
flash[:message] = 'Settings updated'[]
|
||||
flash[:message] = t(:settings_updated)
|
||||
redirect_to dashboard_url
|
||||
end
|
||||
end
|
||||
@@ -98,17 +99,17 @@ class UsersController < ApplicationController
|
||||
if !@user.nil?
|
||||
setup_session(@user, (params[:remember_me] == "1"))
|
||||
@user.update_attribute(:last_seen, Time.now.utc)
|
||||
flash[:message] = 'Welcome back, {u}'[:login_success, @user.login]
|
||||
flash[:message] = t(:welcome_back, :u => @user.login)
|
||||
redirect_to_stored
|
||||
else
|
||||
flash[:warning] = 'Login failed'[]
|
||||
flash[:warning] = t(:login_failed)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def logout
|
||||
destroy_session
|
||||
flash[:message] = 'You have logged out'[:logout_success]
|
||||
flash[:message] = t(:logout_success)
|
||||
redirect_to index_path
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
@@ -43,7 +44,7 @@ class WikiController < ApplicationController
|
||||
@wiki_page.course_id = @course.id
|
||||
@wiki_page.description = "Nova página"
|
||||
@wiki_page.save!
|
||||
flash[:notice] = "Wiki page created"[]
|
||||
flash[:notice] = t(:wiki_page_created)
|
||||
|
||||
WikiCreateLogEntry.create!(:target_id => @wiki_page.id, :user => @current_user, :course => @course)
|
||||
|
||||
@@ -77,7 +78,7 @@ class WikiController < ApplicationController
|
||||
if changed
|
||||
@wiki_page.save!
|
||||
WikiEditLogEntry.create!(:target_id => @wiki_page.id, :user => @current_user, :course => @course, :version => @wiki_page.version)
|
||||
flash[:notice] = "Wiki page updated"[]
|
||||
flash[:notice] = t(:wiki_page_updated)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
@@ -89,7 +90,7 @@ class WikiController < ApplicationController
|
||||
def destroy
|
||||
@wiki_page.remove_from_list
|
||||
@wiki_page.destroy
|
||||
flash[:notice] = "Wiki page removed"[]
|
||||
flash[:notice] = t(:wiki_page_removed)
|
||||
|
||||
log = WikiDeleteLogEntry.create!(:target_id => @wiki_page.id, :user => @current_user, :course => @course)
|
||||
flash[:undo] = undo_course_log_url(@course, log)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
@@ -32,7 +33,7 @@ module ApplicationHelper
|
||||
for name in FLASH_NAMES
|
||||
if flash[name]
|
||||
output << "<div id='validation' class='validation #{name}' style='display: none'>#{flash[name]}"
|
||||
output << ". " + link_to("Undo"[] + "?", flash[:undo], :method => 'post', :accesskey => 'u') if flash[:undo]
|
||||
output << ". " + link_to(t(:undo).capitalize + "?", flash[:undo], :method => 'post', :accesskey => 'u') if flash[:undo]
|
||||
output << "</div>"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
@@ -27,7 +28,6 @@ class Attachment < ActiveRecord::Base
|
||||
# Validacao
|
||||
validates_presence_of :file_name
|
||||
validates_numericality_of :size, :allow_nil => true, :only_integer => true
|
||||
validates_inclusion_of :front_page, :in => [true, false], :allow_nil => false, :message => ActiveRecord::Errors.default_error_messages[:blank]
|
||||
|
||||
def self.find_front_page
|
||||
Attachment.find(:all, :conditions => [ "front_page = ?", true ])
|
||||
@@ -49,12 +49,12 @@ class Attachment < ActiveRecord::Base
|
||||
def validate
|
||||
if @tmp_file
|
||||
errors.add("file") if @tmp_file.size == 0
|
||||
errors.add("file", "is too large"[]) if @tmp_file.size > App.max_upload_file_size
|
||||
errors.add("file", I18n.t(:is_too_large)) if @tmp_file.size > App.max_upload_file_size
|
||||
else
|
||||
# Caso o objeto possua id, significa que ele já está no banco de dados.
|
||||
# Um arquivo em branco, entao, não é inválido: significa que a pessoa só quer
|
||||
# modificar a descrição, ou algo assim..
|
||||
errors.add("file", "is needed"[]) if not self.id
|
||||
errors.add("file", I18n.t(:is_needed)) if not self.id
|
||||
end
|
||||
|
||||
errors.add("path", "muito longo") if !@path.nil? and @path.split('/').size > 10
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
# Wiki UFC
|
||||
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
|
||||
#
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#header_menu
|
||||
%ul
|
||||
- if logged_in?
|
||||
%li.grey= "Logged in as {u}"[:logged_in_as, h(@current_user.display_name)]
|
||||
%li.grey= t(:logged_in_as, :u => h(@current_user.display_name))
|
||||
%li.last= link_to 'Logout', logout_path, :accesskey => 'l'
|
||||
- else
|
||||
%li= link_to 'Cadastrar', signup_path
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
xml.instruct! :xml, :version=>"1.0"
|
||||
xml.rss(:version=>"2.0") do
|
||||
xml.channel do
|
||||
xml.title("#{App.title} - #{@course.full_name} - " + "Recent changes"[].titleize)
|
||||
xml.title("#{App.title} - #{@course.full_name} - " + I18n.t(:recent_changes).titleize)
|
||||
xml.link(course_log_url(@course))
|
||||
xml.language(App.language)
|
||||
xml.description("{course} recent changes"[:log_about, @course.full_name])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
xml.instruct! :xml, :version=>"1.0"
|
||||
xml.rss(:version=>"2.0") do
|
||||
xml.channel do
|
||||
xml.title("#{App.title} - #{@course.full_name} - " + "News"[].titleize)
|
||||
xml.title("#{App.title} - #{@course.full_name} - " + I18n.t(:news).titleize)
|
||||
xml.link(course_news_url(@course))
|
||||
xml.language(App.language)
|
||||
xml.description("{course} news"[:news_about, @course.full_name])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
xml.instruct! :xml, :version=>"1.0"
|
||||
xml.rss(:version=>"2.0") do
|
||||
xml.channel do
|
||||
xml.title("#{App.title} - " + "News"[].titleize)
|
||||
xml.title("#{App.title} - " + I18n.t(:news).titleize)
|
||||
xml.link(dashboard_url)
|
||||
xml.language(App.language)
|
||||
xml.description("{app} news"[:news_about, App.title])
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
%img.avatar{:src => gravatar_url_for(@user.email)}
|
||||
%h1.title= h(@user.display_name)
|
||||
%p= h(@user.name)
|
||||
%p= "Membro desde {c}"[:member_since, @user.created_at.strftime("%d de %B de %Y")]
|
||||
%p= "Última visita há {c}"[:last_seen, distance_of_time_in_words(Time.now, @user.last_seen)]
|
||||
%p= t(:member_since, :c => @user.created_at.strftime("%d de %B de %Y"))
|
||||
%p= t(:last_seen, :c => distance_of_time_in_words(Time.now, @user.last_seen))
|
||||
|
||||
-# cache(user_path(@user.id)) do
|
||||
= @user.description.format_wiki if !@user.description.blank?
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.menu
|
||||
%h1= App.title
|
||||
%ul
|
||||
%li= link_to "Courses"[].titleize, courses_url, :accesskey => 'd'
|
||||
%li= link_to "Users"[].titleize, users_url, :accesskey => 'p'
|
||||
%li= link_to t(:courses).titleize, courses_url, :accesskey => 'd'
|
||||
%li= link_to t(:users).titleize, users_url, :accesskey => 'p'
|
||||
%li= link_to "Mudanças recentes", log_url, :accesskey => 'r'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
- if session[:user_id]
|
||||
.menu
|
||||
%h1= "User"[].titleize
|
||||
%h1= t(:user).titleize
|
||||
%ul
|
||||
%li= link_to("Dashboard"[].titleize, dashboard_path, :accesskey => '.')
|
||||
%li= link_to("User profile"[].titleize, user_url(@current_user), :accesskey => ',')
|
||||
%li= link_to("Edit settings"[].titleize, settings_url, :accesskey => 's')
|
||||
%li= link_to(t(:dashboard).titleize, dashboard_path, :accesskey => '.')
|
||||
%li= link_to(t(:user_profile).titleize, user_url(@current_user), :accesskey => ',')
|
||||
%li= link_to(t(:edit_settings).titleize, settings_url, :accesskey => 's')
|
||||
|
||||
@@ -43,7 +43,7 @@ Rails::Initializer.run do |config|
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
config.action_controller.session = {
|
||||
:session_key => '_wikiufc_session_id',
|
||||
:key => '_wikiufc_session_id',
|
||||
:secret => '9194c999d4c15148e1fe79e5afe2b77f9f0878f8f8391b72ff62d2ee7243d21d809096b5171be863f56701aa21efbc487d725b3660e86d0022968c19797f6f75'
|
||||
}
|
||||
|
||||
@@ -73,10 +73,11 @@ Rails::Initializer.run do |config|
|
||||
noresize nowrap rel rows rowspan rules scope shape size span src start
|
||||
style summary title type usemap valign width)
|
||||
|
||||
config.time_zone = 'America/Fortaleza'
|
||||
|
||||
config.gem "bluecloth"
|
||||
config.gem "haml"
|
||||
config.gem "hpricot"
|
||||
config.gem "icalendar"
|
||||
config.gem "brI18n"
|
||||
config.gem 'thoughtbot-shoulda', :lib => 'shoulda/rails', :source => "http://gems.github.com"
|
||||
end
|
||||
|
||||
@@ -19,3 +19,5 @@ config.action_view.debug_rjs = true
|
||||
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
config.gem "brI18n"
|
||||
|
||||
@@ -16,3 +16,5 @@ config.action_controller.perform_caching = true
|
||||
|
||||
# Disable delivery errors if you bad email addresses should just be ignored
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
config.gem "brI18n"
|
||||
|
||||
@@ -18,4 +18,4 @@ required_fields.each do |field|
|
||||
end
|
||||
|
||||
# Internacionalizacao
|
||||
Gibberish.current_language = App.language if RAILS_ENV != 'test'
|
||||
#Gibberish.current_language = App.language if RAILS_ENV != 'test'
|
||||
|
||||
@@ -1,4 +1,82 @@
|
||||
pt-BR:
|
||||
course: disciplina
|
||||
courses: disciplinas
|
||||
course_created: Disciplina cadastrada
|
||||
course_updated: Disciplina editada
|
||||
course_removed: Disciplina excluída
|
||||
|
||||
event: evento
|
||||
events: eventos
|
||||
event_created: Evento cadastrado
|
||||
event_updated: Evento editado
|
||||
event_removed: Evento excluído
|
||||
event_restored: Evento restaurado
|
||||
|
||||
news: notícias
|
||||
news_created: Notícia cadastrada
|
||||
news_updated: Notícia editada
|
||||
news_removed: Notícia excluída
|
||||
news_restored: Notícia restaurada
|
||||
news_about: Notícias de {disciplina}
|
||||
|
||||
user: usuário
|
||||
users: usuários
|
||||
user_account_updated: Perfil editado
|
||||
user_account_removed: Conta removida
|
||||
user_account_created: Conta cadastrada
|
||||
|
||||
attachment_created: Arquivo criado
|
||||
attachment_updated: Arquivo editado
|
||||
attachment_removed: Arquivo excluído
|
||||
attachment_restored: Arquivo restaurado
|
||||
|
||||
wiki_page: Página wiki
|
||||
wiki_page_created: Página wiki criada
|
||||
wiki_page_removed: Página wiki removida
|
||||
wiki_page_updated: Página wiki atualizada
|
||||
wiki_page_restored: Página wiki restaurada
|
||||
|
||||
recent_changes: Mudanças recentes
|
||||
log_about: Mudanças recentes em {disciplina}
|
||||
|
||||
undo: Desfazer
|
||||
login_failed: Não foi possível fazer login
|
||||
login_required: É necessário fazer login para acessar esta área do site
|
||||
login_success: Olá, {u}!
|
||||
logout_success: Você fez logout
|
||||
|
||||
navigation: navegação
|
||||
forums: fórums
|
||||
|
||||
user_profile: perfil público
|
||||
edit_settings: editar configurações
|
||||
settings_updated: Configurações editadas
|
||||
|
||||
is_too_large: é grande demais
|
||||
is_needed: é requerido
|
||||
|
||||
body: conteúdo
|
||||
code: código
|
||||
content: conteúdo
|
||||
date: data
|
||||
description: descrição
|
||||
file: arquivo
|
||||
file_name: nome do arquivo
|
||||
full_name: nome completo
|
||||
name: nome
|
||||
password_confirmation: confirmação de senha
|
||||
password: senha
|
||||
period: semestre
|
||||
short_name: nome abreviado
|
||||
time: horário
|
||||
title: título
|
||||
|
||||
logged_in_as: Identificado como %{u}
|
||||
member_since: Membro desde %{c}
|
||||
last_seen: Última visita há %{c}
|
||||
welcome_back: Bem vindo %{u}
|
||||
dashboard: Dashboard
|
||||
|
||||
number:
|
||||
human:
|
||||
storage_units:
|
||||
|
||||
@@ -6,6 +6,10 @@ require 'quietbacktrace'
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
|
||||
setup do
|
||||
I18n.default_locale = :en
|
||||
end
|
||||
|
||||
self.new_backtrace_silencer :shoulda do |line|
|
||||
line.include? 'vendor/plugins/shoulda'
|
||||
end
|
||||
|
||||
18
vendor/plugins/gibberish/LICENSE
vendored
18
vendor/plugins/gibberish/LICENSE
vendored
@@ -1,18 +0,0 @@
|
||||
Copyright (c) 2007 Chris Wanstrath
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
113
vendor/plugins/gibberish/README
vendored
113
vendor/plugins/gibberish/README
vendored
@@ -1,113 +0,0 @@
|
||||
= Gibberish
|
||||
|
||||
Yet another localization library. Maybe with the most agreeable API?
|
||||
|
||||
= Usage
|
||||
|
||||
It's simple. Your default language, by default, is English (:en).
|
||||
|
||||
>> "Hey there!"[:hey]
|
||||
=> "Hey there!"
|
||||
|
||||
Gibberish looks in RAILS_ROOT/lang/*.yml for translation files. Say you have RAILS_ROOT/lang/es.yml,
|
||||
right? Gibberish will detect that you know about the :es language and will serve up translations
|
||||
defined in that file if requested to do so.
|
||||
|
||||
Here's a real simple example file (it's just "key: translation"):
|
||||
|
||||
$ cat lang/es.yml
|
||||
hey: <20>Hey all<6C>!
|
||||
|
||||
And, as follows, a real simple example session:
|
||||
|
||||
>> "Hey there!"[:hey]
|
||||
=> "Hey there!"
|
||||
>> Gibberish.current_language
|
||||
=> :en
|
||||
>> Gibberish.current_language = :es
|
||||
=> :es
|
||||
>> "Hey there!"[:hey]
|
||||
=> "<22>Hey all<6C>!"
|
||||
>> Gibberish.current_language = nil
|
||||
=> nil
|
||||
>> "Hey there!"[:hey]
|
||||
=> "Hey there!"
|
||||
|
||||
It even works with simple interpolation:
|
||||
|
||||
>> "Hey, {name}!"[:hey_name, 'Chris']
|
||||
=> "Hey, Chris!"
|
||||
>> "{name} is from {place}"[:hey_place, 'Chris', 'the Dreamworld']
|
||||
=> "Chris is from the Dreamworld"
|
||||
|
||||
Notice we don't use hashes (#) like normal Ruby interpolation. Also, the names of the variables
|
||||
in the brackets don't really mean much. Interpolation is done in order -- the first argument replaces
|
||||
the first variable in brackets, the second the second, etc.
|
||||
|
||||
This of course works with your translations:
|
||||
|
||||
$ cat lang/es.yml
|
||||
hey: <20>Hey all<6C>!
|
||||
hey_name: <20>Hola {name}!
|
||||
|
||||
>> "Hey, {name}!"[:hey_name, 'Chris']
|
||||
=> "Hey, Chris!"
|
||||
>> Gibberish.current_language = :es
|
||||
=> :es
|
||||
>> "Hey, {name}!"[:hey_name, 'Crist<73>bal']
|
||||
=> <20>Hola Crist<73>bal!
|
||||
|
||||
Neat. What other methods do we get?
|
||||
|
||||
The classic around_filter:
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
around_filter :set_language
|
||||
|
||||
private
|
||||
def set_language
|
||||
Gibberish.use_language(session[:language]) { yield }
|
||||
end
|
||||
end
|
||||
|
||||
For the duration of the block, :es is set as the language of choice. After the block is run everything
|
||||
returns to normal. Rad.
|
||||
|
||||
Finally, some checking methods, if you need them:
|
||||
|
||||
>> Gibberish.default_language?
|
||||
=> true
|
||||
>> Gibberish.current_language = :es
|
||||
=> :es
|
||||
>> Gibberish.current_language
|
||||
=> :es
|
||||
>> Gibberish.default_language?
|
||||
=> false
|
||||
|
||||
Languages are loaded by default at Rails startup. In dev mode, language YAML files are reloaded when
|
||||
modified. No need to reboot the server.
|
||||
|
||||
>> Gibberish.load_languages!
|
||||
=> [:es, :fr, :de, :kl]
|
||||
>> Gibberish.languages
|
||||
=> [:es, :fr, :de, :kl]
|
||||
|
||||
More as it's needed.
|
||||
|
||||
= Warning
|
||||
|
||||
By default, Ruby returns nil when a symbol is passed to String's [] method. Some of Rails, it seems, depends
|
||||
on this behavior. Yes, I am changing !!core Ruby behavior!! The humanity!
|
||||
|
||||
To deal with this assumption, Gibberish has a reserved_keys array. It, by default, contains :limit (so Rails
|
||||
migrations don't explode on you.) To add to this array, just pass it more keys:
|
||||
|
||||
>> Gibberish.add_reserved_key :another_key
|
||||
=> [:limit, :another_key]
|
||||
>> Gibberish.add_reserved_keys :more, :keys
|
||||
=> [:limit, :another_key, :more, :keys]
|
||||
|
||||
You've been warned. It really shouldn't affect you, though.
|
||||
|
||||
>> Chris Wanstrath
|
||||
=> chris[at]ozmm[dot]org
|
||||
3
vendor/plugins/gibberish/init.rb
vendored
3
vendor/plugins/gibberish/init.rb
vendored
@@ -1,3 +0,0 @@
|
||||
require 'gibberish'
|
||||
|
||||
Gibberish.load_languages!
|
||||
3
vendor/plugins/gibberish/lang/es.yml
vendored
3
vendor/plugins/gibberish/lang/es.yml
vendored
@@ -1,3 +0,0 @@
|
||||
welcome_friend: <EFBFBD>Recepci<EFBFBD>n, amigo!
|
||||
welcome_user: <EFBFBD>Recepci<EFBFBD>n, {user}!
|
||||
love_rails: Amo los carriles.
|
||||
3
vendor/plugins/gibberish/lang/fr.yml
vendored
3
vendor/plugins/gibberish/lang/fr.yml
vendored
@@ -1,3 +0,0 @@
|
||||
welcome_friend: Bienvenue, ami!
|
||||
welcome_user: Bienvenue, {user}!
|
||||
love_rails: J'aime des rails.
|
||||
10
vendor/plugins/gibberish/lib/gibberish.rb
vendored
10
vendor/plugins/gibberish/lib/gibberish.rb
vendored
@@ -1,10 +0,0 @@
|
||||
require 'gibberish/localize'
|
||||
require 'gibberish/string_ext'
|
||||
require 'gibberish/activerecord_ext'
|
||||
|
||||
String.send :include, Gibberish::StringExt
|
||||
|
||||
module Gibberish
|
||||
extend Localize
|
||||
end
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#module ActiveRecord
|
||||
# class Errors
|
||||
# def full_messages
|
||||
# full_messages = []
|
||||
#
|
||||
# @errors.each_key do |attr|
|
||||
# @errors[attr].each do |msg|
|
||||
# next if msg.nil?
|
||||
#
|
||||
# if attr == "base"
|
||||
# full_messages << msg
|
||||
# else
|
||||
# full_messages << @base.class.human_attribute_name(attr.send("[]")) + " " + msg
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# full_messages
|
||||
# end
|
||||
# end
|
||||
#end
|
||||
@@ -1,70 +0,0 @@
|
||||
module Gibberish
|
||||
module Localize
|
||||
@@default_language = :en
|
||||
mattr_reader :default_language
|
||||
|
||||
@@reserved_keys = [ :limit ]
|
||||
mattr_reader :reserved_keys
|
||||
|
||||
def add_reserved_key(*key)
|
||||
(@@reserved_keys += key.flatten).uniq!
|
||||
end
|
||||
alias :add_reserved_keys :add_reserved_key
|
||||
|
||||
@@languages = {}
|
||||
def languages
|
||||
@@languages.keys
|
||||
end
|
||||
|
||||
@@current_language = nil
|
||||
def current_language
|
||||
@@current_language || default_language
|
||||
end
|
||||
|
||||
def current_language=(language)
|
||||
load_languages! if defined? RAILS_ENV && RAILS_ENV == 'development'
|
||||
|
||||
language = language.to_sym if language.respond_to? :to_sym
|
||||
@@current_language = @@languages[language] ? language : nil
|
||||
end
|
||||
|
||||
def use_language(language)
|
||||
start_language = current_language
|
||||
self.current_language = language
|
||||
yield
|
||||
self.current_language = start_language
|
||||
end
|
||||
|
||||
def default_language?
|
||||
current_language == default_language
|
||||
end
|
||||
|
||||
def translations
|
||||
@@languages[current_language] || {}
|
||||
end
|
||||
|
||||
def translate(string, key, *args)
|
||||
return if reserved_keys.include? key
|
||||
File.open("#{RAILS_ROOT}/lang/tmp_keys", "a").puts key if ENV['GIBBERISH_EXPORT']
|
||||
target = translations[key] || string
|
||||
interpolate_string(target.dup, *args.dup)
|
||||
end
|
||||
|
||||
def load_languages!
|
||||
language_files.each do |file|
|
||||
key = File.basename(file, '.*').to_sym
|
||||
@@languages[key] = YAML.load_file(file).symbolize_keys
|
||||
end
|
||||
languages
|
||||
end
|
||||
|
||||
private
|
||||
def interpolate_string(string, *args)
|
||||
string.gsub(/\{\w+\}/) { args.shift }
|
||||
end
|
||||
|
||||
def language_files
|
||||
Dir[File.join(RAILS_ROOT, 'lang', '*.{yml,yaml}')]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,17 +0,0 @@
|
||||
module Gibberish
|
||||
module StringExt
|
||||
def brackets_with_translation(*args)
|
||||
args = [underscore.tr(' ', '_').to_sym] if args.empty?
|
||||
return brackets_without_translation(*args) unless args.first.is_a? Symbol
|
||||
Gibberish.translate(self, args.shift, *args)
|
||||
end
|
||||
|
||||
def self.included(base)
|
||||
base.class_eval do
|
||||
alias :brackets :[]
|
||||
alias_method_chain :brackets, :translation
|
||||
alias :[] :brackets
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
182
vendor/plugins/gibberish/test/gibberish_test.rb
vendored
182
vendor/plugins/gibberish/test/gibberish_test.rb
vendored
@@ -1,182 +0,0 @@
|
||||
begin
|
||||
require 'rubygems'
|
||||
require 'test/spec'
|
||||
rescue LoadError
|
||||
puts "==> The test/spec library (gem) is required to run the Gibberish tests."
|
||||
exit
|
||||
end
|
||||
|
||||
$:.unshift File.dirname(__FILE__) + '/../lib'
|
||||
require 'active_support'
|
||||
require 'gibberish'
|
||||
|
||||
RAILS_ROOT = '.'
|
||||
Gibberish.load_languages!
|
||||
|
||||
context "After loading languages, Gibberish" do
|
||||
teardown do
|
||||
Gibberish.current_language = nil
|
||||
end
|
||||
|
||||
specify "should know what languages it has translations for" do
|
||||
Gibberish.languages.should.include :es
|
||||
end
|
||||
|
||||
specify "should know if it is using the default language" do
|
||||
Gibberish.should.be.default_language
|
||||
end
|
||||
|
||||
specify "should be able to switch between existing languages" do
|
||||
Gibberish.current_language = :es
|
||||
string = "Welcome, friend!"
|
||||
string[:welcome_friend].should.not.equal string
|
||||
|
||||
Gibberish.current_language = :fr
|
||||
string[:welcome_friend].should.not.equal string
|
||||
|
||||
Gibberish.current_language = nil
|
||||
string[:welcome_friend].should.equal string
|
||||
end
|
||||
|
||||
specify "should be able to switch languages using strings" do
|
||||
Gibberish.current_language = 'es'
|
||||
Gibberish.current_language.should.equal :es
|
||||
end
|
||||
|
||||
specify "should be able to switch to the default language at any time" do
|
||||
Gibberish.current_language = :fr
|
||||
Gibberish.should.not.be.default_language
|
||||
|
||||
Gibberish.current_language = nil
|
||||
Gibberish.should.be.default_language
|
||||
end
|
||||
|
||||
specify "should be able to switch to a certain language for the duration of a block" do
|
||||
Gibberish.should.be.default_language
|
||||
|
||||
string = "Welcome, friend!"
|
||||
string[:welcome_friend].should.equal string
|
||||
|
||||
Gibberish.use_language :es do
|
||||
string[:welcome_friend].should.not.equal string
|
||||
Gibberish.should.not.be.default_language
|
||||
end
|
||||
|
||||
Gibberish.should.be.default_language
|
||||
string[:welcome_friend].should.equal string
|
||||
end
|
||||
|
||||
specify "should return an array of the languages it loaded" do
|
||||
languages = Gibberish.load_languages!
|
||||
languages.should.be.an.instance_of Array
|
||||
languages.should.include :es
|
||||
languages.should.include :fr
|
||||
end
|
||||
|
||||
specify "should know what languages it has loaded" do
|
||||
languages = Gibberish.languages
|
||||
languages.should.be.an.instance_of Array
|
||||
languages.should.include :es
|
||||
languages.should.include :fr
|
||||
end
|
||||
|
||||
specify "should be able to accept new, unique reserved keys" do
|
||||
key = :something_evil
|
||||
Gibberish.add_reserved_key key
|
||||
Gibberish.reserved_keys.should.include key
|
||||
Gibberish.reserved_keys.size.should.equal 2
|
||||
Gibberish.add_reserved_key key
|
||||
Gibberish.add_reserved_key key
|
||||
Gibberish.reserved_keys.size.should.equal 2
|
||||
end
|
||||
end
|
||||
|
||||
context "When no language is set" do
|
||||
setup do
|
||||
Gibberish.current_language = nil
|
||||
end
|
||||
|
||||
specify "the default language should be used" do
|
||||
Gibberish.current_language.should.equal Gibberish.default_language
|
||||
end
|
||||
|
||||
specify "a gibberish string should return itself" do
|
||||
string = "Welcome, friend!"
|
||||
Gibberish.translate(string, :welcome_friend).should.equal string
|
||||
|
||||
string[:welcome_friend].should.equal string
|
||||
end
|
||||
end
|
||||
|
||||
context "When a non-existent language is set" do
|
||||
setup do
|
||||
Gibberish.current_language = :klingon
|
||||
end
|
||||
|
||||
specify "the default language should be used" do
|
||||
Gibberish.current_language.should.equal Gibberish.default_language
|
||||
end
|
||||
|
||||
specify "gibberish strings should return themselves" do
|
||||
string = "something gibberishy"
|
||||
string[:welcome_friend].should.equal string
|
||||
end
|
||||
end
|
||||
|
||||
context "A gibberish string (in general)" do
|
||||
specify "should be a string" do
|
||||
"gibberish"[:just_a_string].should.be.an.instance_of String
|
||||
"non-gibberish".should.be.an.instance_of String
|
||||
end
|
||||
|
||||
specify "should interpolate if passed arguments and replaces are present" do
|
||||
'Hi, {user} of {place}'[:hi_there, 'chris', 'france'].should.equal "Hi, chris of france"
|
||||
'{computer} omg?'[:puter, 'mac'].should.equal "mac omg?"
|
||||
end
|
||||
|
||||
specify "should not affect existing string methods" do
|
||||
string = "chris"
|
||||
answer = 'ch'
|
||||
string[0..1].should.equal answer
|
||||
string[0, 2].should.equal answer
|
||||
string[0].should.equal 99
|
||||
string[/ch/].should.equal answer
|
||||
string['ch'].should.equal answer
|
||||
string['bc'].should.be.nil
|
||||
string[/dog/].should.be.nil
|
||||
end
|
||||
|
||||
specify "should return nil if a reserved key is used" do
|
||||
"string"[:limit].should.be.nil
|
||||
end
|
||||
|
||||
specify "should set default key to underscored string" do
|
||||
Gibberish.current_language = :es
|
||||
'welcome friend'[].should == '<27>Recepci<63>n, amigo!'
|
||||
end
|
||||
end
|
||||
|
||||
context "When a non-default language is set" do
|
||||
setup do
|
||||
Gibberish.current_language = :es
|
||||
end
|
||||
|
||||
specify "that language should be used" do
|
||||
Gibberish.current_language.should.equal :es
|
||||
end
|
||||
|
||||
specify "the default language should not be used" do
|
||||
Gibberish.should.not.be.default_language
|
||||
end
|
||||
|
||||
specify "a gibberish string should return itself if a corresponding key is not found" do
|
||||
string = "The internet!"
|
||||
string[:the_internet].should.equal string
|
||||
end
|
||||
|
||||
specify "a gibberish string should return a translated version of itself if a corresponding key is found" do
|
||||
"Welcome, friend!"[:welcome_friend].should.equal "<EFBFBD>Recepci<EFBFBD>n, amigo!"
|
||||
"I love Rails."[:love_rails].should.equal "Amo los carriles."
|
||||
'Welcome, {user}!'[:welcome_user, 'Marvin'].should.equal "<EFBFBD>Recepci<EFBFBD>n, Marvin!"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user