Replaced Gibberish by Rails 2.2+ I18n

This commit is contained in:
2013-07-12 14:14:54 -04:00
parent c3110dcb93
commit 7a8e3ec065
53 changed files with 169 additions and 492 deletions

View File

@@ -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]

View File

@@ -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)

View File

@@ -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 }

View File

@@ -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)

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -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)

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -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

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
# Wiki UFC
# Copyright (C) 2007, Adriano, Alinson, Andre, Rafael e Bustamante
#

View File

@@ -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

View File

@@ -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])

View File

@@ -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])

View File

@@ -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])

View File

@@ -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?

View File

@@ -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'

View File

@@ -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')