diff options
131 files changed, 2725 insertions, 399 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index d56dc49..bf4af20 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -23,7 +23,7 @@ class Admin::UsersController < ApplicationController @user.is_admin = params[:user][:is_admin] == "1" respond_to do |wants| if @user.save - flash[:notice] = 'User was successfully created.' + flash[:notice] = I18n.t "admin.users_controller.create_notice" wants.html { redirect_to(admin_users_path) } wants.xml { render :xml => @user, :status => :created, :location => @user } else @@ -38,9 +38,9 @@ class Admin::UsersController < ApplicationController @user = User.find_by_login!(params[:id]) @user.suspended_at = Time.now if @user.save - flash[:notice] = "User #{@user.login} was successfully suspended." + flash[:notice] = I18n.t "admin.users_controller.suspend_notice", :user_name => @user.login else - flash[:error] = "Unable to suspend user #{@user.login}." + flash[:error] = I18n.t "admin.users_controller.suspend_error", :user_name => @user.login end redirect_to admin_users_url() end @@ -49,9 +49,9 @@ class Admin::UsersController < ApplicationController @user = User.find_by_login!(params[:id]) @user.suspended_at = nil if @user.save - flash[:notice] = "User #{@user.login} was successfully unsuspended." + flash[:notice] = I18n.t "admin.users_controller.unsuspend_notice", :user_name => @user.login else - flash[:error] = "Unable to unsuspend user #{@user.login}." + flash[:error] = I18n.t "admin.users_controller.unsuspend_error", :user_name => @user.login end redirect_to admin_users_url() end @@ -60,7 +60,7 @@ class Admin::UsersController < ApplicationController def check_admin unless current_user.admin? - flash[:error] = "For Administrators Only" + flash[:error] = I18n.t "admin.users_controller.check_admin" redirect_to root_path end end diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 4d759b2..a9bd330 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -23,6 +23,7 @@ class ApplicationController < ActionController::Base include AuthenticatedSystem include ExceptionNotifiable before_filter :public_and_logged_in + before_filter :set_locale rescue_from ActiveRecord::RecordNotFound, :with => :render_not_found rescue_from ActionController::UnknownController, :with => :render_not_found @@ -44,7 +45,7 @@ class ApplicationController < ActionController::Base protected def require_user_has_ssh_keys unless current_user.ssh_keys.count > 0 - flash[:error] = "You need to upload your public key first" + flash[:error] = I18n.t "application.require_ssh_keys_error" redirect_to new_account_key_path return end @@ -61,7 +62,7 @@ class ApplicationController < ActionController::Base def check_repository_for_commits unless @repository.has_commits? - flash[:notice] = "The repository doesn't have any commits yet" + flash[:notice] = I18n.t "application.no_commits_notice" redirect_to project_repository_path(@project, @repository) and return end end @@ -73,4 +74,15 @@ class ApplicationController < ActionController::Base def public_and_logged_in login_required unless GitoriousConfig['public_mode'] end + + def set_locale + #TODO - define proper locale switching + if ENV['RAILS_ENV'] == 'test' + I18n.default_locale = 'en' + I18n.locale = 'en' + else + I18n.default_locale = YAML::load_file(File.join(Rails.root, "config/gitorious.yml"))["locale"] || "en" + I18n.locale = YAML::load_file(File.join(Rails.root, "config/gitorious.yml"))["locale"] || "en" + end + end end diff --git a/app/controllers/blobs_controller.rb b/app/controllers/blobs_controller.rb index 675b409..d8fc93c 100644 --- a/app/controllers/blobs_controller.rb +++ b/app/controllers/blobs_controller.rb @@ -44,7 +44,7 @@ class BlobsController < ApplicationController @blob = @git.tree(@commit.tree.id, ["#{params[:path].join("/")}"]).contents.first render_not_found and return unless @blob if @blob.size > 500.kilobytes - flash[:error] = "Blob is too big. Clone the repository locally to see it" + flash[:error] = I18n.t "blogs_controller.raw_error" redirect_to project_repository_path(@project, @repository) and return end render :text => @blob.data, :content_type => @blob.mime_type diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 21d5e77..3c1b6a4 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -49,7 +49,7 @@ class CommentsController < ApplicationController if @comment.save @project.create_event(Action::COMMENT, @comment, current_user) format.html do - flash[:success] = "Your comment was added" + flash[:success] = I18n.t "comments_controller.create_success" redirect_to project_repository_comments_path(@project, @repository) end else diff --git a/app/controllers/committers_controller.rb b/app/controllers/committers_controller.rb index 893c623..c942ce8 100644 --- a/app/controllers/committers_controller.rb +++ b/app/controllers/committers_controller.rb @@ -29,10 +29,10 @@ class CommittersController < ApplicationController def create @committer = User.find_by_login(params[:user][:login]) unless @committer - flash[:error] = "Could not find user by that name" + flash[:error] = I18n.t "committers_controller.create_error_not_found" respond_to do |format| format.html { redirect_to(new_committer_url(@repository.project, @repository)) } - format.xml { render :text => "Could not a find user by that name", :status => :not_found } + format.xml { render :text => I18n.t( "committers_controller.create_error_not_found"), :status => :not_found } end return end @@ -46,9 +46,9 @@ class CommittersController < ApplicationController render :xml => @committer end else - flash[:error] = "Could not add user or user is already a committer" + flash[:error] = I18n.t "committers_controller.create_error_already_commiter" format.html { redirect_to(new_committer_url(@repository.project, @repository)) } - format.xml { render :text => "Could not add user or user is already a committer", :status => :not_found } + format.xml { render :text => I18n.t("committers_controller.create_error_already_commiter"), :status => :not_found } end end end @@ -59,11 +59,11 @@ class CommittersController < ApplicationController respond_to do |format| if @committership.destroy @project.create_event(Action::REMOVE_COMMITTER, @repository, current_user, params[:id]) - flash[:success] = "User removed from repository" + flash[:success] = I18n.t "committers_controller.destroy_success" format.html { redirect_to [@repository.project, @repository] } format.xml { render :nothing, :status => :ok } else - flash[:error] = "Could not remove user from repository" + flash[:error] = I18n.t "committers_controller.destroy_error≈" format.html { redirect_to [@repository.project, @repository] } format.xml { render :nothing, :status => :unprocessable_entity } end @@ -90,7 +90,7 @@ class CommittersController < ApplicationController def find_repository @repository = @project.repositories.find_by_name!(params[:repository_id]) unless @repository.user == current_user - flash[:error] = "You're not the owner of this repository" + flash[:error] = I18n.t "committers_controller.find_repository_error" redirect_to [@repository.project, @repository] end end diff --git a/app/controllers/keys_controller.rb b/app/controllers/keys_controller.rb index 5609d20..980519a 100644 --- a/app/controllers/keys_controller.rb +++ b/app/controllers/keys_controller.rb @@ -44,7 +44,7 @@ class KeysController < ApplicationController respond_to do |format| if @ssh_key.save - flash[:notice] = "Key added" + flash[:notice] = I18n.t "keys_controller.create_notice" format.html { redirect_to account_path } format.xml { render :xml => @ssh_key, :status => :created, :location => account_key_path(@ssh_key) } else @@ -83,7 +83,7 @@ class KeysController < ApplicationController def destroy @ssh_key = current_user.ssh_keys.find(params[:id]) if @ssh_key.destroy - flash[:notice] = "Key removed" + flash[:notice] = I18n.t "keys_controller.destroy_notice" end redirect_to account_path end diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb index baf05dc..8853f94 100644 --- a/app/controllers/merge_requests_controller.rb +++ b/app/controllers/merge_requests_controller.rb @@ -52,7 +52,7 @@ class MergeRequestsController < ApplicationController if @merge_request.save @project.create_event(Action::REQUEST_MERGE, @merge_request, current_user) format.html { - flash[:success] = %Q{You sent a merge request to "#{@merge_request.target_repository.name}"} + flash[:success] = I18n.t "merge_requests_controller.create_success", :name => @merge_request.target_repository.name redirect_to project_repository_path(@project, @repository) and return } format.xml { render :xml => @merge_request, :status => :created } @@ -71,7 +71,7 @@ class MergeRequestsController < ApplicationController @merge_request.status = params[:merge_request][:status] if @merge_request.save @project.create_event(Action::RESOLVE_MERGE_REQUEST, @merge_request, current_user) - flash[:notice] = "The merge request was marked as #{@merge_request.status_string}" + flash[:notice] = I18n.t "merge_requests_controller.resolve_notice", :status => @merge_request.status_string end redirect_to [@project, @repository, @merge_request] end @@ -84,7 +84,7 @@ class MergeRequestsController < ApplicationController @merge_request.attributes = params[:merge_request] if @merge_request.save @project.create_event(Action::UPDATE_MERGE_REQUEST, @merge_request, current_user) - flash[:success] = "Merge request was updated" + flash[:success] = I18n.t "merge_requests_controller.update_success" redirect_to [@project, @repository, @merge_request] else @repositories = @project.repositories.find(:all, :conditions => ["id != ?", @repository.id]) @@ -95,7 +95,7 @@ class MergeRequestsController < ApplicationController def destroy @merge_request.destroy @project.create_event(Action::DELETE_MERGE_REQUEST, @repository, current_user) - flash[:success] = "Merge request was retracted" + flash[:success] = I18n.t "merge_requests_controller.destroy_success" redirect_to project_repository_path(@project, @repository) end @@ -111,9 +111,9 @@ class MergeRequestsController < ApplicationController def assert_merge_request_resolvable unless @merge_request.resolvable_by?(current_user) respond_to do |format| - flash[:error] = "You're not permitted to resolve this merge request" + flash[:error] = I18n.t "merge_requests_controller.assert_resolvable_error" format.html { redirect_to([@project, @repository, @merge_request]) } - format.xml { render :text => "You're not permitted to resolve this merge request", :status => :forbidden } + format.xml { render :text => I18n.t( "merge_requests_controller.assert_resolvable_error"), :status => :forbidden } end return end @@ -122,9 +122,9 @@ class MergeRequestsController < ApplicationController def assert_merge_request_ownership if @merge_request.user != current_user respond_to do |format| - flash[:error] = "You're not the owner of this merge request" + flash[:error] = I18n.t "merge_requests_controller.assert_ownership_error" format.html { redirect_to([@project, @repository]) } - format.xml { render :text => "You're not the owner of this merge request", :status => :forbidden } + format.xml { render :text => I18n.t("merge_requests_controller.assert_ownership_error"), :status => :forbidden } end return end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e141cfe..c5ca09e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -83,7 +83,7 @@ class ProjectsController < ApplicationController def update @project = Project.find_by_slug!(params[:id]) if @project.user != current_user - flash[:error] = "You're not the owner of this project" + flash[:error] = I18n.t "projects_controller.update_error" redirect_to(project_path(@project)) and return end @project.attributes = params[:project] @@ -106,7 +106,7 @@ class ProjectsController < ApplicationController @project.destroy # Event.create(:action => Action::DELETE_PROJECT, :user => current_user, :data => project_title) # FIXME: project_id cannot be null else - flash[:error] = "You're not the owner of this project, or the project has clones" + flash[:error] = I18n.t "projects_controller.destroy_error" end redirect_to projects_path end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index e60c7f8..cab8174 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -45,7 +45,7 @@ class RepositoriesController < ApplicationController def new @repository_to_clone = @project.repositories.find_by_name!(params[:id]) unless @repository_to_clone.has_commits? - flash[:error] = "Sorry, can't clone an empty repository" + flash[:error] = I18n.t "repositories_controller.new_error" redirect_to project_repository_path(@project, @repository_to_clone) return end @@ -58,11 +58,11 @@ class RepositoriesController < ApplicationController target_path = project_repository_path(@project, @repository_to_clone) respond_to do |format| format.html do - flash[:error] = "Sorry, can't clone an empty repository" + flash[:error] = I18n.t "repositories_controller.create_error" redirect_to target_path end format.xml do - render :text => "Sorry, can't clone an empty repository", + render :text => I18n.t("repositories_controller.create_error"), :location => target_path, :status => :unprocessable_entity end end @@ -105,11 +105,11 @@ class RepositoriesController < ApplicationController @repository = @project.repositories.find_by_name!(params[:id]) if @repository.can_be_deleted_by?(current_user) repo_name = @repository.name - flash[:notice] = "The repository was deleted" + flash[:notice] = I18n.t "repositories_controller.destroy_notice" @repository.destroy @project.create_event(Action::DELETE_REPOSITORY, @project, current_user, repo_name) else - flash[:error] = "You're not the owner of this repository" + flash[:error] = I18n.t "repositories_controller.destroy_error" end redirect_to project_path(@project) end @@ -118,9 +118,9 @@ class RepositoriesController < ApplicationController def require_adminship unless @project.admin?(current_user) respond_to do |format| - flash[:error] = "Sorry, only project admins are allowed to do that" + flash[:error] = I18n.t "repositories_controller.adminship_error" format.html { redirect_to(project_path(@project)) } - format.xml { render :text => "Sorry, only project admins are allowed to do that", :status => :forbidden } + format.xml { render :text => I18n.t( "repositories_controller.adminship_error"), :status => :forbidden } end return end diff --git a/app/controllers/trees_controller.rb b/app/controllers/trees_controller.rb index cce21ec..1f8ca3a 100644 --- a/app/controllers/trees_controller.rb +++ b/app/controllers/trees_controller.rb @@ -45,7 +45,7 @@ class TreesController < ApplicationController send_data(data, :type => 'application/x-gzip', :filename => "#{prefix}.tar.gz") else - flash[:error] = "The given repository or sha is invalid" + flash[:error] = I18n.t "trees_controller.archive_error" redirect_to project_repository_path(@project, @repository) and return end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 786e8c5..2914b92 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -56,7 +56,7 @@ class UsersController < ApplicationController @user = User.new(params[:user]) @user.login = params[:user][:login] @user.save! - flash[:notice] = "Thanks for signing up! You will receive an account activation email soon" + flash[:notice] = I18n.t "users_controller.create_notice" redirect_to root_path rescue ActiveRecord::RecordInvalid render :action => 'new' @@ -67,10 +67,10 @@ class UsersController < ApplicationController self.current_user = user if logged_in? && !current_user.activated? current_user.activate - flash[:notice] = "Your account has been activated, welcome!" + flash[:notice] = I18n.t "users_controller.activate_notice" end else - flash[:error] = "Invalid activation code" + flash[:error] = I18n.t "users_controller.activate_error" end redirect_back_or_default('/') end @@ -83,10 +83,10 @@ class UsersController < ApplicationController # FIXME: should really be a two-step process: receive link, visiting it resets password generated_password = user.reset_password! Mailer.deliver_forgotten_password(user, generated_password) - flash[:notice] = "A new password has been sent to your email" + flash[:notice] = I18n.t "users_controller.reset_password_notice" redirect_to(root_path) else - flash[:error] = "Invalid email" + flash[:error] = I18n.t "users_controller.reset_password_error" redirect_to forgot_password_users_path end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 99501b0..d89a19d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -40,8 +40,8 @@ module ApplicationHelper def build_notice_for(object) out = %Q{<div class="being_constructed">} - out << %Q{ <p>This #{object.class.name.humanize.downcase} is being created,<br />} - out << %Q{ it will be ready pretty soon…</p>} + out << %Q{ <p>#{I18n.t( "application_helper.notice_for_1", :class_name => object.class.name.humanize.downcase )}<br />} + out << %Q{ #{I18n.t( "application_helper.notice_for_2" )}</p>} out << %Q{</div>} out end @@ -154,14 +154,14 @@ module ApplicationHelper case event.action when Action::CREATE_PROJECT - action = "<strong>created project</strong> #{link_to h(target.title), project_path(target)}" + action = "<strong>#{I18n.t("application_helper.event_status_created")}</strong> #{link_to h(target.title), project_path(target)}" body = truncate(target.stripped_description, 100) category = "project" when Action::DELETE_PROJECT - action = "<strong>deleted project</strong> #{h(event.data)}" + action = "<strong>#{I18n.t("application_helper.event_status_deleted")}</strong> #{h(event.data)}" category = "project" when Action::UPDATE_PROJECT - action = "<strong>updated project</strong> #{link_to h(target.title), project_path(target)}" + action = "<strong>#{I18n.t("application_helper.event_status_updated")}</strong> #{link_to h(target.title), project_path(target)}" category = "project" when Action::CLONE_REPOSITORY original_repo = Repository.find_by_id(event.data.to_i) @@ -169,55 +169,55 @@ module ApplicationHelper project = target.project - action = "<strong>cloned</strong> #{link_to h(project.slug), project_path(project)}/#{link_to h(original_repo.name), project_repository_url(project, original_repo)} in #{link_to h(target.name), project_repository_url(project, target)}" + action = "<strong>#{I18n.t("application_helper.event_status_cloned")}</strong> #{link_to h(project.slug), project_path(project)}/#{link_to h(original_repo.name), project_repository_url(project, original_repo)} in #{link_to h(target.name), project_repository_url(project, target)}" category = "repository" when Action::DELETE_REPOSITORY - action = "<strong>deleted repository</strong> #{link_to h(target.title), project_path(target)}/#{event.data}" + action = "<strong>#{I18n.t("application_helper.event_status_cloned")}</strong> #{link_to h(target.title), project_path(target)}/#{event.data}" category = "project" when Action::COMMIT project = event.project - action = "<strong>committed</strong> #{link_to event.data[0,8], project_repository_commit_path(project, target, event.data)} to #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" + action = "<strong>#{I18n.t("application_helper.event_status_cloned")}</strong> #{link_to event.data[0,8], project_repository_commit_path(project, target, event.data)} to #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" body = link_to(h(truncate(event.body, 150)), project_repository_commit_path(project, target, event.data)) category = "commit" when Action::CREATE_BRANCH project = target.project if event.data == "master" - action = "<strong>started development</strong> of #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" + action = "<strong>#{I18n.t("application_helper.event_status_started")}</strong> of #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" body = event.body else - action = "<strong>created branch</strong> #{link_to h(event.data), project_repository_tree_path(project, target, event.data)} on #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" + action = "<strong>#{I18n.t("application_helper.event_branch_created")}</strong> #{link_to h(event.data), project_repository_tree_path(project, target, event.data)} on #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" end category = "commit" when Action::DELETE_BRANCH project = target.project - action = "<strong>deleted branch</strong> #{event.data} on #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" + action = "<strong>#{I18n.t("application_helper.event_branch_deleted")}</strong> #{event.data} on #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" category = "commit" when Action::CREATE_TAG project = target.project - action = "<strong>tagged</strong> #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" + action = "<strong>#{I18n.t("application_helper.event_tagged")}</strong> #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" body = "#{link_to event.data, project_repository_commit_path(project, target, event.data)}<br/>#{event.body}" category = "commit" when Action::DELETE_TAG project = target.project - action = "<strong>deleted tag</strong> #{event.data} on #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" + action = "<strong>#{I18n.t("application_helper.event_tag_deleted")}</strong> #{event.data} on #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" category = "commit" when Action::ADD_COMMITTER user = target.user repo = target.repository - action = "<strong>added committer</strong> #{link_to user.login, user_path(user)} to #{link_to h(repo.project.slug), project_path(repo.project)}/#{link_to h(repo.name), project_repository_url(repo.project, repo)}" + action = "<strong>#{I18n.t("application_helper.event_committer_added")}</strong> #{link_to user.login, user_path(user)} to #{link_to h(repo.project.slug), project_path(repo.project)}/#{link_to h(repo.name), project_repository_url(repo.project, repo)}" category = "repository" when Action::REMOVE_COMMITTER user = User.find_by_id(event.data.to_i) next unless user project = target.project - action = "<strong>removed committer</strong> #{link_to user.login, user_path(user)} from #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" + action = "<strong>#{I18n.t("application_helper.event_committer_removed")}</strong> #{link_to user.login, user_path(user)} from #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" category = "repository" when Action::COMMENT project = target.project repo = target.repository - action = "<strong>commented</strong> on #{link_to h(project.slug), project_path(project)}/#{link_to h(repo.name), project_repository_url(project, repo)}" + action = "<strong>#{I18n.t("application_helper.event_commented")}</strong> on #{link_to h(project.slug), project_path(project)}/#{link_to h(repo.name), project_repository_url(project, repo)}" body = truncate(h(target.body), 150) category = "comment" when Action::REQUEST_MERGE @@ -225,7 +225,7 @@ module ApplicationHelper project = source_repository.project target_repository = target.target_repository - action = "<strong>requested a merge of</strong> #{link_to h(project.slug), project_path(project)}/#{link_to h(source_repository.name), project_repository_url(project, source_repository)} with #{link_to h(project.slug), project_path(project)}/#{link_to h(target_repository.name)}" + action = "<strong>#{I18n.t("application_helper.event_requested_merge_of")}</strong> #{link_to h(project.slug), project_path(project)}/#{link_to h(source_repository.name), project_repository_url(project, source_repository)} with #{link_to h(project.slug), project_path(project)}/#{link_to h(target_repository.name)}" body = "#{link_to truncate(h(target.proposal), 100), [project, target_repository, target]}" category = "merge_request" when Action::RESOLVE_MERGE_REQUEST @@ -233,7 +233,7 @@ module ApplicationHelper project = source_repository.project target_repository = target.target_repository - action = "<strong>resolved merge request</strong> as [#{target.status_string}] from #{link_to h(project.slug), project_path(project)}/#{link_to h(source_repository.name), project_repository_url(project, source_repository)}" + action = "<strong>#{I18n.t("application_helper.event_resolved_merge_request")}</strong> as [#{target.status_string}] from #{link_to h(project.slug), project_path(project)}/#{link_to h(source_repository.name), project_repository_url(project, source_repository)}" body = "#{link_to truncate(h(target.proposal), 100), [project, target_repository, target]}" category = "merge_request" when Action::UPDATE_MERGE_REQUEST @@ -241,12 +241,12 @@ module ApplicationHelper project = source_repository.project target_repository = target.target_repository - action = "<strong>updated merge request</strong> from #{link_to h(project.title), project_path(project)}/#{link_to h(source_repository.name), project_repository_url(project, source_repository)}" + action = "<strong>#{I18n.t("application_helper.event_updated_merge_request")}</strong> from #{link_to h(project.title), project_path(project)}/#{link_to h(source_repository.name), project_repository_url(project, source_repository)}" category = "merge_request" when Action::DELETE_MERGE_REQUEST project = target.project - action = "<strong>deleted merge request</strong> from #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" + action = "<strong>#{I18n.t("application_helper.event_deleted_merge_request")}</strong> from #{link_to h(project.slug), project_path(project)}/#{link_to h(target.name), project_repository_url(project, target)}" category = "merge_request" end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ea903f5..a6290ef 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -20,7 +20,7 @@ class Mailer < ActionMailer::Base def signup_notification(user) setup_email(user) - @subject += 'Please activate your new account' + @subject += I18n.t "mailer.subject" @body[:url] = url_for( :controller => 'users', :action => 'activate', @@ -30,12 +30,13 @@ class Mailer < ActionMailer::Base def activation(user) setup_email(user) - @subject += 'Your account has been activated!' + @subject += I18n.t "mailer.activated" end def new_repository_clone(repository) setup_email(repository.project.user) - @subject += %Q{#{repository.user.login} has cloned #{repository.project.slug}/#{repository.parent.name}} + @subject += I18n.t "mailer.repository_clone", :login => repository.user.login, + :slug => repository.project.slug, :parent => repository.parent.name @body[:user] = repository.project.user @body[:cloner] = repository.user @body[:project] = repository.project @@ -45,7 +46,8 @@ class Mailer < ActionMailer::Base def merge_request_notification(merge_request) setup_email(merge_request.target_repository.user) - @subject += %Q{#{merge_request.source_repository.user.login} has requested a merge in #{merge_request.target_repository.project.title}} + @subject += I18n.t "mailer.request_notification", :login => merge_request.source_repository.user.login, + :title => merge_request.target_repository.project.title @body[:merge_request] = merge_request @body[:project] = merge_request.target_repository.project @body[:url] = @@ -58,7 +60,7 @@ class Mailer < ActionMailer::Base def forgotten_password(user, password) setup_email(user) - @subject += "Your new password" + @subject += I18n.t "mailer.new_password" @body[:password] = password end diff --git a/app/models/project.rb b/app/models/project.rb index 40e49dd..fc1082f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -51,16 +51,16 @@ class Project < ActiveRecord::Base validates_presence_of :title, :user_id, :slug, :description validates_uniqueness_of :slug, :case_sensitive => false validates_format_of :slug, :with => /^[a-z0-9_\-]+$/i, - :message => "must match something in the range of [a-z0-9_\-]+" + :message => I18n.t( "project.format_slug_validation") validates_format_of :home_url, :with => URL_FORMAT_RE, :if => proc{|record| !record.home_url.blank? }, - :message => "Must begin with http(s)" + :message => I18n.t( "project.ssl_required") validates_format_of :mailinglist_url, :with => URL_FORMAT_RE, :if => proc{|record| !record.mailinglist_url.blank? }, - :message => "Must begin with http(s)" + :message => I18n.t( "project.ssl_required") validates_format_of :bugtracker_url, :with => URL_FORMAT_RE, :if => proc{|record| !record.bugtracker_url.blank? }, - :message => "Must begin with http(s)" + :message => I18n.t( "project.ssl_required") before_validation :downcase_slug after_create :create_mainline_repository diff --git a/app/models/user.rb b/app/models/user.rb index 618e877..16fb5ca 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -74,7 +74,7 @@ class User < ActiveRecord::Base begin OpenIdAuthentication.normalize_url(self.identity_url) rescue OpenIdAuthentication::InvalidOpenId => e - errors.add(:identity_url, "Invalid url") + errors.add(:identity_url, I18n.t( "user.invalid_url" )) end end end diff --git a/app/views/accounts/edit.html.erb b/app/views/accounts/edit.html.erb index bfeb1fb..1e34a37 100644 --- a/app/views/accounts/edit.html.erb +++ b/app/views/accounts/edit.html.erb @@ -18,30 +18,30 @@ #++ %> -<h1>Edit your account</h1> +<h1><%= t("views.account.edit_title") %></h1> <%= error_messages_for :user -%> <% form_for @user, :url => account_path do |f| -%> <p> - <%= f.label :email -%><br /> + <%= f.label :email, t(:email, :scope => 'activerecord.attributes.user') -%><br /> <%= f.text_field :email, :class => "text" -%> </p> <p> - <%= f.label :fullname, "Realname" -%><br /> + <%= f.label :fullname, t("views.account.realname") -%><br /> <%= f.text_field :fullname, :class => "text" -%> </p> <p> - <%= f.label :url, "url <small>blog etc</small>" -%><br /> + <%= f.label :url, t("views.account.url") -%><br /> <%= f.text_field :url, :class => "text" -%> </p> <p> - <%= f.label :url, "OpenID" -%><br /> + <%= f.label :url, t("views.account.openid") -%><br /> <%= f.text_field :identity_url, :class => "text" -%> </p> - <%= f.submit "Save" -%> + <%= f.submit t("views.common.save") -%> <% end -%> <% content_for :submenu do -%> - <li><%= link_to "My account", account_path -%></li> - <li><%= link_to "Change password", password_account_path -%></li> + <li><%= link_to t("views.account.my_account"), account_path -%></li> + <li><%= link_to t("views.account.chg_passwd"), password_account_path -%></li> <% end -%>
\ No newline at end of file diff --git a/app/views/accounts/password.html.erb b/app/views/accounts/password.html.erb index 701c930..631d597 100644 --- a/app/views/accounts/password.html.erb +++ b/app/views/accounts/password.html.erb @@ -18,28 +18,28 @@ #++ %> -<h1>Edit your account</h1> +<h1><%= t("views.account.edit_title") %></h1> <%= error_messages_for :user -%> <% form_for @user, :url => update_password_account_path, :method => :put do |f| -%> <% unless @user.is_openid_only? %> <p> - <%= f.label :current_password -%><br /> + <%= f.label :current_password, t(:current_password, :scope => 'activerecord.attributes.user') -%><br /> <%= f.password_field :current_password, :class => "text" -%> </p> <% end %> <p> - <%= f.label :password, "New password" -%><br /> + <%= f.label :password, t("views.account.new_passwd") -%><br /> <%= f.password_field :password, :class => "text" -%> </p> <p> - <%= f.label :password_confirmation, "New password confirmation" -%><br /> + <%= f.label :password_confirmation, t("views.account.new_passwd_conf") -%><br /> <%= f.password_field :password_confirmation, :class => "text" -%> </p> - <%= f.submit "Change password" -%> + <%= f.submit t("views.account.chg_passwd") -%> <% end -%> <% content_for :submenu do -%> - <li><%= link_to "My account", account_path -%></li> - <li><%= link_to "Edit details", edit_account_path -%></li> + <li><%= link_to t("views.account.my_account"), account_path -%></li> + <li><%= link_to t("views.account.edit_details"), edit_account_path -%></li> <% end -%>
\ No newline at end of file diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb index d7a97e0..2ff4a39 100644 --- a/app/views/accounts/show.html.erb +++ b/app/views/accounts/show.html.erb @@ -17,18 +17,18 @@ #++ %> -<% @page_title = "Account" -%> +<% @page_title = t("views.account.show_title") -%> -<h2>Account details <small><%= link_to "edit", edit_account_path -%></small></h2> +<h2><%= t("views.account.edit_details") %> <small><%= link_to t("views.account.edit_link"), edit_account_path -%></small></h2> <ul class="infobox"> - <li><strong>Realname:</strong> + <li><strong><%= t("views.account.realname") %>:</strong> <%= current_user.fullname.blank? ? "N/A" : h(current_user.fullname) -%></li> - <li><strong>Username:</strong> <%= link_to h(current_user.login), user_path(current_user) -%></li> - <li><strong>Email:</strong> <%=h current_user.email -%></li> - <li><strong>Url:</strong> <a href="<%=h current_user.url -%>"><%=h current_user.url -%></a></li> + <li><strong><%= t("views.account.username") %>:</strong> <%= link_to h(current_user.login), user_path(current_user) -%></li> + <li><strong><%= t(:email, :scope => 'activerecord.attributes.user') %>:</strong> <%=h current_user.email -%></li> + <li><strong><%= t(:url, :scope => 'activerecord.attributes.user') %>:</strong> <a href="<%=h current_user.url -%>"><%=h current_user.url -%></a></li> </ul> -<h3>Your SSH Keys:</h3> +<h3><%= t("views.keys.ssh_keys") %>:</h3> <% current_user.ssh_keys.each do |ssh_key| -%> <%= render :partial => "keys/key", :locals => {:ssh_key => ssh_key} -%> @@ -37,6 +37,6 @@ <% content_for :submenu do -%> - <li><%= link_to "Edit details", edit_account_path -%></li> - <li><%= link_to "Add SSH key", new_account_key_path -%></li> + <li><%= link_to t("views.account.edit_details"), edit_account_path -%></li> + <li><%= link_to t("views.keys.add_ssh_key"), new_account_key_path -%></li> <% end -%>
\ No newline at end of file diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index 5850558..40b60e0 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -1,11 +1,11 @@ <table class="listing tree"> <tr> - <td>Login</td> - <td>E-mail</td> - <td>Created At</td> - <td>Activated?</td> - <td>Suspended?</td> - <td>Admin?</td> + <td><%= t(:login, :scope => "activerecord.attributes.user").humanize %></td> + <td><%= t(:email, :scope => "activerecord.attributes.user").humanize %></td> + <td><%= t(:created_at, :scope => "activerecord.attributes.user").humanize %></td> + <td><%= t("views.users.activated") %></td> + <td><%= t("views.users.suspended") %></td> + <td><%= t("views.users.admin") %></td> <td></td> </tr> <% @users.each do |user| -%> @@ -13,13 +13,13 @@ <td><%= link_to h(user.login), user %></td> <td><%= link_to user.email, "mailto:#{user.email}" %></td> <td><%= user.created_at.to_s(:short) %></td> - <td><%= user.activated? ? user.activated_at.to_s(:short) : 'No' %></td> - <td><%= user.suspended? ? user.suspended_at.to_s(:short) : 'No' %></td> - <td><%= user.admin? ? "Yes" : "No" %></td> + <td><%= user.activated? ? user.activated_at.to_s(:short) : t("views.common.no") %></td> + <td><%= user.suspended? ? user.suspended_at.to_s(:short) : t("views.common.no") %></td> + <td><%= user.admin? ? t("views.common.yes") : t("views.common.no") %></td> <% if user.suspended? -%> - <td><%= link_to "Unsuspend", unsuspend_admin_user_path(user), :confirm => "Confirm unsuspend?", :method => :put %></td> + <td><%= link_to t("views.users.unsuspend"), unsuspend_admin_user_path(user), :confirm => t("views.common.confirm"), :method => :put %></td> <% else -%> - <td><%= link_to "Suspend", suspend_admin_user_path(user), :confirm => "Confirm suspend?", :method => :put %></td> + <td><%= link_to t("views.users.suspend"), suspend_admin_user_path(user), :confirm => t("views.common.confirm"), :method => :put %></td> <% end -%> </tr> <% end -%> @@ -27,4 +27,4 @@ <%= will_paginate @users -%> -<p><%= link_to "Create New User", new_admin_user_path %></p>
\ No newline at end of file +<p><%= link_to t("views.users.create_btn"), new_admin_user_path %></p> diff --git a/app/views/admin/users/new.html.erb b/app/views/admin/users/new.html.erb index 0532037..b328a6a 100644 --- a/app/views/admin/users/new.html.erb +++ b/app/views/admin/users/new.html.erb @@ -5,8 +5,8 @@ <%= render :partial => 'users/form', :locals => { :f => f } %> <p> - <%= f.check_box :is_admin, {}, "1", "0" %> <%= f.label :is_admin, "Is Administrator?" -%> + <%= f.check_box :is_admin, {}, "1", "0" %> <%= f.label :is_admin, t("views.users.is_admin") -%> </p> - <p><%= f.submit 'Create' %> <%= link_to "Back", admin_users_path %></p> + <p><%= f.submit t("views.common.create") %> <%= link_to t("views.common.back"), admin_users_path %></p> <% end -%>
\ No newline at end of file diff --git a/app/views/blobs/show.html.erb b/app/views/blobs/show.html.erb index a53e8bb..1c1a9f4 100644 --- a/app/views/blobs/show.html.erb +++ b/app/views/blobs/show.html.erb @@ -17,7 +17,7 @@ #++ %> -<% @page_title = "#{current_path.join("/")} - #{@repository.name} in #{@project.title}" -%> +<% @page_title = t("views.blobs.page_title", :path => current_path.join("/"), :repo => @repository.name, :title => @project.title) -%> <% @load_syntax_themes = true -%> <% content_for :submenu do -%> @@ -26,16 +26,16 @@ <ul class="mode_selector"> <li class="list_header"> - Softwrap mode: + <%= t("views.blobs.wrap") %>: </li> <li> - <%= link_to_function "Toggle", "Gitorious.Wordwrapper.toggle($$('table#codeblob td.code'))" -%> + <%= link_to_function t("views.common.toggle"), "Gitorious.Wordwrapper.toggle($$('table#codeblob td.code'))" -%> </li> </ul> <h1> - Blob of <code><%= current_path.join("/") -%></code> - <small>(<%= link_to "raw blob data", raw_blob_path(@commit.id, current_path) -%>)</small> + <%= t("views.blobs.title", :path => current_path.join("/")) %> + <small>(<%= link_to t("views.blobs.raw"), raw_blob_path(@commit.id, current_path) -%>)</small> </h1> <!-- <%= @blob.mime_type -%> --> @@ -47,8 +47,8 @@ <% end -%> <% elsif too_big_to_render?(@blob.size) && @blob.mime_type =~ /^text/ -%> <p> - This file is too big to be rendered within reasonable time, - <%= link_to "try viewing the raw data", raw_blob_path(@commit.id, current_path) -%> + <%= t("views.blobs.too_big_1") -%> + <%= link_to t("views.blobs.too_big_2"), raw_blob_path(@commit.id, current_path) -%> </p> <% elsif @blob.mime_type =~ /^image/ -%> <% cache(blob_path(@commit.id, params[:path])) do -%> @@ -56,8 +56,8 @@ <% end -%> <% else -%> <p> - Not sure we can display this blob nicely (it's a "<%= @blob.mime_type -%>" mimetype), - <%= link_to "try viewing the raw data", raw_blob_path(@commit.id, current_path) -%> - and see if your browser figures it out. + <%= t("views.blobs.message_1", :mime => @blob.mime_type) -%> + <%= link_to t("views.blobs.too_big_2"), raw_blob_path(@commit.id, current_path) -%> + <%= t("views.blobs.message_2") -%> </p> <% end -%> diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 4455d64..f3757c8 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -24,9 +24,9 @@ <%= link_to(h(comment.user.login), comment.user) -%> | <%= comment.created_at.to_s(:short) -%> <% unless comment.sha1.blank? -%> - | <%= link_to "on commit #{comment.sha1[0..7]}", project_repository_commit_path(comment.project, comment.repository, comment.sha1) -%> + | <%= link_to t("views.comments.commit", :sha1 => comment.sha1[0..7]), project_repository_commit_path(comment.project, comment.repository, comment.sha1) -%> <% end -%> - | <%= link_to %Q{<abbr title="permalink for this comment">#</abbr>}, + | <%= link_to t("views.comments.permalink"), project_repository_comments_path(comment.project, comment.repository, :anchor => dom_id(comment)) -%> </p> </div>
\ No newline at end of file diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index 48ae4e4..48e6472 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -20,7 +20,7 @@ <% comment ||= nil -%> <% sha1 ||= nil -%> -<h3>Add a new comment:</h3> +<h3><%= t("views.comments.add_title") %>:</h3> <% if logged_in? -%> <%= error_messages_for :comment -%> @@ -29,16 +29,16 @@ <%= f.hidden_field :sha1, :value => sha1 -%> <% end -%> <p> - <%= f.label :body, "Comment" -%><br /> + <%= f.label :body, t("views.comments.body") -%><br /> <%= f.text_area :body, :class => "text medium" -%> </p> <p> - <%= f.submit "Add Comment" -%> + <%= f.submit t("views.comments.add") -%> </p> <% end -%> <% else -%> <p> - <em><%= link_to "Login", new_sessions_path -%> or - <%= link_to "create an account", new_user_path -%> to post a comment</em> + <em><%= link_to t("views.sessions.login"), new_sessions_path -%> or + <%= link_to t("views.accounts.create"), new_user_path -%> to post a comment</em> </p> <% end -%>
\ No newline at end of file diff --git a/app/views/comments/commit.html.erb b/app/views/comments/commit.html.erb index 0714d29..6a0a021 100644 --- a/app/views/comments/commit.html.erb +++ b/app/views/comments/commit.html.erb @@ -17,16 +17,16 @@ #++ %> -<% @page_title = "Comments in #{@repository.name}" -%> +<% @page_title = t("views.comments.page_title", :repo => @repository.name) -%> <h1>Comments on commit <%= h(@commit.id[0,7]) -%> in <%= h(@repository.name) -%></h1> <%= render :partial => "commits/commit_infobox" -%> <div class="commit_message"><%= simple_format(h(@commit.message)) -%></div> <ul class="tab_menu"> - <li><%= link_to "Commit diff", + <li><%= link_to t("views.comments.diff"), project_repository_commit_path(@project, @repository, @commit.id) -%></li> - <li class="selected">Comments (<%= @comments.size -%>)</li> + <li class="selected"><%= t("views.comments.total", :total => @comments.size) %></li> </ul> <%= render :partial => @comments -%> diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb index 9dcabbd..ef8ef57 100644 --- a/app/views/comments/index.html.erb +++ b/app/views/comments/index.html.erb @@ -17,9 +17,9 @@ #++ %> -<% @page_title = "Comments on #{@project.title}" -%> +<% @page_title = t("views.comments.page_title_2", :title => @project.title) -%> <h1> - Comments for "<%= h(@repository.name) -%>" repository in <%= h(@repository.project.title) -%> + <%= t("views.comments.page_title_3", :repo => h(@repository.name), :title => h(@repository.project.title)) %> </h1> <%= render :partial => @comments -%> diff --git a/app/views/commits/_commit_infobox.html.erb b/app/views/commits/_commit_infobox.html.erb index 2330c4f..38642eb 100644 --- a/app/views/commits/_commit_infobox.html.erb +++ b/app/views/commits/_commit_infobox.html.erb @@ -19,12 +19,12 @@ %> <ul class="infobox"> - <li><strong>Date:</strong> <%=h @commit.committed_date -%></li> - <li><strong>Committer:</strong> <%=h @commit.committer.name -%> + <li><strong><%= t("views.commits.date") %>:</strong> <%=h @commit.committed_date -%></li> + <li><strong><%= t("views.commits.committer") %>:</strong> <%=h @commit.committer.name -%> (<%=h GitoriousConfig["mangle_email_addresses"] ? encoded_mail(@commit.committer.email) : @commit.committer.email -%>)</li> - <li><strong>Author:</strong> <%=h @commit.author.name -%> + <li><strong><%= t("views.commits.author") %>:</strong> <%=h @commit.author.name -%> (<%=h GitoriousConfig["mangle_email_addresses"] ? encoded_mail(@commit.author.email) : @commit.author.email -%>)</li> - <li><strong>Commit SHA1:</strong> <%=h @commit.id -%></li> - <li><strong>Tree SHA1:</strong> <%= link_to h(@commit.tree.id), + <li><strong><%= t("views.commits.sha1") %>:</strong> <%=h @commit.id -%></li> + <li><strong><%= t("views.commits.tree_sha1") %>:</strong> <%= link_to h(@commit.tree.id), project_repository_tree_path(@project, @repository, @commit.id) -%></li> </ul> diff --git a/app/views/commits/show.html.erb b/app/views/commits/show.html.erb index dcb2e85..fd111a6 100644 --- a/app/views/commits/show.html.erb +++ b/app/views/commits/show.html.erb @@ -19,17 +19,17 @@ #++ %> -<% @page_title = "Commit in #{@repository.name} in #{@project.title}" -%> +<% @page_title = t("views.commits.page_title", :repo => @repository.name, :title => @project.title) -%> -<h1>Commit <%=h @commit.id -%></h1> +<h1><%= t("views.commits.title", :commit => h( @commit.id)) %></h1> <a name="infobox"></a> <%= render :partial => "commit_infobox" -%> <div class="commit_message"><%= simple_format(h(@commit.message)) -%></div> <ul class="tab_menu"> - <li class="selected">Commit diff</li> - <li><%= link_to "Comments (#{@comment_count})", + <li class="selected"><%= t("views.comments.diff") %></li> + <li><%= link_to t("views.comments.total", :total => @comment_count), project_repository_commit_comment_path(@project, @repository, @commit.id) -%></li> </ul> @@ -37,8 +37,8 @@ <% if @diffs.blank? -%> <p> - This is the initial commit in this repository, - <%= link_to "browse the initial tree state", tree_path(@commit.id) -%>. + <%= t("views.commits.message_1") %> + <%= link_to t("views.commits.message_2"), tree_path(@commit.id) -%>. </p> <% else -%> <% cache({:diffmode => @diffmode}) do -%> diff --git a/app/views/committers/new.html.erb b/app/views/committers/new.html.erb index 6a69f72..e83de09 100644 --- a/app/views/committers/new.html.erb +++ b/app/views/committers/new.html.erb @@ -18,9 +18,7 @@ #++ %> -<h1> - Give a user commit rights to <%= h(@repository.name) -%> -</h1> +<h1><%= t("views.committers.title", :repo => h(@repository.name)) %></h1> <style> li.committer { height: 32px; @@ -47,11 +45,11 @@ <% form_for @committer, :url => {:controller => "committers", :action => "create"}, :method => :post do |f| -%> <p> - <%= f.label :login, "Existing username <small>(search-as-you-type)</small>" -%><br /> + <%= f.label :login, t("views.committers.login") -%><br /> <%= text_field_with_auto_complete :user, :login, {}, :skip_style => true, :select => :login -%> </p> <p> - <%= f.submit "Add as committer" -%> or <%= link_to "cancel", [@repository.project, @repository] -%> + <%= f.submit t("views.committers.add") -%> <%= t("views.common.or") %> <%= link_to t("views.common.cancel"), [@repository.project, @repository] -%> </p> <% end -%> diff --git a/app/views/events/_event.html.erb b/app/views/events/_event.html.erb index a4343b3..6cb230c 100644 --- a/app/views/events/_event.html.erb +++ b/app/views/events/_event.html.erb @@ -20,7 +20,7 @@ <% action, body, category = action_and_body_for_event(event) %> <li class="event_instance"> - <p class="event_date"><%= event.created_at.strftime("%H:%M") %></p> + <p class="event_date"><%= event.created_at.to_s(:short_time) %></p> <%= gravatar(event.user.email, :size => 16) %> <p class="event_category <%= category -%>"><%= category.humanize -%></p> <div class="event_meta"> diff --git a/app/views/events/_events.html.erb b/app/views/events/_events.html.erb index 3b93bde..5f7d66a 100644 --- a/app/views/events/_events.html.erb +++ b/app/views/events/_events.html.erb @@ -19,7 +19,7 @@ %> <ul class="events"> -<% events.group_by{|e| e.created_at.strftime("%A %B %d") }.each do |day, events_group| -%> +<% events.group_by{|e| e.created_at.to_s(:human) }.each do |day, events_group| -%> <li> <p class="date"><%= day -%></p> <ul class="event_instances"> diff --git a/app/views/events/index.atom.builder b/app/views/events/index.atom.builder index 62046c5..6af4a47 100644 --- a/app/views/events/index.atom.builder +++ b/app/views/events/index.atom.builder @@ -16,7 +16,7 @@ #++ atom_feed do |feed| - feed.title("Gitorious activities") + feed.title(t("views.events.activities")) feed.updated((@events.blank? ? Time.now : @events.first.created_at)) @events.each do |event| diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb index 6f7c8b2..de65a2e 100644 --- a/app/views/events/index.html.erb +++ b/app/views/events/index.html.erb @@ -17,9 +17,9 @@ #++ %> -<% @page_title = "Events" -%> +<% @page_title = t("views.events.page_title") -%> -<h2>System Activities<%= link_to image_tag("feed.png", :width => 24, :height => 24), @atom_auto_discovery_url %></h2> +<h2><%= t("views.events.system_activities")%><%= link_to image_tag("feed.png", :width => 24, :height => 24), @atom_auto_discovery_url %></h2> <%= render :partial => "events", :object => @events -%> diff --git a/app/views/keys/_key.html.erb b/app/views/keys/_key.html.erb index 972daa5..56b2ee3 100644 --- a/app/views/keys/_key.html.erb +++ b/app/views/keys/_key.html.erb @@ -20,7 +20,7 @@ <pre> <% render_if_ready(ssh_key) do -%> <code><%= ssh_key.wrapped_key -%></code> - <%= button_to "delete", account_key_path(ssh_key), - :confirm => "Are you sure?", :method => :delete, :class => "inline" -%> + <%= button_to t("views.common.delete"), account_key_path(ssh_key), + :confirm => t("views.common.confirm"), :method => :delete, :class => "inline" -%> <% end -%> </pre>
\ No newline at end of file diff --git a/app/views/keys/edit.html.erb b/app/views/keys/edit.html.erb index 04317a1..a9837fd 100644 --- a/app/views/keys/edit.html.erb +++ b/app/views/keys/edit.html.erb @@ -17,20 +17,20 @@ #++ %> -<h1>Edit a SSH key</h1> +<h1><%= t("views.keys.edit_title") %></h1> <%= error_messages_for :ssh_key -%> <% form_for @ssh_key, :url => account_key_path(@ssh_key) do |f| -%> <p> - <%= f.label :key -%><br /> + <%= f.label :key, t(:key, :scope => "activerecord.attributes.keys") -%><br /> <%= f.text_area :key, :class => "text medium" -%> </p> - <%= f.submit "Save" -%> + <%= f.submit t("views.common.save") -%> <% end -%> <% content_for :submenu do -%> <ul> - <li><%= link_to "Account", account_path -%></li> + <li><%= link_to t("views.account.show_title"), account_path -%></li> </ul> <% end -%>
\ No newline at end of file diff --git a/app/views/keys/index.html.erb b/app/views/keys/index.html.erb index 3e0b358..39c8552 100644 --- a/app/views/keys/index.html.erb +++ b/app/views/keys/index.html.erb @@ -19,7 +19,7 @@ <% @page_title = "SSH Keys" -%> -<h1>Your SSH keys</h1> +<h1><%= t("views.keys.ssh_keys") %></h1> <ul> <% @ssh_keys.each do |ssh_key| -%> @@ -27,10 +27,10 @@ <% end -%> </ul> -<p><%= link_to "Add", new_account_key_path -%></p> +<p><%= link_to t("views.common.add"), new_account_key_path -%></p> <% content_for :submenu do -%> <ul> - <li><%= link_to "Account", account_path -%></li> + <li><%= link_to t("views.account.show_title"), account_path -%></li> </ul> <% end -%>
\ No newline at end of file diff --git a/app/views/keys/new.html.erb b/app/views/keys/new.html.erb index fc4fd06..c83045b 100644 --- a/app/views/keys/new.html.erb +++ b/app/views/keys/new.html.erb @@ -17,21 +17,19 @@ #++ %> -<h1>Add a new public SSH key</h1> +<h1><%= t("views.keys.add_title") %></h1> <%= error_messages_for :ssh_key -%> <% form_for @ssh_key, :url => account_keys_path() do |f| -%> <p> - <%= f.label :key, "Your public key" -%><br /> - <small class="hint">It's generally located in ~/.ssh/id_rsa.pub or - ~/.ssh/id_dsa.pub.<br /> - If you want to use multiple keys you'll have to add each of them seperately</small><br /> + <%= f.label :key, t("views.keys.your_public_key") -%><br /> + <small class="hint"><%= t("views.keys.hint") %></small><br /> <%= f.text_area :key, :class => "text medium" -%> </p> - <%= f.submit "Save" -%> + <%= f.submit t("views.common.save") -%> <% end -%> <% content_for :submenu do -%> - <li><%= link_to "My account", account_path -%></li> + <li><%= link_to t("views.account.my_account"), account_path -%></li> <% end -%>
\ No newline at end of file diff --git a/app/views/keys/show.html.erb b/app/views/keys/show.html.erb index 583a696..ff1c308 100644 --- a/app/views/keys/show.html.erb +++ b/app/views/keys/show.html.erb @@ -20,5 +20,5 @@ <%= render :partial => "key", :locals => {:ssh_key => @ssh_key} -%> <% content_for :submenu do -%> - <li><%= link_to "My Account", account_path -%></li> + <li><%= link_to t("views.account.my_account"), account_path -%></li> <% end -%>
\ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 28f9572..3f3f10f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -26,18 +26,18 @@ <title><%= @page_title ? @page_title + " - " : "" -%>Gitorious</title> <meta name="author" content="Johan Sørensen"> <%= stylesheet_link_tag "base" -%> - <%= syntax_themes_css -%> - <%= javascript_include_tag :defaults, :cache => true -%> - <% if @atom_auto_discovery_url -%> + <%= syntax_themes_css -%> + <%= javascript_include_tag :defaults, :cache => true -%> + <% if @atom_auto_discovery_url -%> <%= auto_discovery_link_tag(:atom, @atom_auto_discovery_url) -%> - <% end -%> - <%= GitoriousConfig["extra_html_head_data"] -%> + <% end -%> + <%= GitoriousConfig["extra_html_head_data"] -%> </head> <body id="<%= controller.controller_name -%>"> <% unless GitoriousConfig["system_message"].blank? -%> <div id="system_message"> - <p><strong>System notice:</strong> <%= GitoriousConfig["system_message"] -%></p> + <p><strong><%= t("views.layout.system_notice") %>:</strong> <%= GitoriousConfig["system_message"] -%></p> </div> <% end -%> <div id="header"> @@ -46,26 +46,26 @@ </h1> <ul id="menu"> <% unless logged_in? -%> - <li><%= link_to "Home", root_path -%></li> + <li><%= link_to t("views.layout.home"), root_path -%></li> <% end -%> <% if logged_in? -%> - <li><%= link_to "Dashboard", dashboard_path -%></li> + <li><%= link_to t("views.layout.dashboard"), dashboard_path -%></li> <% if current_user.admin? -%> - <li><%= link_to "Administration", admin_users_path -%></li> + <li><%= link_to t("views.layout.admin"), admin_users_path -%></li> <% end -%> <% end -%> <% if GitoriousConfig['public_mode'] || logged_in? -%> - <li><%= link_to "Projects", projects_path -%></li> - <li><%= link_to "Search", search_path -%></li> + <li><%= link_to t("views.layout.projects"), projects_path -%></li> + <li><%= link_to t("views.layout.search"), search_path -%></li> <% end -%> <% if logged_in? -%> - <li><%= link_to "FAQ", faq_path -%></li> + <li><%= link_to t("views.layout.faq"), faq_path -%></li> <% else -%> - <li><%= link_to "About", about_path -%></li> + <li><%= link_to t("views.layout.about"), about_path -%></li> <% end -%> <%- if logged_in? -%> - <li class="secondary">( <%= link_to "My account", account_path -%></li> - <li class="secondary"><%= link_to "Logout", logout_path -%> )</li> + <li class="secondary">( <%= link_to t("views.layout.my_account"), account_path -%></li> + <li class="secondary"><%= link_to t("views.layout.logout"), logout_path -%> )</li> <%- else -%> <% if GitoriousConfig['public_mode'] -%> <li class="secondary"><%= link_to "Register", new_user_path -%></li> @@ -74,27 +74,29 @@ <%- end -%> </ul> - <%= render :partial => "/searches/search_box" -%> + <% if GitoriousConfig['public_mode'] || logged_in? -%> + <%= render :partial => "/searches/search_box" -%> + <% end -%> <% if @project -%> <h2 id="project_title"><%= link_to h(@project.title), @project -%></h2> <ul id="submenu" class="<%= @content_for_submenu.blank? ? "white" : "" -%>"> <li class="<%= submenu_selected_class_if_current?(:overview) -%>"> - <%= link_to "Project Overview", + <%= link_to t("views.layout.project_overview"), project_path(@project), :class => "round-top-5" -%> </li> <li class="<%= submenu_selected_class_if_current?(:repositories) -%>"> - <%= link_to "Repositories", + <%= link_to t("views.layout.repositories"), project_repositories_path(@project), :class => "round-top-5" -%> </li> </ul> <% end -%> <% if controller.is_a? Admin::UsersController -%> - <h2 id="project_title"><%= link_to "Administration", '' %></h2> + <h2 id="project_title"><%= link_to t("views.layout.admin"), '' %></h2> <ul id="submenu" class="white"> <li class="selected"> - <%= link_to "User Management", + <%= link_to t("views.layout.user_mgt"), '', :class => "round-top-5" -%> </li> </ul> @@ -117,10 +119,10 @@ <% end -%> <div id="footer"> <ul> - <li><%= link_to "Home", root_path -%> | </li> - <li><%= link_to "About", about_path -%> | </li> - <li><%= link_to "FAQ", faq_path -%> | </li> - <li><%= link_to "Discussion group", "http://groups.google.com/group/gitorious" -%></li> + <li><%= link_to t("views.layout.home"), root_path -%> | </li> + <li><%= link_to t("views.layout.about"), about_path -%> | </li> + <li><%= link_to t("views.layout.faq"), faq_path -%> | </li> + <li><%= link_to t("views.layout.discussion"), "http://groups.google.com/group/gitorious" -%></li> </ul> </div> </div> diff --git a/app/views/logs/_log.html.erb b/app/views/logs/_log.html.erb index f492e74..a5498b1 100644 --- a/app/views/logs/_log.html.erb +++ b/app/views/logs/_log.html.erb @@ -21,14 +21,14 @@ <% users_by_email = @repository.users_by_commits(@commits) %> <ul class="events"> -<% @commits.group_by{|c| c.committed_date.strftime("%A %B %d") }.each do |day, commits| -%> +<% @commits.group_by{|c| c.committed_date.to_s(:human) }.each do |day, commits| -%> <li> <p class="date"><%= day -%></p> <ul class="event_instances"> <% commits.each do |commit| -%> <% user = users_by_email[commit.author.email] %> <li class="event_instance"> - <p class="event_date"><%= commit.committed_date.strftime("%H:%M") %></p> + <p class="event_date"><%= commit.committed_date.to_s(:short_time) %></p> <%= gravatar(commit.author.email, :size => 16) %> <div class="event_meta"> <p> diff --git a/app/views/logs/show.html.erb b/app/views/logs/show.html.erb index 800d33d..e601b1e 100644 --- a/app/views/logs/show.html.erb +++ b/app/views/logs/show.html.erb @@ -18,9 +18,9 @@ #++ %> -<% @page_title = "Commits in #{@repository.name} in #{@project.title}" -%> +<% @page_title = t("views.logs.page_title", :repo => h(@repository.name), :title => h(@project.title)) -%> <h1> - Commitlog for <%= h(@repository.name) -%>:<%=h params[:id] -%> in <%= h(@project.title) -%> + <%= t("views.logs.commitlog", :repo => h(@repository.name), :param => h(params[:id]), :title => h(@project.title)) -%> </h1> <div class="commit_graph"> @@ -35,15 +35,15 @@ <% content_for :sidebar do -%> <ul> - <li><strong>Project:</strong> <%= link_to h(@repository.project.title), @repository.project -%></li> - <li><strong>Maintainer:</strong> <%= link_to h(@repository.user.login), @repository.user -%></li> + <li><strong><%= t("views.logs.project") %>:</strong> <%= link_to h(@repository.project.title), @repository.project -%></li> + <li><strong><%= t("views.logs.maintainer") %>:</strong> <%= link_to h(@repository.user.login), @repository.user -%></li> <% unless @commits.blank? -%> - <li><strong>HEAD tree:</strong> <%= link_to h(@commits.first.tree.id[0,7]), + <li><strong><%= t("views.logs.head_tree") %>:</strong> <%= link_to h(@commits.first.tree.id[0,7]), tree_path(@commits.first.id) -%></li> <% end -%> </ul> - <h5>Branches:</h5> + <h5><%= t("views.logs.branches") %>:</h5> <ul> <% @git.branches.sort{|a, b| a.name <=> b.name }.each do |branch| -%> <% if namespaced_branch?(branch.name) -%> @@ -55,7 +55,7 @@ </ul> <% unless @git.tags.blank? -%> - <h5>Tags:</h5> + <h5><%= t("views.logs.tags") %>:</h5> <ul> <% @git.tags.sort{|a, b| a.name <=> b.name }.each do |tag| -%> <li><%= link_to h(tag.name), commit_path(tag.commit.id) -%></li> diff --git a/app/views/mailer/activation.rhtml b/app/views/mailer/activation.html.erb index 39e86db..39e86db 100644 --- a/app/views/mailer/activation.rhtml +++ b/app/views/mailer/activation.html.erb diff --git a/app/views/mailer/forgotten_password.rhtml b/app/views/mailer/forgotten_password.html.erb index ce1ba7f..ce1ba7f 100644 --- a/app/views/mailer/forgotten_password.rhtml +++ b/app/views/mailer/forgotten_password.html.erb diff --git a/app/views/mailer/merge_request_notification.rhtml b/app/views/mailer/merge_request_notification.html.erb index 554a478..554a478 100644 --- a/app/views/mailer/merge_request_notification.rhtml +++ b/app/views/mailer/merge_request_notification.html.erb diff --git a/app/views/mailer/new_repository_clone.rhtml b/app/views/mailer/new_repository_clone.html.erb index 6c45a62..6c45a62 100644 --- a/app/views/mailer/new_repository_clone.rhtml +++ b/app/views/mailer/new_repository_clone.html.erb diff --git a/app/views/mailer/signup_notification.rhtml b/app/views/mailer/signup_notification.html.erb index d3adf9a..d3adf9a 100644 --- a/app/views/mailer/signup_notification.rhtml +++ b/app/views/mailer/signup_notification.html.erb diff --git a/app/views/merge_requests/_form.html.erb b/app/views/merge_requests/_form.html.erb index aac7de2..a66a585 100644 --- a/app/views/merge_requests/_form.html.erb +++ b/app/views/merge_requests/_form.html.erb @@ -18,22 +18,22 @@ %> <p> - <%= form.label :target_repository_id -%><br /> - <small class="hint">The one you wish this repository should be merged with</small><br /> + <%= form.label :target_repository_id, t(:target_repository_id, :scope => 'activerecord.attributes.merge_request') -%><br /> + <small class="hint"><%= t("views.merges.info.target_repos") %></small><br /> <%= form.select :target_repository_id, @repositories.map{|r| [r.name, r.id] } -%> </p> <p> - <%= form.label :target_branch -%><br /> - <small class="hint">The target branch you wish your changes to be merged into</small><br /> + <%= form.label :target_branch, t(:target_branch, :scope => 'activerecord.attributes.merge_request') -%><br /> + <small class="hint"><%= t("views.merges.info.target_branch") %></small><br /> <%= form.text_field :target_branch, :class => "text", :value => form.object.target_branch -%> </p> <p> - <%= form.label :source_branch -%><br /> - <small class="hint">The source branch you wish the target repository should merge from</small><br /> + <%= form.label :source_branch, t(:source_branch, :scope => 'activerecord.attributes.merge_request') -%><br /> + <small class="hint"><%= t("views.merges.info.source_branch") %></small><br /> <%= form.text_field :source_branch, :class => "text", :value => form.object.source_branch -%> </p> <p> - <%= form.label :proposal -%><br /> - <small class="hint">A short summary of your changes</small><br /> + <%= form.label :proposal, t(:proposal, :scope => 'activerecord.attributes.merge_request') -%><br /> + <small class="hint"><%= t("views.merges.info.proposal") %></small><br /> <%= form.text_area :proposal, :class => "text medium" -%> </p>
\ No newline at end of file diff --git a/app/views/merge_requests/_merge_request.html.erb b/app/views/merge_requests/_merge_request.html.erb index 8c30663..5080867 100644 --- a/app/views/merge_requests/_merge_request.html.erb +++ b/app/views/merge_requests/_merge_request.html.erb @@ -22,10 +22,11 @@ <div class="merge_request_summary <%= merge_request.status_string -%>"> <p class="status">[<span><%= merge_request.status_string -%></span>]</p> <h5> - <%= link_to h(merge_request.source_name), + <% @source = link_to h(merge_request.source_name), [merge_request.source_repository.project, merge_request.source_repository] -%> - has requested a merge with <%= link_to h(merge_request.target_name), - [merge_request.source_repository.project, merge_request.target_repository] -%>: + <% @target = link_to h(merge_request.target_name), + [merge_request.source_repository.project, merge_request.target_repository] -%> + <%= t("views.merges.summary_title", :source => @source, :target => @target) -%> </h5> <div class="proposal"><%= sanitize(simple_format(merge_request.proposal)) -%></div> <p class="byline"> @@ -33,7 +34,7 @@ <%= merge_request.created_at.to_s(:short) -%> <% if !no_link && merge_request.open? -%> | <strong> - <%= link_to "Review merge request →", + <%= link_to t("views.merges.review"), [merge_request.source_repository.project, merge_request.target_repository, merge_request] -%> </strong> diff --git a/app/views/merge_requests/index.html.erb b/app/views/merge_requests/index.html.erb index 256b21d..ab690c7 100644 --- a/app/views/merge_requests/index.html.erb +++ b/app/views/merge_requests/index.html.erb @@ -17,19 +17,14 @@ #++ %> -<% @page_title = "Merge requests in #{h(@repository.name)}" -%> -<h1> - Merge requests in <%=h @repository.name -%> -</h1> +<% @page_title = t("views.merges.page_title", :repo => h(@repository.name)) -%> +<h1><%= t("views.merges.page_title", :repo => h(@repository.name)) %></h1> -<p class="hint"> - A "merge request" is a notification from one repository to another that - would like their changes to be merged upstream. -</p> +<p class="hint"><%= t("views.merges.hint") %></p> <% if @merge_requests.blank? -%> <p> - <em>No merge requests yet</em><br /> + <em><%= t("views.merges.no_merge") %></em><br /> </p> <% else -%> <%= render :partial => @merge_requests -%> diff --git a/app/views/merge_requests/new.html.erb b/app/views/merge_requests/new.html.erb index 549146f..8efe0fa 100644 --- a/app/views/merge_requests/new.html.erb +++ b/app/views/merge_requests/new.html.erb @@ -17,14 +17,14 @@ #++ %> -<h1>Create a merge request</h1> +<h1><%= t("views.merges.create_title") %></h1> <%= error_messages_for :merge_request -%> <% form_for [@project, @repository, @merge_request] do |f| -%> <%= render :partial => "form", :locals => {:form => f} -%> - <%= f.submit "Create merge request" -%> + <%= f.submit t("views.merges.create_btn") -%> <% end -%> <% content_for :submenu do -%> diff --git a/app/views/merge_requests/show.html.erb b/app/views/merge_requests/show.html.erb index 100f9ab..19a59b0 100644 --- a/app/views/merge_requests/show.html.erb +++ b/app/views/merge_requests/show.html.erb @@ -17,10 +17,7 @@ #++ %> -<h1> - Reviewing merge request "<%=h @merge_request.source_repository.name -%>" → - "<%= @merge_request.target_repository.name -%>" -</h1> +<h1><%= t("views.merges.show_title", :source => h(@merge_request.source_repository.name), :target => h(@merge_request.target_repository.name)) -%></h1> <%= render :partial => @merge_request, :locals => { :no_link => true } -%> @@ -31,17 +28,26 @@ <p> <%= f.label :status -%><br /> <%= f.select :status, MergeRequest.statuses.sort_by{|k,v| v } -%><br /> - <%= f.submit "Update merge request" -%></p> + <%= f.submit t("views.merges.update_btn") -%></p> <% end -%> <% if @merge_request.open? -%> - <p>The simplest way to merge in these changes is to simply pull them in with the following command:</p> - <pre>git pull <%= @merge_request.source_repository.clone_url -%> <%= @merge_request.source_branch -%></pre> + <p><%= t("views.merges.help") %></p> + <pre> + git checkout master + git checkout -b review/master + git remote add review <%= @merge_request.source_repository.clone_url -%> + git pull review <%= @merge_request.source_branch -%> + # review changes, assess they are ok + git checkout master + git merge review/master + git push origin master + </pre> <% end -%> <% end -%> <% if @merge_request.open? -%> -<h2>Commits that would be merged:</h2> +<h2><%= t("views.merges.commits") %>:</h2> <ul class="shortlog"> <% @commits.each do |commit| -%> diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb index 8274388..b611294 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/projects/_form.html.erb @@ -19,12 +19,12 @@ %> <p> - <%= form.label :title -%><br /> + <%= form.label :title, t(:title, :scope => 'activerecord.attributes.project') -%><br /> <%= form.text_field :title, :class => "text" -%> </p> <% unless ["edit", "update"].include?(controller.action_name) -%> <p> - <%= form.label :slug, "Slug (for urls etc)" -%><br /> + <%= form.label :slug, t(:slug, :scope => 'activerecord.attributes.project') -%><br /> <%= form.text_field :slug, :class => "text" -%> </p> <script type="text/javascript" charset="utf-8"> @@ -32,30 +32,27 @@ </script> <% end -%> <p> - <%= form.label :tag_list, "Categories (space seperated)" -%><br /> + <%= form.label :tag_list, t(:tag_list, :scope => 'activerecord.attributes.project') -%><br /> <%= form.text_field :tag_list, :class => "text" -%> </p> <p> - <%= form.label :license -%><br /> + <%= form.label :license, t(:license, :scope => 'activerecord.attributes.project') -%><br /> <%= form.select :license, Project::LICENSES -%> </p> <p> - <%= form.label :home_url, "Home URL (eg Rubyforge etc)" -%><br /> + <%= form.label :home_url, t(:home_url, :scope => 'activerecord.attributes.project') -%><br /> <%= form.text_field :home_url, :class => "text" -%> </p> <p> - <%= form.label :mailinglist_url, "Mailinglist URL (if any)" -%><br /> + <%= form.label :mailinglist_url, t(:mailinglist_url, :scope => 'activerecord.attributes.project') -%><br /> <%= form.text_field :mailinglist_url, :class => "text" -%> </p> <p> - <%= form.label :bugtracker_url, "Bugtracker URL (if any)" -%><br /> + <%= form.label :bugtracker_url, t(:bugtracker_url, :scope => 'activerecord.attributes.project') -%><br /> <%= form.text_field :bugtracker_url, :class => "text" -%> </p> <p> - <%= form.label :description, "Description (obligatory)" -%><br /> - <small class="hint"> - <a href="http://daringfireball.net/projects/markdown/">Markdown</a> and - basic html is allowed - </small><br /> - <%= form.text_area :description, :class => "text wide tall" -%> + <%= form.label :description, t(:description, :scope => 'activerecord.attributes.project') -%><br /> + <small class="hint"><%= t("views.projects.hint") %></small><br /> + <%= form.text_area :description, :class => "text wide shorter" -%> </p>
\ No newline at end of file diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index b55976a..1fb5f75 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -21,6 +21,6 @@ <h3><%= link_to h(project.title), project_path(project) -%></h3> <p><%= truncate h(project.stripped_description), 250 -%></p> <p class="hint"> - <strong>Categories:</strong> - <%= project.tag_list.blank? ? "none" : linked_tag_list_as_sentence(project.tags) -%> + <strong><%= t("views.projects.categories") %>:</strong> + <%= project.tag_list.blank? ? t("views.common.none") : linked_tag_list_as_sentence(project.tags) -%> </p> diff --git a/app/views/projects/confirm_delete.html.erb b/app/views/projects/confirm_delete.html.erb index 463760d..17722bf 100644 --- a/app/views/projects/confirm_delete.html.erb +++ b/app/views/projects/confirm_delete.html.erb @@ -18,22 +18,22 @@ #++ %> -<h1>Please confirm deletion of <%= h(@project.title) -%></h1> +<h1><%= t("views.projects.delete_title", :title => h(@project.title)) %></h1> <p class="important_message"> - Once you press this button the project will be deleted + <%= t("views.projects.delete_message") %> <% form_for @project, :html => {:method => :delete} do |f| -%> - <%= f.submit("YES I am sure I want to delete this project permanently") -%> + <%= f.submit(t("views.projects.delete_btn")) -%> <% end -%> </p> <% content_for :submenu do -%> - <li class="selected"><%= link_to "Edit project", edit_project_path(@project) -%></li> + <li class="selected"><%= link_to t("views.projects.edit"), edit_project_path(@project) -%></li> <% end -%> <% content_for :sidebar do -%> <ul class="links"> - <li><%= link_to "Back to edit screen", edit_project_path(@project) -%></li> + <li><%= link_to t("views.projects.back"), edit_project_path(@project) -%></li> </ul> <% end -%>
\ No newline at end of file diff --git a/app/views/projects/edit.html.erb b/app/views/projects/edit.html.erb index bd8eec5..09638a7 100644 --- a/app/views/projects/edit.html.erb +++ b/app/views/projects/edit.html.erb @@ -18,22 +18,22 @@ #++ %> -<h1>Update <%= link_to h(@project.title), project_path(@project) -%></h1> +<h1><%= t("views.projects.update_title", :link => link_to( h(@project.title), project_path(@project))) -%></h1> <%= error_messages_for :project -%> <% form_for(@project, :method => "put") do |f| -%> <%= render :partial => "form", :locals => {:form => f} -%> - <%= f.submit "Update" -%> + <%= f.submit t("views.common.update") -%> <% end -%> <% content_for :submenu do -%> - <li class="selected"><%= link_to "Edit project", edit_project_path(@project) -%></li> + <li class="selected"><%= link_to t("views.projects.edit"), edit_project_path(@project) -%></li> <% end -%> <% content_for :sidebar do -%> <ul class="links"> <% if @project.can_be_deleted_by?(current_user) -%> - <li><%= link_to "Delete project", confirm_delete_project_path(@project) -%></li> + <li><%= link_to t("views.projects.delete"), confirm_delete_project_path(@project) -%></li> <% end -%> </ul> <% end -%>
\ No newline at end of file diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 500d85b..7dcfed0 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -17,7 +17,7 @@ #++ %> -<% @page_title = "Projects" -%> +<% @page_title = t("views.projects.title") -%> <ul class="project_list"> <% @projects.each do |project| -%> @@ -30,11 +30,11 @@ <%= will_paginate @projects -%> <% content_for :submenu do -%> - <li><%= link_to "New project", new_project_path -%></li> + <li><%= link_to t("views.projects.new"), new_project_path -%></li> <% end -%> <% content_for :sidebar do -%> - <h4>Popular Categories:</h4> + <h4><%= t("views.projects.popular") %>:</h4> <ul class="tag_list"> <% @tags.each do |tag| %> <li class="tag_size_3"><%= link_to h(tag.name), search_path(:q => "category:#{h(tag.name)}") -%> </li> diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index 3a73b2d..2568a7c 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -17,17 +17,14 @@ #++ %> -<h1>Create a new project</h1> +<h1><%= t("views.projects.new_title") %></h1> <%= error_messages_for :project -%> <% form_for :project, :url => projects_path do |f| -%> <%= render :partial => "form", :locals => {:form => f} -%> - <p class="hint"> - A default "mainline" repository will be created along with the project, allowing - you to start committing right away. - </p> + <p class="hint"><%= t("views.projects.new_hint") %></p> - <%= f.submit "Create project" -%> + <%= f.submit t("views.projects.create") -%> <% end -%>
\ No newline at end of file diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 54afe1f..2fa2596 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -25,39 +25,39 @@ <%= auto_link(markdown(sanitize(@project.description)), :urls) -%> </div> -<h2>Activities<%= feed_icon @atom_auto_discovery_url %></h2> +<h2><%= t("views.site.dashboard.activities") %> <%= feed_icon @atom_auto_discovery_url %></h2> <%= render :partial => "events/events", :locals => { :events => @events } -%> <% content_for :submenu do -%> <% if @project.admin?(current_user) -%> - <li><%= link_to "Project Settings", edit_project_path(@project) -%></li> + <li><%= link_to t("views.projects.settings"), edit_project_path(@project) -%></li> <% end -%> <% end -%> <% content_for :sidebar do -%> <div class="infoboxFU"> <ul> - <li><strong>Labels:</strong> + <li><strong><%= t("views.projects.labels") %>:</strong> <%= @project.tag_list.blank? ? "none" : linked_tag_list_as_sentence(@project.tags) -%></li> - <li><strong>License:</strong> <%= h(@project.license) -%></li> - <li><strong>Owner:</strong> <%= link_to h(@project.user.login), user_path(@project.user) -%></li> - <li><strong>Created:</strong> <%= @project.created_at.to_s(:short) -%></li> + <li><strong><%= t("views.projects.license") %>:</strong> <%= h(@project.license) -%></li> + <li><strong><%= t("views.projects.owner") %>:</strong> <%= link_to h(@project.user.login), user_path(@project.user) -%></li> + <li><strong><%= t("views.projects.created") %>:</strong> <%= @project.created_at.to_s(:short) -%></li> <% unless @project.home_url.blank? -%> - <li><strong>Website at </strong> + <li><strong><%= t("views.projects.website") %></strong> <%= link_to base_url(@project.home_url), h(@project.home_url) -%></li> <% end -%> <% unless @project.mailinglist_url.blank? -%> - <li><strong>Mailinglist at </strong> + <li><strong><%= t("views.projects.mailing") %></strong> <%= link_to base_url(@project.mailinglist_url), h(@project.mailinglist_url) -%></li> <% end -%> <% unless @project.bugtracker_url.blank? -%> - <li><strong>Bugtracker at </strong> + <li><strong><%= t("views.projects.bugtracker") %></strong> <%= link_to base_url(@project.bugtracker_url), h(@project.bugtracker_url) -%></li> <% end -%> </ul> </div> - <h4><%= link_to "Repositories", project_repositories_path(@project) -%></h4> + <h4><%= link_to t("views.projects.repos"), project_repositories_path(@project) -%></h4> <ul class="repository_list"> <li class="mainline"> <div class="name"> diff --git a/app/views/pt-BR/mailer/activation.html.erb b/app/views/pt-BR/mailer/activation.html.erb new file mode 100644 index 0000000..bbe05af --- /dev/null +++ b/app/views/pt-BR/mailer/activation.html.erb @@ -0,0 +1,28 @@ +<% +#-- +# Copyright (C) 2008 Johan Sørensen <johan@johansorensen.com> +# Copyright (C) 2008 David Chelimsky <dchelimsky@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#++ +%> + +Olá <%= @user.login %>, + +sua conta foi ativada. Você pode adicionar sua chave pública de SSH aqui http://<%= GitoriousConfig['gitorious_host'] -%>/account assim como modificar seus dados. + +Atenciosamente, + +http://<%= GitoriousConfig['gitorious_host'] %> + diff --git a/app/views/pt-BR/mailer/forgotten_password.html.erb b/app/views/pt-BR/mailer/forgotten_password.html.erb new file mode 100644 index 0000000..a7a34c4 --- /dev/null +++ b/app/views/pt-BR/mailer/forgotten_password.html.erb @@ -0,0 +1,28 @@ +<% +#-- +# Copyright (C) 2008 Johan Sørensen <johan@johansorensen.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#++ +%> + +Olá <%= @user.login -%>, + +Sua nova senha é: <%= @password %> + +Se você não requisitou uma nova senha, então por favor relate este incidente. + +Atenciosamente, + +http://<%= GitoriousConfig['gitorious_host'] %>
\ No newline at end of file diff --git a/app/views/pt-BR/mailer/merge_request_notification.html.erb b/app/views/pt-BR/mailer/merge_request_notification.html.erb new file mode 100644 index 0000000..6d5db6a --- /dev/null +++ b/app/views/pt-BR/mailer/merge_request_notification.html.erb @@ -0,0 +1,38 @@ +<% +#-- +# Copyright (C) 2008 Johan Sørensen <johan@johansorensen.com> +# Copyright (C) 2008 David Chelimsky <dchelimsky@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#++ +%> + +Olá <%= @merge_request.target_repository.user.login -%>, + +<%= @merge_request.source_repository.user.login -%> requisitou que você mesclasse o repositório +<%= @merge_request.source_repository.name -%> com <%= @merge_request.target_repository.name -%> +no projeto <%= @project.title -%>. + +<% unless @merge_request.proposal.blank? -%> +--- +<%= @merge_request.proposal %> +--- +<% end -%> + +Você pode revisar a requisição e seus commits aqui: +<%= @url %> + +Atenciosamente, + +http://<%= GitoriousConfig['gitorious_host'] %> diff --git a/app/views/pt-BR/mailer/new_repository_clone.html.erb b/app/views/pt-BR/mailer/new_repository_clone.html.erb new file mode 100644 index 0000000..24121f5 --- /dev/null +++ b/app/views/pt-BR/mailer/new_repository_clone.html.erb @@ -0,0 +1,30 @@ +<% +#-- +# Copyright (C) 2008 Johan Sørensen <johan@johansorensen.com> +# Copyright (C) 2008 David Chelimsky <dchelimsky@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#++ +%> + +Olá <%= @user.login -%>, + +<%= @cloner.login -%> recentemente criou um clone do seu repositório +<%= @repository.parent.name -%> no projeto "<%= @project.title -%>". + +<%= @url %> + +Atenciosamente, + +http://<%= GitoriousConfig['gitorious_host'] %>
\ No newline at end of file diff --git a/app/views/pt-BR/mailer/signup_notification.html.erb b/app/views/pt-BR/mailer/signup_notification.html.erb new file mode 100644 index 0000000..f6632b2 --- /dev/null +++ b/app/views/pt-BR/mailer/signup_notification.html.erb @@ -0,0 +1,32 @@ +<% +#-- +# Copyright (C) 2008 Johan Sørensen <johan@johansorensen.com> +# Copyright (C) 2008 David Chelimsky <dchelimsky@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#++ +%> + +Olá, + +Sua conta <%= GitoriousConfig['gitorious_host'] -%> foi criada, seu login é <%= @user.login %> + +Por favor, visite a seguinte url para ativar sua conta: + + <%= @url %> + + +Atenciosamente, + +http://<%= GitoriousConfig['gitorious_host'] %>
\ No newline at end of file diff --git a/app/views/pt-BR/site/about.html.erb b/app/views/pt-BR/site/about.html.erb new file mode 100644 index 0000000..4b1ab4e --- /dev/null +++ b/app/views/pt-BR/site/about.html.erb @@ -0,0 +1,82 @@ +<% +#-- +# Copyright (C) 2008 Johan Sørensen <johan@johansorensen.com> +# Copyright (C) 2008 Jonas Fonseca <fonseca@diku.dk> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#++ +%> + +<% @page_title = "Sobre" -%> +<div class="section"> + <a name="about"></a><h1>Sobre o Gitorious</h1> + + <p><strong>O <a href="/p/gitorious">Gitorious</a> tem como objetivo fornecer + uma grande maneira de colaborar com código opensource de forma distribuída</strong></p> + + <h2>A idéia</h2> + <p>Código Tradicional e construção de projetos oferecem muitas grandes coisas e + sem dúvida ajudaram desenvolvedores de software open source. Entretanto, sempre + existe a questão de mantenabilidade de longo prazo; como humanos sempre nos + distraímos, ficamos ocupados ou apenas cansados de trabalhar com coisas de longo + prazo.</p> + + <p>Controle de versão Distribuído fornece uma maneira ao redor disso tornando a + cópia de todos um repositório completo, de forma que se as pessoas gostarem mais do + repositório de outros, ou se outra pessoa está mantendo o projeto ativamente eles + podem simplesmente puxar dessa pessoa em vez do repositório "oficial". E se o + mantenedor do projeto assim decidir, ele pode puxar essas mudanças para seu próprio + branch principal. É isso que torna open source tão bom.</p> + + <p><strong>O <a href="/p/gitorious">Gitorious</a></strong> fornece uma maneira de + gerenciar esses clones facilmente através de:</p> + + <ul class="bullet_list"> + <li>Ver o que os outros estão fazendo</li> + <li>Saber onde eles podem ser encontrados</li> + <li>Permitir que qualquer um contribua sem precisar de "permissão de commit"</li> + <li>Tornando mais fácil para mantenedores aceitar contribuições</li> + </ul> + + <p>O Gitorious ainda está sob desenvolvimento e existem muitas e muitas coisas que eu + gostaria de fazer com isso. Se tiver idéias para melhoria ou problemas técnicos, + por favor dê uma parada no <a href="http://groups.google.com/group/gitorious">grupo de discussão</a>.</p> + + <p> + Obrigado,<br /> + <a href="/users/johan">Johan Sørensen</a><br /> + <small>mantenedor do Gitorious.org</small> + </p> +</div> + + +<div class="section"> + <a name="contact"></a><h1>Informações de Contato</h1> + <p> + Se tiver algum problema técnico sinta-se à vontade para + <a href="mailto:johan@johansorensen.com">enviar um e-mail</a>, também temos o + <a href="http://groups.google.com/group/gitorious">grupo de discussão</a> para + discussões mais gerais sobre o Gitorious. Também temos o canal de IRC + <a href="irc://irc.freenode.net/gitorious"><code>#gitorious</code></a> + na FreeNode. + </p> +</div> + +<% content_for :sidebar do -%> + <ul class="links"> + <li><a href="#about">Sobre</a></li> + <li><a href="#contact">Contato</a></li> + <li><%= link_to "Q&A", faq_path -%></li> + </ul> +<% end -%>
\ No newline at end of file diff --git a/app/views/pt-BR/site/faq.html.erb b/app/views/pt-BR/site/faq.html.erb new file mode 100644 index 0000000..c83f86b --- /dev/null +++ b/app/views/pt-BR/site/faq.html.erb @@ -0,0 +1,107 @@ +<% +#-- +# Copyright (C) 2008 Johan Sørensen <johan@johansorensen.com> +# Copyright (C) 2008 David Chelimsky <dchelimsky@gmail.com> +# Copyright (C) 2008 Jonas Fonseca <fonseca@diku.dk> +# Copyright (C) 2008 David Aguilar <davvid@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#++ +%> + +<h1>Perguntas e Respostas</h1> + +<h3>Eu recebo um "fatal: no matching remote head" quando tento clonar um repositório</h3> +<p> + Muito provavelmente o repositório está vazio, e essa mensagem de erro é o jeito amigável + do git de dizer isso. Veja abaixo (ou então clicando em "mais informações" próximo à + "URL Privada de Push" do repositório) para informações de como gravar coisas nele. +</p> + +<hr /> + +<h3>Como eu aponto meu repositório local de Git no Gitorious?</h3> +<p> + A maneira mais fácil é colocando alguma coisa parecida com o seguinte no seu + arquivo <code>.git/config</code> do repositório que quer enviar para o Gitorious: +<pre> +[remote "origin"] + url = <%= GitoriousConfig['gitorious_user'] -%>@<%= GitoriousConfig['gitorious_host'] -%>:<em>project</em>/<em>repository.git</em> + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +</pre> + e então <code>git push origin master</code> para enviar os códigos para o Gitorious. +</p> +<p> + Você também pode executar "<code>git push <%= GitoriousConfig['gitorious_user'] -%>@<%= GitoriousConfig['gitorious_host'] -%>:tumbline/mainline.git</code>", ou + você pode configurar um repositório remoto fazendo o seguinte (adicione --fetch para + adicionar a chamada para pegar a configuração de cima): + <pre> + git remote add origin <% GitoriousConfig['gitorious_user'] -%>@<%= GitoriousConfig['gitorious_host'] -%>:<em>project</em>/<em>repository.git</em> + # para gravar o branch master para o repositório remoto origin que adicionamos acima: + git push origin master + # depois disso você pode fazer apenas: + git push + </pre> +</p> + +<hr /> + +<h3>Por que meu e-mail está sendo mostrado?</h3> +<p> + O e-mail que você usou para se registrar no Gitorious é mostrado para outros usuários, + para que eles possam contactá-lo sobre seus projetos se precisarem. Nós tomamos medidas + leves contra crawlers por não mostrá-lo totalmente em texto puro.<br /> + Mas somente para ser claro: nós não vendemos ou usamos qualquer informação que você der para + <%= GitoriousConfig['gitorious_host'] -%> contra você ou para qualquer ganho financeiro e/ou + pessoal. +</p> + +<hr /> + +<h3>Por que eu preciso fazer upload da minha chave pública de SSH?</h3> +<p> + Quando você grava no repositório Git, sua chave pública é como nós o autenticamos + e checamos que você tem as permissões necessária para fazer um commit num dado + repositório. +</p> +<hr /> + +<h3>Eu tenho Windows. Como faço para gerar as chaves SSH que preciso?</h3> +<p> + A maneira recomendada para usar Git no Windows é a versão + <%= link_to "msysGit", "http://code.google.com/p/msysgit/" -%>. Ela vem junto com um + suporte mínimo de Cygwin. Quando terminar de instalar, você terá um ícone "Git Bash" + na sua Área de Trabalho. Dê duplo-clique para abrí-lo e agora você pode usar comandos + no estilo Linux como <code>"ssh-keygen -t rsa"</code>. Apenas vá teclando "Enter" a + cada pergunta que ele fizer e finalmente você terá seu par de chaves sob o diretório + ".ssh". Por exemplo, digite <code>"cat ~/.ssh/id_rsa.pub"</code>. Essa é a chave pública + que você deve copiar e colar na sua conta no Gitorious. +</p> +<hr /> + +<h3>Que versão de Git o Gitorious está usando?</h3> +<p> + <code>git versão 1.5.4.4</code> +</p> + +<% content_for :sidebar do -%> + <ul class="links"> + <li><%= link_to "Sobre", about_path(:anchor => "about") -%></li> + <li><%= link_to "Contato", about_path(:anchor => "contact") -%></li> + <li><%= link_to "Q&A", faq_path -%></li> + </ul> +<% end -%> diff --git a/app/views/repositories/_context_menu.html.erb b/app/views/repositories/_context_menu.html.erb index a6b107a..89897ce 100644 --- a/app/views/repositories/_context_menu.html.erb +++ b/app/views/repositories/_context_menu.html.erb @@ -17,12 +17,12 @@ #++ %> -<li><%= link_to "Overview", [@project, @repository] -%></li> -<li><%= link_to "Commits", +<li><%= link_to t("views.repos.overview"), [@project, @repository] -%></li> +<li><%= link_to t("views.repos.commits"), project_repository_logs_path(@project, @repository) -%></li> -<li><%= link_to "Source Tree", +<li><%= link_to t("views.repos.tree"), project_repository_trees_path(@project, @repository) -%></li> -<li><%= link_to "Comments (#{@repository.comments.count})", +<li><%= link_to t("views.repos.comments", :count => @repository.comments.count), project_repository_comments_path(@project, @repository) -%></li> -<li><%= link_to "Merge requests(#{@repository.merge_requests.count_open})", +<li><%= link_to t("views.repos.requests", :count => @repository.merge_requests.count_open), project_repository_merge_requests_path(@project, @repository) -%></li>
\ No newline at end of file diff --git a/app/views/repositories/_infobox.html.erb b/app/views/repositories/_infobox.html.erb index e84ad2d..ffa6b35 100644 --- a/app/views/repositories/_infobox.html.erb +++ b/app/views/repositories/_infobox.html.erb @@ -20,30 +20,28 @@ <ul class="infobox"> <li> - <strong>Public clone url:</strong> <code><%=h @repository.clone_url -%></code> - <small><%= link_to_function "More info…", "$('detailed_clone_info').toggle()" -%></small> + <strong><%= t("views.repos.public_url") %>:</strong> <code><%=h @repository.clone_url -%></code> + <small><%= link_to_function t("views.repos.more_info"), "$('detailed_clone_info').toggle()" -%></small> <div id="detailed_clone_info" class="info_hint" style="display:none"> - You can clone this repository with the following command:<br /> + <%= t("views.repos.help_clone") %>:<br /> <code>git clone <%= @repository.clone_url -%></code> </div> </li> <li> - <strong>HTTP clone url:</strong> <code><%=h @repository.http_clone_url -%></code> - <small><%= link_to_function "More info…", "$('detailed_http_clone_info').toggle()" -%></small> + <strong><%= t("views.repos.http_url") %>:</strong> <code><%=h @repository.http_clone_url -%></code> + <small><%= link_to_function t("views.repos.more_info"), "$('detailed_http_clone_info').toggle()" -%></small> <div id="detailed_http_clone_info" class="info_hint" style="display:none"> - You can clone this repository with the following command:<br /> + <%= t("views.repos.help_clone") %>:<br /> <code>git clone <%= @repository.http_clone_url -%></code><br /> - <small>(note that cloning over HTTP is slightly slower, but useful - if you're behind a firewall)</small> + <small>(<%= t("views.repos.help_clone_http") %>)</small> </div> </li> <% if logged_in? && current_user.can_write_to?(@repository) -%> <li> - <strong>Push url:</strong> <code><%=h @repository.push_url -%></code> - <small><%= link_to_function "More info…", "$('detailed_push_info').toggle()" -%></small> + <strong><%= t("views.repos.push_url") %>:</strong> <code><%=h @repository.push_url -%></code> + <small><%= link_to_function t("views.repos.more_info"), "$('detailed_push_info').toggle()" -%></small> <div id="detailed_push_info" class="info_hint" style="display:none"> - You can run "<code>git push <%= @repository.push_url %></code>", or - you can setup a remote by doing the following: + <%= t("views.repos.help_push").call(@repository.push_url) %> <pre> git remote add origin <%= @repository.push_url %> # to push the master branch to the origin remote we added above: diff --git a/app/views/repositories/_repository.html.erb b/app/views/repositories/_repository.html.erb index c1ccae8..4bb0330 100644 --- a/app/views/repositories/_repository.html.erb +++ b/app/views/repositories/_repository.html.erb @@ -18,4 +18,4 @@ %> <%= link_to h(repository.name), project_repository_path(project, repository) -%> -<em><small>(owner: <%= h(repository.user.login) -%>)</small></em>
\ No newline at end of file +<em><small>(<%= t("views.repos.owner") %>: <%= h(repository.user.login) -%>)</small></em>
\ No newline at end of file diff --git a/app/views/repositories/confirm_delete.html.erb b/app/views/repositories/confirm_delete.html.erb index 56ae1aa..9c1bd69 100644 --- a/app/views/repositories/confirm_delete.html.erb +++ b/app/views/repositories/confirm_delete.html.erb @@ -17,18 +17,18 @@ #++ %> -<h1>Please confirm deletion of <%= @repository.name -%> in <%= h(@project.title) -%></h1> +<h1><%= t("views.repos.confirm_delete", :repo => @repository.name, :title => h(@project.title)) %></h1> <p class="important_message"> - Once you press this button the repository will be deleted + <%= t("views.repos.message_delete") %> <% form_for [@project, @repository], :html => {:method => :delete} do |f| -%> - <%= f.submit("YES I am sure I want to delete this repository permanently") -%> + <%= f.submit(t("views.repos.btn_delete")) -%> <% end -%> </p> <% content_for :sidebar do -%> <ul class="links"> - <li><%= link_to "Back to edit screen", edit_project_repository_path(@project, @repository) -%></li> + <li><%= link_to t("views.projects.back"), edit_project_repository_path(@project, @repository) -%></li> </ul> <% end -%>
\ No newline at end of file diff --git a/app/views/repositories/index.html.erb b/app/views/repositories/index.html.erb index c52bf24..52fde77 100644 --- a/app/views/repositories/index.html.erb +++ b/app/views/repositories/index.html.erb @@ -17,29 +17,29 @@ #++ %> -<% @page_title = "Repositories in #{@project.title}" -%> -<h1>Repositories</h1> +<% @page_title = t("views.repos.page_title", :repo => @project.title) -%> +<h1><%= t("views.repos.title") %></h1> <% @repositories.each do |repo| -%> <table class="repository_meta"> <tr class="name"> <td colspan="3" class="<%= repo.mainline? ? "mainline" : "clone" -%>"> <h2><%= link_to h(repo.name), [@project, repo] -%></h2> - <%= link_to "Commits", project_repository_logs_path(@project, repo) -%> | - <%= link_to "Tree", project_repository_trees_path(@project, repo) -%> + <%= link_to t("views.repos.commits"), project_repository_logs_path(@project, repo) -%> | + <%= link_to t("views.repos.tree"), project_repository_trees_path(@project, repo) -%> </td> </tr> <tr class="meta"> <td class="commit_count"> - <span class="bignum"><%= repo.events.count -%></span> activities + <span class="bignum"><%= repo.events.count -%></span> <%= t("views.repos.activities", :count => repo.events.count) %> </td> <td class="branch_count"> - <span class="bignum"><%= repo.ready? ? repo.git.heads.size : 0 -%></span> branches + <% @branch_count = repo.ready? ? repo.git.heads.size : 0 -%> + <span class="bignum"><%= @branch_count -%></span> <%= t("views.repos.branches", :count => @branch_count) %> </td> <td class="author_count"> - <span class="bignum"> - <%= repo.ready? ? repo.commit_graph_data_by_author.keys.size : 0 -%> - </span> authors + <% @author_count = repo.ready? ? repo.commit_graph_data_by_author.keys.size : 0 -%> + <span class="bignum"><%= @author_count -%></span> <%= t("views.repos.authors", :count => @author_count) %> </td> </tr> <tr class="graph"> @@ -51,7 +51,7 @@ <% end -%> <% content_for :sidebar do -%> - <h4>Repositories</h4> + <h4><%= t("views.repos.title") %></h4> <ul class="repository_list"> <% @repositories.each do |repos|-%> <li class="<%= repos.mainline? ? "mainline" : "clone" -%>"> diff --git a/app/views/repositories/new.html.erb b/app/views/repositories/new.html.erb index 9494b66..3b8b192 100644 --- a/app/views/repositories/new.html.erb +++ b/app/views/repositories/new.html.erb @@ -17,28 +17,21 @@ #++ %> -<h1>Create a clone of <%= link_to h(@repository_to_clone.name), - project_repository_path(@project, @repository_to_clone) -%> <small>in - <%= link_to h(@project.title), project_path(@project) -%></small></h1> +<h1><%= t("views.repos.create_title").call(self, @repository_to_clone, @project) %></h1> <%= error_messages_for :repository -%> <% form_for @repository, :repository, :url => create_project_repository_path(@project, @repository_to_clone) do |f| -%> <p> - <%= f.label :name, %Q{Name <small>(eg "#{current_user.login}s-sandbox", "performance-fixes" etc)</small>} -%><br /> + <%= f.label :name, t("views.repos.name", :name => current_user.login) -%><br /> <%= f.text_field :name, :class => "text" -%> </p> - <%= f.submit "Clone repository" -%> + <%= f.submit t("views.repos.btn_clone") -%> <% end -%> -<p> - <em><strong>Note:</strong> Repository clones that haven't had anything pushed - to them within 7 days are automatically removed (so the project don't end up - with lots of empty repositories), so it's a good idea to wait with creating - the clone here until there's something to push.</em> -</p> +<p><%= t("views.repos.clone_note") %></p> <% content_for :submenu do -%> - <li><%= link_to "Back to repository", [@project, @repository_to_clone] -%> + <li><%= link_to t("views.repos.back"), [@project, @repository_to_clone] -%> <% end -%> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index ad374a0..9590882 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -18,10 +18,8 @@ #++ %> -<% @page_title = "#{@repository.name} in #{@project.title}" -%> -<h1> - "<%= h(@repository.name) -%>" repository in <%= h(@repository.project.title) -%> -</h1> +<% @page_title = t("views.repos.show_page_title", :repo => @repository.name, :title => @project.title) -%> +<h1><%= t("views.repos.show_title", :repo => h(@repository.name), :title => h(@repository.project.title)) %></h1> <% render_if_ready(@repository) do -%> @@ -29,7 +27,7 @@ <%#= render_readme(@repository) %> - <h2>Activities <%= feed_icon @atom_auto_discovery_url %></h2> + <h2><%= t("views.repos.activities") %> <%= feed_icon @atom_auto_discovery_url %></h2> <%= render :partial => "events/events", :locals => { :events => @events } -%> <% end -%> @@ -39,48 +37,47 @@ <% content_for :sidebar do -%> <ul> - <li><strong>Project:</strong> <%= link_to h(@repository.project.title), @repository.project -%></li> - <li><strong>Maintainer:</strong> <%= link_to h(@repository.user.login), user_path(@repository.user) -%></li> + <li><strong><%= t("views.logs.project") %>:</strong> <%= link_to h(@repository.project.title), @repository.project -%></li> + <li><strong><%= t("views.logs.maintainer") %>:</strong> <%= link_to h(@repository.user.login), user_path(@repository.user) -%></li> <% if @repository.parent -%> - <li><strong>Clone of:</strong> - <%= link_to h(@repository.parent.gitdir), project_repository_path(@project, @repository.parent) -%> + <li><strong><%= t("views.repos.clone_of") %>:</strong> <%= link_to h(@repository.parent.gitdir), project_repository_path(@project, @repository.parent) -%> <% end -%> - <li><strong>Created:</strong> <%= @repository.created_at.to_s(:short) -%></li> + <li><strong><%= t("views.repos.created") %>:</strong> <%= @repository.created_at.to_s(:short) -%></li> </li> <ul class="links"> <% if @repository.ready? -%> <%# new_project_repository_path(@project, @repository) works in 2.1 and breaks in 2.2.2 %> <%# using explicit routing for the time being %> - <li><%= link_to "Clone repository", :controller => "repositories", :action => "new", :project_id => @project.to_param, :id => @repository.to_param -%></li> + <li><%= link_to t("views.repos.btn_clone"), :controller => "repositories", :action => "new", :project_id => @project.to_param, :id => @repository.to_param -%></li> <% end -%> <% if @repository.committers.include?(current_user) -%> - <li><%= link_to "Request merge", new_project_repository_merge_request_path(@project, @repository) -%></li> + <li><%= link_to t("views.repos.btn_request"), new_project_repository_merge_request_path(@project, @repository) -%></li> <% if @repository.user == current_user -%> - <li><%= link_to "Add committer", + <li><%= link_to t("views.repos.btn_add_committer"), { :controller => "committers", :action => "new", :project_id => @project, :repository_id => @repository } -%></li> <% end -%> <% end -%> <% if @repository.can_be_deleted_by?(current_user) -%> - <li><%= link_to "Delete repository", confirm_delete_project_repository_path(@project, @repository) -%></li> + <li><%= link_to t("views.repos.btn_delete_repo"), confirm_delete_project_repository_path(@project, @repository) -%></li> <% end -%> </ul> - <h4>Committers</h4> + <h4><%= t("views.repos.committers") %></h4> <ul> <% @repository.committers.each do |user| -%> <li> <%= link_to h(user.login), user -%> <% if @repository.user == user -%> - <small>(owner)</small> + <small>(<%= t("views.repos.owner") %>)</small> <% end -%> <% if @repository.user == current_user -%> <small> - <%= link_to "Remove", + <%= link_to t("views.repos.remove"), { :controller => "committers", :action => "destroy", :id => user.id, :project_id => @project, :repository_id => @repository}, # FIXME: meh! - :confirm => "Are you sure?", :method => :delete unless user == current_user -%> + :confirm => t("views.common.confirm"), :method => :delete unless user == current_user -%> </small> <% end -%> </li> @@ -88,7 +85,7 @@ </ul> <% unless @commits.blank? -%> - <h4>Branches:</h4> + <h4><%= t("views.logs.branches") %>:</h4> <ul> <% @repository.git.branches.each do |branch| -%> <% if namespaced_branch?(branch.name) -%> diff --git a/app/views/searches/_search_box.html.erb b/app/views/searches/_search_box.html.erb index b6cf56c..10ac5d2 100644 --- a/app/views/searches/_search_box.html.erb +++ b/app/views/searches/_search_box.html.erb @@ -21,8 +21,8 @@ <% form_for :search, :url => search_path, :html => { :method => "get" } do |f| -%> <p> <%= text_field_tag :q, params[:q], :class => "text search-field" -%> - <input type="submit" value="Search" class="search-submit" /> + <input type="submit" value="<%= t("views.searches.search") %>" class="search-submit" /> </p> -<p class="hint search-hint">eg. 'wrapper', 'category:python' or '"document database"'</p> +<p class="hint"><%= t("views.searches.hint") %></p> <% end -%> </div>
\ No newline at end of file diff --git a/app/views/searches/show.html.erb b/app/views/searches/show.html.erb index 433aabe..1cf3881 100644 --- a/app/views/searches/show.html.erb +++ b/app/views/searches/show.html.erb @@ -17,9 +17,9 @@ #++ %> -<% @page_title = @search.blank? ? "Search" : %Q{Search for "#{h(params[:q])}"} -%> +<% @page_title = @search.blank? ? t("views.searches.search") : t("views.searches.page_title", :term => h(params[:q])) -%> <h1> - <%= @search.blank? ? "Search" : %Q{Search for "#{h(params[:q])}"} -%> + <%= @page_title -%> </h1> <%= render :partial => "search_box" -%> @@ -28,7 +28,7 @@ <% if @search -%> <% if @results.empty? -%> - <p>Sorry, no results for "<%=h params[:q] -%>"</p> + <p><%= t("views.searches.no_results", :term => h(params[:q])) %></p> <% else -%> <% @results.each do |result| -%> <div class="item"> @@ -39,7 +39,7 @@ <% end -%> <p class="hint"> - <small>Found <%= @search.total_entries -%> results in <%= @search.time -%>ms</small> + <small><%= t("views.searches.found", :count => @search.total_entries, :time => @search.time) %></small> </p> <% end -%> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 7e77dff..60ef0ac 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -18,39 +18,39 @@ #++ %> -<h1>Login</h1> +<h1><%= t("views.sessions.login") %></h1> <%= login_method %> <% form_tag sessions_path do -%> <div id="regular_login_fields"> <% # login_method %> <p> - <label for="login">Email or <%= switch_login('switch to OpenID','to_openid')%></label><br/> + <label for="login"><%= t("views.sessions.label").call(self) %></label><br/> <%= text_field_tag 'email', params[:email], :class => "text" %> </p> <p> - <label for="password">Password</label><br/> + <label for="password"><%= t("views.sessions.passwd") %></label><br/> <%= password_field_tag 'password', '', :class => "text" %> </p> </div> <div id="openid_login_fields" style="display:none;"> <p> - <label for="openid">OpenID or <%= switch_login('switch to email login', 'to_email') -%></label><br/> + <label for="openid"><%= t("views.sessions.openid").call(self) %></label><br/> <%= text_field_tag 'openid_url', params[:openid_url], :class => "text" -%> </p> </div> <p> - <label for="remember_me">Remember me:</label> + <label for="remember_me"><%= t("views.sessions.remember") %>:</label> <%= check_box_tag 'remember_me' %> </p> - <p><%= submit_tag 'Log in' %></p> + <p><%= submit_tag t("views.sessions.submit") %></p> <% end -%> <p> <small> - <%= link_to "Register", new_user_path -%> - | <%= link_to "Forgotten your password?", forgot_password_users_path -%> + <%= link_to t("views.sessions.register"), new_user_path -%> + | <%= link_to t("views.sessions.forgot"), forgot_password_users_path -%> </small> </p> diff --git a/app/views/site/dashboard.html.erb b/app/views/site/dashboard.html.erb index 44fcdea..a1b3792 100644 --- a/app/views/site/dashboard.html.erb +++ b/app/views/site/dashboard.html.erb @@ -18,11 +18,11 @@ #++ %> -<% @page_title = "#{current_user.login}'s dashboard" -%> +<% @page_title = t("views.site.dashboard.page_title", :login => current_user.login) -%> <ul class="events"> - <h2>Activities</h2> - <% @events.group_by{|e| e.created_at.strftime("%A %B %d") }.each do |day, events| -%> + <h2><%= t("views.site.dashboard.activities") %></h2> + <% @events.group_by{|e| e.created_at.to_s(:human) }.each do |day, events| -%> <li> <p class="date"><%= day -%></p> <ul class="event_instances"> @@ -35,14 +35,14 @@ <%= will_paginate @events -%> <% content_for :sidebar do -%> - <h4>Your projects:</h4> + <h4><%= t("views.site.dashboard.your_projects") %></h4> <ul> <% @projects.each do |project| -%> <li><%= link_to h(project.slug), project -%></li> <% end -%> </ul> - <h4>Your repository clones</h4> + <h4><%= t("views.site.dashboard.your_clones") %></h4> <ul> <% @repositories.each do |repo| -%> <li><%= link_to h(repo.name), [repo.project, repo] -%></li> @@ -51,6 +51,6 @@ <% end -%> <% content_for :submenu do -%> - <li><%= link_to "Your Account", account_path -%></li> - <li><%= link_to "Your Profile", user_path(current_user) -%></li> + <li><%= link_to t("views.site.dashboard.your_account"), account_path -%></li> + <li><%= link_to t("views.site.dashboard.your_profile"), user_path(current_user) -%></li> <% end -%>
\ No newline at end of file diff --git a/app/views/site/faq.html.erb b/app/views/site/faq.html.erb index 27ce4f3..12ad527 100644 --- a/app/views/site/faq.html.erb +++ b/app/views/site/faq.html.erb @@ -76,6 +76,19 @@ When you push to a Git repository, your public key is how we authenticate you and check if have the permissions required to do a commit to a given repository </p> +<hr /> + +<h3>I have Windows. How do I generate the required SSH key?</h3> +<p> + The recommended way to use Git on Windows is the + <%= link_to "msysGit", "http://code.google.com/p/msysgit/" -%> version. It comes bundled + with minimal Cygwin support. When you finish installing it, you will have a "Git Bash" + icon in your desktop. Double click to open it and now you can use known Linux-like + commands, such as <code>"ssh-keygen -t rsa"</code>. Just press 'Return' in every question + it asks and you will finally have your pair of keys under ".ssh". For example, type + <code>"cat ~/.ssh/id_rsa.pub"</code>. Thats's the public key that you are required to + copy and paste into your account on Gitorious. +</p> <hr /> diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index 12e668a..49ea4a6 100644 --- a/app/views/site/index.html.erb +++ b/app/views/site/index.html.erb @@ -18,23 +18,19 @@ #++ %> -<% @page_title = "Free open source project hosting" -%> +<% @page_title = t("views.site.page_title") -%> <div id="site_intro"> <p> - <strong>Gitorious</strong> aims to provide a great - way of doing distributed opensource code collaboration + <%= t("views.site.description") %> </p> -<% if GitoriousConfig['public_mode'] || logged_in? -%> - <%= render :partial => "searches/search_box" -%> -<% end -%> </div> <div id="site_overview"> <% unless logged_in? -%> <table> <tr> - <th class="left"><h2>For Projects</h2></th> - <th class="right"><h2>For Contributors</h2></th> + <th class="left"><h2><%= t("views.site.for_projects") %></h2></th> + <th class="right"><h2><%= t("views.site.for_contributors") %></h2></th> </tr> <tr> <td class="left"><%= image_tag("overview_projects.png") -%></td> @@ -44,8 +40,8 @@ <% if GitoriousConfig['public_mode'] || logged_in? -%> <p class="hint create_account_hint"> - <%= link_to "Creating a user account", new_user_path -%> allows you to create - your own project or participate in the development of any project. + <%= link_to t("views.site.creating_account_1"), new_user_path -%> + <%= t("views.site.creating_account_2") -%> </p> <% end -%> <% end -%> @@ -53,7 +49,7 @@ <% if GitoriousConfig['public_mode'] || logged_in? -%> <div id="newest_projects"> - <h2>Newest projects</h2> + <h2><%= t("views.site.newest_projects") %></h2> <ul> <% @projects.each do |project| -%> <li> @@ -62,6 +58,6 @@ </li> <% end -%> </ul> - <p><%= link_to "View more »", projects_path -%></p> + <p><%= link_to t("views.site.view_more"), projects_path -%></p> </div> <% end -%> diff --git a/app/views/trees/show.html.erb b/app/views/trees/show.html.erb index 4115813..e027067 100644 --- a/app/views/trees/show.html.erb +++ b/app/views/trees/show.html.erb @@ -18,9 +18,9 @@ #++ %> -<% @page_title = "Tree for #{@repository.name} in #{@project.title}" -%> +<% @page_title = t("views.trees.page_title", :repo => @repository.name, :title => @project.title) -%> <h1> - Tree of <%= h(@repository.name) -%> repository in <%= h(@project.title) -%> + <%= t("views.trees.title", :repo => h(@repository.name), :title => h(@project.title)) %> </h1> <% content_for :submenu do -%> @@ -53,12 +53,12 @@ <% end -%> <% if logged_in? -%> <p> - <small><%= link_to "Download as gzipped tarball", archive_tree_path(@commit.id) -%></small> + <small><%= link_to t("views.trees.download"), archive_tree_path(@commit.id) -%></small> </p> <% end -%> <% content_for :sidebar do -%> - <h5>Branches:</h5> + <h5><%= t("views.logs.branches") %>:</h5> <ul class="links"> <% @git.branches.sort{|a, b| a.name <=> b.name }.each do |branch| -%> <% if namespaced_branch?(branch.name) -%> @@ -69,7 +69,7 @@ <% end -%> </ul> - <h5>Tags:</h5> + <h5><%= t("views.logs.tags") %>:</h5> <ul class="links"> <% @git.tags.sort{|a, b| a.name <=> b.name }.each do |tag| -%> <li><%= link_to h(tag.name), commit_path(tag.commit.id) -%></li> diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index b795948..7473864 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -1,19 +1,19 @@ <p> - <%= f.label :login -%><br/> + <%= f.label :login, t(:login, :scope => "activerecord.attributes.user") -%><br/> <%= f.text_field :login, :class => "text" -%> </p> <p> - <%= f.label :email -%><br/> + <%= f.label :email, t(:email, :scope => "activerecord.attributes.user") -%><br/> <%= f.text_field :email, :class => "text" -%> </p> <p> - <%= f.label :password -%><br/> + <%= f.label :password, t(:password, :scope => "activerecord.attributes.user") -%><br/> <%= f.password_field :password, :class => "text" -%> </p> <p> - <%= f.label :password_confirmation -%><br/> + <%= f.label :password_confirmation, t(:password_confirmation, :scope => "activerecord.attributes.user") -%><br/> <%= f.password_field :password_confirmation, :class => "text" %> </p>
\ No newline at end of file diff --git a/app/views/users/forgot_password.html.erb b/app/views/users/forgot_password.html.erb index a7d757f..219a65a 100644 --- a/app/views/users/forgot_password.html.erb +++ b/app/views/users/forgot_password.html.erb @@ -17,14 +17,14 @@ #++ %> -<h1>Forgot your password?</h1> +<h1><%= t("views.users.forgot_title") %></h1> <% form_for :user, :url => reset_password_users_path do |f| -%> <p> - <%= f.label :email -%><br/> + <%= f.label :email, t(:email, :scope => "activerecord.attributes.user") -%><br/> <%= f.text_field :email, :class => "text" -%> </p> - <p><%= f.submit 'Send me a new password' %></p> + <p><%= f.submit t("views.users.send_new_passwd") %></p> <% end -%> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index bd13662..b4c2473 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -18,15 +18,11 @@ #++ %> -<h1>Create new user or <%= link_to "login directly with your OpenID", login_path(:method=>'openid') -%></h1> - -<p> - Creating a user account allows you to create your own project or participate - in the development of any project. -</p> +<h1><%= t("views.users.create_title_1") %> <%= link_to t("views.users.create_title_2"), login_path(:method=>'openid') -%></h1> +<p><%= t("views.users.create_description") %></p> <%= error_messages_for :user %> <% form_for :user, :url => users_path do |f| -%> <%= render :partial => 'form', :locals => { :f => f } %> - <p><%= f.submit 'Sign up' %></p> + <p><%= f.submit t("views.common.signup") %></p> <% end -%> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 61cfa87..5e54c68 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -23,7 +23,7 @@ <% @page_title = h(@user.login) -%> <% unless @events.empty? -%> - <h2>Activities<%= feed_icon @atom_auto_discovery_url %></h2> + <h2><%= t("views.site.dashboard.activities") %> <%= feed_icon @atom_auto_discovery_url %></h2> <%= render :partial => "events/events", :locals => { :events => @events } -%> <% end -%> @@ -39,13 +39,13 @@ <% if @user.url %> <li><strong>Url:</strong> <a rel="me" href="<%=h @user.url -%>"><%=h @user.url -%></a></li> <% end -%> - <li><strong>Member for</strong> about <%= time_ago_in_words(@user.created_at) -%></li> - <li><strong><%= @commits_last_week -%></strong> commits so far this week.</li> + <li><strong><%= t("views.users.member_for") %></strong> <%= t("views.users.about", :about => time_ago_in_words(@user.created_at)) %></li> + <li><strong><%= @commits_last_week -%></strong> <%= t("views.users.this_week", :count => @commits_last_week) %>.</li> </ul> <% unless @projects.blank? -%> - <h4>Projects:</h4> + <h4><%= t("views.site.dashboard.projects") %>:</h4> <ul> <% @projects.each do |project| -%> <li><%= link_to h(project.slug), project -%></li> @@ -54,7 +54,7 @@ <% end -%> <% unless @repositories.blank? -%> - <h4>Repository clones</h4> + <h4><%= t("views.site.dashboard.clones") %></h4> <ul> <% @repositories.each do |repo| -%> <li><%= link_to h("#{repo.project.slug}/#{repo.name}"), [repo.project, repo] -%></li> @@ -65,6 +65,6 @@ <% if current_user && (current_user == @user) -%> <% content_for :submenu do -%> - <li><%= link_to "Edit your account", edit_account_url -%> + <li><%= link_to t("views.account.edit_title"), edit_account_url -%> <% end -%> <% end -%> diff --git a/config/gitorious.sample.yml b/config/gitorious.sample.yml index 8a7d3b8..9ef5a46 100644 --- a/config/gitorious.sample.yml +++ b/config/gitorious.sample.yml @@ -30,4 +30,7 @@ exception_notification_emails: mangle_email_addresses: true # Enable or Disable Public Mode (true) or Private Mode (false) -public_mode: true
\ No newline at end of file +public_mode: true + +# Define your locale +locale: en
\ No newline at end of file diff --git a/config/locales/en.rb b/config/locales/en.rb new file mode 100644 index 0000000..c0e3cd8 --- /dev/null +++ b/config/locales/en.rb @@ -0,0 +1,428 @@ +{ + :'en' => { + :application => { + :require_ssh_keys_error => "You need to upload your public key first", + :no_commits_notice => "The repository doesn't have any commits yet", + }, + :admin => { + :users_controller => { + :create_notice => 'User was successfully created.', + :suspend_notice => "User {{user_name}} was successfully suspended.", + :suspend_error => "Unable to suspend user {{user_name}}.", + :unsuspend_notice => "User {{user_name}} was successfully unsuspended.", + :unsuspend_error => "Unable to unsuspend user {{user_name}}.", + :check_admin => "For Administrators Only", + }, + }, + :mailer => { + :repository_clone => "{{login}} has cloned {{slug}}/{{parent}}", + :request_notification => "{{login}} has requested a merge in {{title}}", + :new_password => "Your new password", + :subject => 'Please activate your new account', + :activated => 'Your account has been activated!', + }, + :blobs_controller => { + :raw_error => "Blob is too big. Clone the repository locally to see it", + }, + :comments_controller => { + :create_success => "Your comment was added", + }, + :committers_controller => { + :create_error_not_found => "Could not find user by that name", + :create_error_already_commiter => "Could not add user or user is already a committer", + :destroy_success => "User removed from repository", + :destroy_error => "Could not remove user from repository", + :find_repository_error => "You're not the owner of this repository", + }, + :keys_controller => { + :create_notice => "Key added", + :destroy_notice => "Key removed", + }, + :merge_requests_controller => { + :create_success => "You sent a merge request to \"{{name}}\"", + :resolve_notice => "The merge request was marked as {{status}}", + :update_success => "Merge request was updated", + :destroy_success => "Merge request was retracted", + :assert_resolvable_error => "You're not permitted to resolve this merge request", + :assert_ownership_error => "You're not the owner of this merge request" + }, + :projects_controller => { + :update_error => "You're not the owner of this project", + :destroy_error => "You're not the owner of this project, or the project has clones", + }, + :repositories_controller => { + :new_error => "Sorry, can't clone an empty repository", + :create_error => "Sorry, can't clone an empty repository", + :destroy_notice => "The repository was deleted", + :destroy_error => "You're not the owner of this repository", + :adminship_error => "Sorry, only project admins are allowed to do that", + }, + :trees_controller => { + :archive_error => "The given repository or sha is invalid" + }, + :users_controller => { + :create_notice => "Thanks for signing up! You will receive an account activation email soon", + :activate_notice => "Your account has been activated, welcome!", + :activate_error => "Invalid activation code", + :reset_password_notice => "A new password has been sent to your email", + :reset_password_error => "Invalid email", + }, + :application_helper => { + :notice_for_2 => "it will be ready pretty soon…", + :notice_for_1 => "This {{class_name}} is being created,", + :event_status_created => "created project", + :event_status_deleted => "deleted project", + :event_status_updated => "updated project", + :event_status_cloned => "cloned", + :event_status_deleted => "deleted", + :event_status_committed => "committed", + :event_status_started => "started development", + :event_branch_created => "created branch", + :event_branch_deleted => "deleted branch", + :event_tagged => "tagged", + :event_tag_deleted => "deleted tag", + :event_committer_added => "added committer", + :event_committer_removed => "removed committer", + :event_commented => "commented", + :event_requested_merge_of => "requested merge of", + :event_resolved_merge_request => "resolved merge request", + :event_updated_merge_request => "updated merge request", + :event_deleted_merge_request => "deleted merge request", + }, + :project => { + :format_slug_validation => "must match something in the range of [a-z0-9_\-]+", + :ssl_required => "Must begin with http(s)", + }, + :user => { + :invalid_url => "Invalid url", + }, + :views => { + :layout => { + :system_notice => "System notice", + :home => "Home", + :dashboard => "Dashboard", + :admin => "Administration", + :projects => "Projects", + :search => "Search", + :faq => "FAQ", + :about => "About", + :my_account => "My account", + :logout => "Logout", + :project_overview => "Project Overview", + :repositories => "Repositories", + :user_mgt => "User Management", + :discussion => "Discussion group", + }, + :site => { + :page_title => "Free open source project hosting", + :description => "<strong>Gitorious</strong> aims to provide a great\nway of doing distributed opensource code collaboration", + :for_projects => "For Projects", + :for_contributors => "For Contributors", + :creating_account_1 => "Creating a user account", + :creating_account_2 => "allows you to create your own project or participate in the development of any project.", + :newest_projects => "Newest projects", + :view_more => "View more »", + :dashboard => { + :page_title => "{{login}}'s dashboard", + :activities => "Activities", + :your_projects => "Your projects:", + :your_clones => "Your repository clones", + :your_account => "Your Account", + :your_profile => "Your Profile", + :projects => "Projects", + :clones => "Repository clones", + }, + }, + :events => { + :page_title => "Events", + :activities => "Gitorious activities", + :system_activities => "System Activities", + }, + :account => { + :edit_title => "Edit your account", + :realname => "Realname", + :url => "url <small>blog etc</small>", + :openid => "OpenID", + :my_account => "My account", + :chg_passwd => "Change password", + :new_passwd => "New password", + :new_passwd_conf => "New password confirmation", + :edit_details => "Edit details", + :show_title => "Account", + :details_title => "Account details", + :edit_link => "edit", + :username => "Username", + :create => "create an account", + }, + :keys => { + :edit_title => "Edit a SSH key", + :ssh_keys => "Your SSH Keys", + :add_ssh_key => "Add SSH key", + :add_title => "Add a new public SSH key", + :your_public_key => "Your public key", + :hint => "It's generally located in ~/.ssh/id_rsa.pub or ~/.ssh/id_dsa.pub.<br />If you want to use multiple keys you'll have to add each of them seperately", + }, + :users => { + :activated => "Activated?", + :suspended => "Suspended?", + :admin => "Admin?", + :suspend => "Suspend", + :unsuspend => "Unsuspend", + :create_btn => "Create New User", + :is_admin => "Is Administrator?", + :forgot_title => "Forgot your password?", + :send_new_passwd => 'Send me a new password', + :create_title_1 => "Create new user or", + :create_title_2 => "login directly with your OpenID", + :create_description => "Creating a user account allows you to create your own project or participate in the development of any project.", + :member_for => "Member for", + :this_week => { + :one => "commit so far this week", + :other => "commits so far this week", + }, + :about => "about {{about}}", + }, + :logs => { + :page_title => "Commits in {{repo}} in {{title}}", + :commitlog => "Commitlog for {{repo}}:{{param}} in {{title}}", + :project => "Project", + :maintainer => "Maintainer", + :head_tree => "HEAD tree", + :branches => "Branches", + :tags => "Tags", + }, + :blobs => { + :page_title => "{{path}} - {{repo}} in {{title}}", + :wrap => "Softwrap mode", + :title => "Blob of <code>{{path}}</code>", + :raw => "raw blob data", + :too_big_1 => "This file is too big to be rendered within reasonable time,", + :too_big_2 => "try viewing the raw data", + :message_1 => "Not sure we can display this blob nicely (it's a \"{{mime}}\" mimetype),", + :message_2 => "and see if your browser figures it out.", + }, + :comments => { + :commit => "on commit {{sha1}}", + :permalink => '<abbr title="permalink for this comment">#</abbr>', + :add_title => "Add a new comment", + :body => "Comment", + :add => "Add Comment", + :page_title => "Comments in {{repo}}", + :diff => "Commit diff", + :total => "Comments ({{total}})", + :page_title_2 => "Comments on {{title}}", + :page_title_3 => "Comments for "{{repo}}" repository in {{title}}", + }, + :commits => { + :date => "Date", + :committer => "Committer", + :author => "Author", + :sha1 => "Commit SHA1", + :tree_sha1 => "Tree SHA1", + :page_title => "Commit in {{repo}} in {{title}}", + :title => "Commit {{commit}}", + :message_1 => "This is the initial commit in this repository, ", + :message_2 => "browse the initial tree state", + }, + :sessions => { + :login => "Login", + :label => lambda { |this| "Email or #{this.switch_login('switch to OpenID','to_openid')}" }, + :passwd => "Password", + :openid => lambda { |this| "OpenID or #{this.switch_login('switch to email login', 'to_email')}"}, + :remember => "Remember me", + :submit => 'Log in', + :register => "Register", + :forgot => "Forgotten your password?", + }, + :searches => { + :search => "Search", + :hint => %Q{eg. 'wrapper', 'category:python' or '"document database"'}, + :page_title => %Q{Search for "{{term}}"}, + :no_results => "Sorry, no results for {{term}}", + :found => { + :one => "Found {{count}} result in {{time}}ms", + :other => "Found {{count}} results in {{time}}ms", + }, + }, + :trees => { + :page_title => "Tree for {{repo}} in {{title}}", + :title => "Tree of {{repo}} repository in {{title}}", + :download => "Download as gzipped tarball", + }, + :repos => { + :overview => "Overview", + :commits => "Commits", + :tree => "Source Tree", + :comments => "Comments ({{count}})", + :requests => "Merge requests ({{count}})", + :public_url => "Public clone url", + :more_info => "More info…", + :help_clone => "You can clone this repository with the following command", + :help_clone_http => "note that cloning over HTTP is slightly slower, but useful if you're behind a firewall", + :http_url => "HTTP clone url", + :push_url => "Push url", + :help_push => lambda { |repo| "You can run \"<code>git push #{repo}</code>\", or you can setup a remote by doing the following:" }, + :owner => "owner", + :confirm_delete => "Please confirm deletion of {{repo}} in {{title}}", + :message_delete => "Once you press this button the repository will be deleted", + :btn_delete => "YES I am sure I want to delete this repository permanently", + :page_title => "Repositories in {{repo}}", + :title => "Repositories", + :commits => "Commits", + :tree => "Tree", + :activities => { :one => "activity", :other => "activities" }, + :branches => { :one => "branch", :other => "branches" }, + :authors => { :one => "author", :other => "authors" }, + :name => %Q{Name <small>(eg "{{name}}-sandbox", "performance-fixes" etc)</small>}, + :btn_clone => "Clone repository", + :back => "Back to repository", + :show_page_title => "{{repo}} in {{title}}", + :show_title => ""{{repo}}" repository in {{title}}", + :activities => "Activities", + :clone_of => "Clone of", + :created => "Created", + :btn_request => "Request merge", + :btn_add_committer => "Add committer", + :btn_delete_repo => "Delete repository", + :committers => "Committers", + :remove => "Remove", + :create_title => lambda { |this, clone, project| + "Create a clone of #{this.link_to( h(clone.name), this.send(:project_repository_path, project, clone) )} <small>in #{this.link_to h(project.title), this.send(:project_path, project)}</small>" + }, + :clone_note => %Q{ + <em><strong>Note:</strong> Repository clones that haven't had anything pushed + to them within 7 days are automatically removed (so the project don't end up + with lots of empty repositories), so it's a good idea to wait with creating + the clone here until there's something to push.</em> + }, + }, + :projects => { + :title => "Projects", + :back => "Back to edit screen", + :hint => %Q{<a href="http://daringfireball.net/projects/markdown/">Markdown</a> and basic html is allowed}, + :categories => "Categories", + :delete => "Delete project", + :delete_title => "Please confirm deletion of {{title}}", + :delete_message => "Once you press this button the project will be deleted", + :delete_btn => "YES I am sure I want to delete this project permanently", + :edit => "Edit project", + :update_title => "Update {{link}}", + :new => "New project", + :popular => "Popular Categories", + :new_title => "Create a new project", + :new_hint => %Q(A default "mainline" repository will be created along with the project, allowing you to start committing right away.), + :create => "Create project", + :settings => "Project Settings", + :labels => "Labels", + :license => "License", + :owner => "Owner", + :created => "Created", + :website => "Website at ", + :mailing => "Mailinglist at ", + :bugtracker => "Bugtracker at ", + :repos => "Repositories", + }, + :merges => { + :info => { + :target_repos => "The one you wish this repository should be merged with", + :target_branch => "The target branch you wish your changes to be merged into", + :source_branch => "The source branch you wish the target repository should merge from", + :proposal => "A short summary of your changes", + }, + :summary_tile => "{{source}} has requested a merge with {{target}}", + :review => "Review merge request →", + :page_title => "Merge requests in {{repo}}", + :hint => %Q{A "merge request" is a notification from one repository to another that would like their changes to be merged upstream.}, + :no_merge => "No merge requests yet", + :create_title => "Create a merge request", + :create_btn => "Create merge request", + :show_title => "Reviewing merge request {{source}} → \"{{target}}\"", + :update_btn => "Update merge request", + :help => "The recommended way to merge in these changes is to pull them into a local branch for review and them merge to back to master:", + :commits => "Commits that would be merged", + }, + :committers => { + :title => "Give a user commit rights to {{repo}}", + :login => "Existing username <small>(search-as-you-type)</small>", + :add => "Add as committer", + }, + :common => { + :confirm => "Are you sure?", + :create => "Create", + :save => "Save", + :delete => "delete", + :add => "Add", + :yes => "Yes", + :no => "No", + :back => "Back", + :signup => 'Sign up', + :toggle => "Toggle", + :none => "none", + :update => "Update", + :cancel => "cancel", + :or => "or", + }, + }, + :date => { + :formats => { + :long_ordinal => lambda { |date| "%B #{date.day.ordinalize}, %Y" } + } + }, + :time => { + :formats => { + :long_ordinal => lambda { |time| "%B #{time.day.ordinalize}, %Y %H:%M" }, + :human => "%A %B %d", + :short_time => "%H:%M", + }, + :time_with_zone => { + :formats => { + :default => lambda { |time| "%Y-%m-%d %H:%M:%S #{time.formatted_offset(false, 'UTC')}" } + } + } + }, + :activerecord => { + :attributes => { + :user => { + :login => "Login", + :email => "Email", + :current_password => "Current Password", + :password => "Password", + :password_confirmation => "Password Confirmation", + :created_at => "Created At", + :updated_at => "Updated At", + :activation_code => "Activation Code", + :activated_at => "Activated At", + :fullname => "Full name", + :url => "Url", + }, + :merge_request => { + :target_repository_id => "Target Repository", + :proposal => "Proposal", + :source_branch => "Source Branch", + :target_branch => "Target Branch", + }, + :project => { + :title => "Title", + :description => "Description (obligatory)", + :slug => "Slug (for urls etc)", + :license => "License", + :home_url => "Home URL (eg Rubyforge etc)", + :mailinglist_url => "Mailinglist URL (if any)", + :bugtracker_url => "Bugtracker URL (if any)", + :tag_list => "Categories (space seperated)", + }, + :comment => { + :body => "Body", + }, + :repository => { + :name => "Name", + :ready => "Ready", + }, + :keys => { + :key => "Key", + :ready => "Ready", + }, + }, + } + } +}
\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..4bb407e --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,28 @@ +en: + date: + formats: + default: "%Y-%m-%d" + short: "%e %b" + long: "%B %e, %Y" + only_day: "%e" + + day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] + abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] + month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] + abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] + order: [ :year, :month, :day ] + + time: + formats: + default: "%a %b %d %H:%M:%S %Z %Y" + time: "%H:%M" + short: "%d %b %H:%M" + long: "%B %d, %Y %H:%M" + only_second: "%S" + + datetime: + formats: + default: "%Y-%m-%dT%H:%M:%S%Z" + + am: 'am' + pm: 'pm'
\ No newline at end of file diff --git a/config/locales/pt-BR.rb b/config/locales/pt-BR.rb new file mode 100644 index 0000000..f32be46 --- /dev/null +++ b/config/locales/pt-BR.rb @@ -0,0 +1,565 @@ +{ + :'pt-BR' => { + :application => { + :require_ssh_keys_error => "Você precisa fazer upload da sua chave pública primeiro", + :no_commits_notice => "O repositório não tem nenhum commit ainda", + }, + :admin => { + :users_controller => { + :create_notice => 'O usuário foi criado com sucesso.', + :suspend_notice => "O usuário {{user_name}} foi suspenso com sucesso.", + :suspend_error => "Não consguiu suspender usuário {{user_name}}.", + :unsuspend_notice => "O usuário {{user_name}} foi suspenso com sucesso.", + :unsuspend_error => "Não conseguiu reativar usuário {{user_name}}.", + :check_admin => "Apenas Para Administradores", + }, + }, + :mailer => { + :repository_clone => "{{login}} clonou {{slug}}/{{parent}}", + :request_notification => "{{login}} requisitou um merge em {{title}}", + :new_password => "Sua nova senha", + :subject => 'Por favor ative sua nova conta', + :activated => 'Sua conta foi ativada!', + }, + :blobs_controller => { + :raw_error => "Blob é muito grande. Clone o repositório localmente para visualizá-lo", + }, + :comments_controller => { + :create_success => "Seu comentário foi adicionado", + }, + :committers_controller => { + :create_error_not_found => "Não foi possível encontrar usuário com esse nome", + :create_error_already_commiter => "Não foi possível adicionar usuário ou usuário já é um committer", + :destroy_success => "Usuário removido do repositório", + :destroy_error => "Não foi possível remover usuário do repositório", + :find_repository_error => "Você não é o criador deste repositório", + }, + :keys_controller => { + :create_notice => "Chave adicionada", + :destroy_notice => "Chave removida" + }, + :merge_requests_controller => { + :create_success => "Você enviou uma requisição de merge para \"{{name}}\"", + :resolve_notice => "A requisição de merge foi marcada como {{status}}", + :update_success => "A Requisição de Merge foi atualizada", + :destroy_success => "A Requisição de Merge foi retratada", + :assert_resolvable_error => "Você não tem permissão para resolver esta Requisição de Merge", + :assert_ownership_error => "Você não é o criador desta Requisição de Merge" + }, + :projects_controller => { + :update_error => "Você não é o criador deste projeto", + :destroy_error => "Você não é o criador deste projeto, ou o projeto tem clones", + }, + :repositories_controller => { + :new_error => "Desculpe, não se pode clonar um repositório vazio", + :create_error => "Desculpe, não se pode clonar um repositório vazio", + :destroy_notice => "O repositório foi apagado", + :destroy_error => "Você não é o criador deste repositório", + :adminship_error => "Desculpe, somente administradores do projeto têm permissão para fazer isso", + }, + :trees_controller => { + :archive_error => "O repositório fornecido ou o SHA é inválido" + }, + :users_controller => { + :create_notice => "Obrigado por se registrar! Você receberá um e-mail para ativação em breve", + :activate_notice => "Sua conta foi ativada, bem vindo!", + :activate_error => "Código de Ativação inválida", + :reset_password_notice => "Uma nova senha foi enviada para seu e-mail", + :reset_password_error => "E-mail inválido", + }, + :application_helper => { + :notice_for_2 => "ficará claro muito em breve…", + :notice_for_1 => "Este(a) {{class_name}} está sendo criado(a),", + :event_status_created => "projeto criado", + :event_status_deleted => "projeto apagado", + :event_status_updated => "projeto atualizado", + :event_status_cloned => "clonado", + :event_status_deleted => "apagado", + :event_status_committed => "comitado", + :event_status_started => "desenvolvimento iniciado", + :event_branch_created => "branch criado", + :event_branch_deleted => "branch apagado", + :event_tagged => "tagueado", + :event_tag_deleted => "tag apagado", + :event_committer_added => "committer adicionado", + :event_committer_removed => "committer removido", + :event_commented => "comentado", + :event_requested_merge_of => "requisitado merge de", + :event_resolved_merge_request => "requisição de merge resolvido", + :event_updated_merge_request => "requisição de merge atualizado", + :event_deleted_merge_request => "requisição de merge apagado", + }, + :project => { + :format_slug_validation => "deve bater com alguma coisa no intervalo de [a-z0-9_\-]+", + :ssl_required => "Deve iniciar com http(s)", + }, + :user => { + :invalid_url => "URL inválida", + }, + :views => { + :layout => { + :system_notice => "Notificação de Sistema", + :home => "Início", + :dashboard => "Dashboard", + :admin => "Administração", + :projects => "Projetos", + :search => "Pesquisa", + :faq => "Q&A", + :about => "Sobre", + :my_account => "Minha conta", + :logout => "Sair", + :project_overview => "Resumo do Projeto", + :repositories => "Repositórios", + :user_mgt => "Gerenciamento de Usuários", + :discussion => "Grupo de Discussão", + }, + :site => { + :page_title => "Hospedagem Gratuita de Projetos Open Source", + :description => "<strong>Gitorious</strong> quer fornecer uma grande\nmaneira de colaborar com código opensource de forma distribuída", + :for_projects => "Para Projetos", + :for_contributors => "Para Colaboradores", + :creating_account_1 => "Criar uma conta de usuário", + :creating_account_2 => "lhe permite criar seus próprios projetos ou participar do desenvolvimento de qualquer outro.", + :newest_projects => "Projetos mais Recentes", + :view_more => "Ver mais »", + :dashboard => { + :page_title => "Dashboard do {{login}}", + :activities => "Atividades", + :your_projects => "Seus projetos:", + :your_clones => "Seus clones de repositórios", + :your_account => "Sua Conta", + :your_profile => "Seu Perfil", + :projects => "Projetos", + :clones => "Clones de repositórios", + }, + }, + :events => { + :page_title => "Eventos", + :activities => "Atividades no Gitorious", + :system_activities => "Atividades de Sistema", + }, + :account => { + :edit_title => "Edite sua conta", + :realname => "Nome Real", + :url => "url de <small>blog etc</small>", + :openid => "OpenID", + :my_account => "Minha conta", + :chg_passwd => "Mudar senha", + :new_passwd => "Nova senha", + :new_passwd_conf => "Confirmação da nova senha", + :edit_details => "Editar detalhes", + :show_title => "Conta", + :details_title => "Detalhes da Conta", + :edit_link => "editar", + :username => "Usuário", + }, + :keys => { + :edit_title => "Editar uma chave SSH", + :ssh_keys => "Suas Chaves de SSH", + :add_ssh_key => "Adicionar Chave de SSH", + :add_title => "Adicionar uma nova chave pública SSH", + :your_public_key => "Sua chave pública", + :hint => "Está normalmente localizada em ~/.ssh/id_rsa.pub ou ~/.ssh/id_dsa.pub.<br />Se quiser usar múltiplas chaves, terá que adicionar cada uma separadamente", + }, + :users => { + :activated => "Ativado?", + :suspended => "Suspenso?", + :admin => "Admin?", + :suspend => "Suspender", + :unsuspend => "Dessuspender", + :create_btn => "Criar Novo Usuário", + :is_admin => "É Administrador?", + :forgot_title => "Esqueceu sua senha?", + :send_new_passwd => 'Me envie uma nova senha', + :create_title_1 => "Crie um novo usuário ou", + :create_title_2 => "faça login diretamente com seu OpenID", + :create_description => "Criar uma nova conta de usuário lhe permite criar seus próprios projetos ou participar no desenvolvimento de qualquer um.", + :member_for => "Membro por", + :this_week => { + :one => "commit até agora esta semana", + :other => "commits até agora esta semana", + }, + :about => "cerca de {{about}}", + }, + :logs => { + :page_title => "Commits em {{repo}} em {{title}}", + :commitlog => "Log de Commit para {{repo}}:{{param}} em {{title}}", + :project => "Projeto", + :maintainer => "Mantenedor", + :head_tree => "árvore HEAD", + :branches => "Branches", + :tags => "Tags", + }, + :blobs => { + :page_title => "{{path}} - {{repo}} em {{title}}", + :wrap => "Modo Softwrap", + :title => "Blob de <code>{{path}}</code>", + :raw => "dado blob puro", + :too_big_1 => "Este arquivo é muito grande para ser renderizado num tempo razoável,", + :too_big_2 => "tente ver os dados puros", + :message_1 => "Não há certeza que esse blob pode ser mostrado corretamente (é um mimetype \"{{mime}}\"),", + :message_2 => "e veja se se browser consegue carregar isso." + }, + :comments => { + :commit => "no commit {{sha1}}", + :permalink => '<abbr title="permalink para este comentário">#</abbr>', + :add_title => "Adicionar um novo comentário", + :body => "Comentário", + :add => "Adicionar Comentário", + :page_title => "Comentários em {{repo}}", + :diff => "Diferença de Commits", + :total => "Comentários ({{total}})", + :page_title_2 => "Comentários no {{title}}", + :page_title_3 => "Comentários para repositório "{{repo}}" em {{title}}", + }, + :commits => { + :date => "Data", + :committer => "Committer", + :author => "Autor", + :sha1 => "SHA1 do Commit", + :tree_sha1 => "SHA1 da Árvore", + :page_title => "Commit em {{repo}} no {{title}}", + :title => "Commit {{commit}}", + :message_1 => "Este é o commit inicial deste repositório, ", + :message_2 => "navege pelo estado inicial da árvore", + }, + :sessions => { + :login => "Login", + :label => lambda { |this| "E-mail ou #{this.switch_login('alterne para OpenID','to_openid')}" }, + :passwd => "Senha", + :openid => lambda { |this| "OpenID ou #{this.switch_login('alterne para login por e-mail', 'to_email')}"}, + :remember => "Lembre-se de mim", + :submit => 'Entrar', + :register => "Registrar", + :forgot => "Esqueceu sua senha?", + }, + :searches => { + :search => "Pesquisa", + :hint => %Q{ex. 'wrapper', 'category:python' ou '"document database"'}, + :page_title => %Q{Pesquisa por "{{term}}"}, + :no_results => "Desculpe, nada encontrado para {{term}}", + :found => { + :one => "Encontrado {{count}} resultado em {{time}}ms", + :other => "Encontrado {{count}} resultados em {{time}}ms", + }, + }, + :trees => { + :page_title => "Árvore para {{repo}} em {{title}}", + :title => "Árvore do repositório {{repo}} em {{title}}", + :download => "Faça download como um arquivo compactado (tar.gz)", + }, + :repos => { + :overview => "Resumo", + :commits => "Commits", + :tree => "Árvore de Código", + :comments => "Comentários ({{count}})", + :requests => "Requisições de Merge ({{count}})", + :public_url => "URL Pública de clone", + :more_info => "Mais informações…", + :help_clone => "Você pode clonar este repositório com o seguinte comando", + :help_clone_http => "note que clonar sobre HTTP é mais lento, mas útil se estiver atrás de um firewall", + :http_url => "URL para clone via HTTP", + :push_url => "URL Privada de Push", + :help_push => lambda { |repo| "Você pode executar \"<code>git push #{repo}</code>\", ou também pode configurar um repositório remoto da seguinte maneira:" }, + :owner => "criador", + :confirm_delete => "Por favor, confirme apagar o {{repo}} em {{title}}", + :message_delete => "Quando o botão for apertado, o repositório será apagado", + :btn_delete => "SIM, tenho certeza que quero apagar este repositório permanentemente", + :page_title => "Repositórios em {{repo}}", + :title => "Repositórios", + :commits => "Commits", + :tree => "Árvore", + :activities => { :one => "atividade", :other => "atividades" }, + :branches => { :one => "branch", :other => "branches" }, + :authors => { :one => "autor", :other => "autores" }, + :name => %Q{Nome <small>(ex "{{name}}-sandbox", "conserto-performance" etc.)</small>}, + :btn_clone => "Clonar Repositório", + :back => "Retornar ao Repositório", + :show_page_title => "{{repo}} em {{title}}", + :show_title => "repositório "{{repo}}" em {{title}}", + :activities => "Atividades", + :clone_of => "Clone de", + :created => "Criado", + :btn_request => "Requisitar Merge", + :btn_add_committer => "Adicionar Committer", + :btn_delete_repo => "Apagar Repositório", + :committers => "Committers", + :remove => "Remover", + :create_title => lambda { |this, clone, project| + "Criar um clone de #{this.link_to( h(clone.name), this.send(:project_repository_path, project, clone) )} <small>em #{this.link_to h(project.title), this.send(:project_path, project)}</small>" + }, + :clone_note => %Q{ + <em><strong>Nota:</strong> Clones de repositório que não tiverem atividade + dentro de 7 dias são automaticamente removidos (para que o projeto não acabe com + muitos repositórios vazios), então é uma boa idéia esperar para criar o clone + aqui até que tenha alguma coisa para gravar nele.</em> + }, + }, + :projects => { + :back => "Voltar à tela de edição", + :hint => %Q{São permitidos <a href="http://daringfireball.net/projects/markdown/">Markdown</a> e HTML básico}, + :categories => "Categorias", + :delete => "Apagar projeto", + :delete_title => "Por favor, confirme apagar o {{title}}", + :delete_message => "Uma vez que o botão for pressionado o projeto será apagado", + :delete_btn => "SIM, tenho certeza que quero apagar este projeto permanentemente", + :edit => "Editar projeto", + :update_title => "Atualizar {{link}}", + :new => "Novo projeto", + :popular => "Categorias Populares", + :new_title => "Criar um novo projeto", + :new_hint => %Q(Um repositório "mainline" padrão será criado junto com o projeto, permitindo que você comece a fazer commits imediatamente.), + :create => "Criar projeto", + :settings => "Configurações do Projeto", + :labels => "Etiquetas", + :license => "Licença", + :owner => "Criador", + :created => "Criado", + :website => "Site em ", + :mailing => "Lista de Discussão em ", + :bugtracker => "Gerenciador de Bugs em ", + :repos => "Repositórios", + }, + :merges => { + :info => { + :target_repos => "O repositório onde você acha que este deve ser mesclado com", + :target_branch => "O branch de destino onde quer que suas mudanças sejam mescladas", + :source_branch => "O branch de origem de onde o repositório de destino deve pegar as mudanças para mesclar", + :proposal => "Uma breve descrição de suas mudanças", + }, + :summary_tile => "{{source}} requisitou um merge com {{target}}", + :review => "Revisar requisição de merge →", + :page_title => "Requisições de merge em {{repo}}", + :hint => %Q{Uma "requisição de merge" é uma notificação de um repositório para outro de que gostaria que suas mudanças fossem mescladas para cima.}, + :no_merge => "Nenhuma requisição de merge ainda", + :create_title => "Criar uma requisição de merge", + :create_btn => "Criar requisição de merge", + :show_title => "Revisando requisição de merge {{source}} → \"{{target}}\"", + :update_btn => "Atualizar requisição de merge", + :help => "A maneira recomendada para mesclar essas mudanças é puxá-las para um branch local para revisão e então mesclá-las de volta ao branch master:", + :commits => "Commits que seriam mesclados", + }, + :committers => { + :title => "Dá direitos de commit ao repositório {{repo}} para o usuário", + :login => "Usuários existentes <small>(pesquisa-enquanto-digita)</small>", + :add => "Adicionar como committer", + }, + :common => { + :confirm => "Tem certeza?", + :create => "Criar", + :save => "Gravar", + :delete => "apagar", + :add => "Adicionar", + :yes => "Sim", + :no => "Não", + :back => "Retornar", + :signup => "Registrar", + :toggle => "Alternar", + :none => "nenhum(a)", + :update => "Atualizar", + :cancel => "cancelar", + :or => "ou", + }, + }, + + # formatos de data e hora + :date => { + :formats => { + :long_ordinal => lambda { |date| "#{date.day} de %B de %Y" }, + :default => "%d/%m/%Y", + :short => lambda { |date| "#{date.day} %b" }, + :long => lambda { |date| "#{date.day} de %B de %Y" }, + :only_day => "%e", + }, + :day_names => %w(Domingo Segunda Terça Quarta Quinta Sexta Sábado), + :abbr_day_names => %w(Dom Seg Ter Qua Qui Sex Sáb), + :month_names => [nil] + %w(Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro), + :abbr_month_names => [nil] + %w(Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez), + :order => [:day, :month, :year] + }, + :time => { + :formats => { + :long_ordinal => lambda { |time| "#{time.day} de %B de %Y %H:%M" }, + :default => lambda { |time| "%A, #{time.day} de %B de %Y, %H:%M hs" }, + :time => "%H:%M hs", + :short => lambda { |time| "#{time.day}/%m, %H:%M hs" }, + :long => lambda { |time| "%A, #{time.day} de %B de %Y, %H:%M hs" }, + :only_second => "%S", + :human => "%A às %d de %B", + :short_time => "%H:%M", + }, + :time_with_zone => { + :formats => { + :default => lambda { |time| "%Y-%m-%d %H:%M:%S #{time.formatted_offset(false, 'UTC')}" } + } + }, + :am => '', + :pm => '' + }, + + # date helper distanci em palavras + :datetime => { + :distance_in_words => { + :half_a_minute => 'meio minuto', + :less_than_x_seconds => { + :one => 'menos de 1 segundo', + :other => 'menos de {{count}} segundos' + }, + :x_seconds => { + :one => '1 segundo', + :other => '{{count}} segundos' + }, + :less_than_x_minutes => { + :one => 'menos de um minuto', + :other => 'menos de {{count}} minutos' + }, + :x_minutes => { + :one => '1 minuto', + :other => '{{count}} minutos' + }, + :about_x_hours => { + :one => 'aproximadamente 1 hora', + :other => 'aproximadamente {{count}} horas' + }, + :x_days => { + :one => '1 dia', + :other => '{{count}} dias' + }, + :about_x_months => { + :one => 'aproximadamente 1 mês', + :other => 'aproximadamente {{count}} meses' + }, + :x_months => { + :one => '1 mês', + :other => '{{count}} meses' + }, + :about_x_years => { + :one => 'aproximadamente 1 ano', + :other => 'aproximadamente {{count}} anos' + }, + :over_x_years => { + :one => 'mais de 1 ano', + :other => 'mais de {{count}} anos' + } + } + }, + + # numeros + :number => { + :format => { + :precision => 3, + :separator => ',', + :delimiter => '.' + }, + :currency => { + :format => { + :unit => 'R$', + :precision => 2, + :format => '%u %n' + } + } + }, + + # Active Record + :activerecord => { + :models => { + :user => { + :one => "Usuário", + :other => "Usuários" , + }, + :merge_request => { + :one => "Requisição de Merge", + :other => "Requisições de Merges", + }, + :project => { + :one => "Projeto", + :other => "Projetos", + }, + :comment => { + :one => "Comentário", + :other => "Comentários", + }, + :repositories => { + :one => "Repositório", + :other => "Repositórios", + }, + :keys => { + :one => "Chave", + :other => "Chaves", + }, + }, + :attributes => { + :user => { + :login => "Login", + :email => "E-mail", + :current_password => "Senha Atual", + :password => "Senha", + :password_confirmation => "Confirmação de Senha", + :created_at => "Criado em", + :updated_at => "Atualizado em", + :activation_code => "Código de Ativação", + :activated_at => "Ativado em", + :fullname => "Nome Completo", + :url => "URL", + }, + :merge_request => { + :target_repository_id => "Repositório Original", + :proposal => "Proposta", + :source_branch => "Branch Destino", + :target_branch => "Branch Original", + }, + :project => { + :title => "Título", + :description => "Descrição (obrigatório)", + :slug => "Apelido (para urls, etc.)", + :license => "Licença", + :home_url => "URL do Site Principal (ex. RubyForge, etc.)", + :mailinglist_url => "URL de Lista de Discussão (se tiver)", + :bugtracker_url => "URL de Gerenciador de Bugs (se tiver)", + :tag_list => "Categorias (separadas por espaço)", + }, + :comment => { + :body => "Comentário", + }, + :repository => { + :name => "Nome", + :ready => "Preparado", + }, + :keys => { + :key => "Chave", + :ready => "Preparado", + }, + }, + :errors => { + :template => { + :header => { + :one => "{{model}} não pôde ser salvo: 1 erro", + :other => "{{model}} não pôde ser salvo: {{count}} erros." + }, + :body => "Por favor, cheque os seguintes campos:" + }, + :messages => { + :inclusion => "não está incluso na lista", + :exclusion => "não está disponível", + :invalid => "não é válido", + :confirmation => "não bate com a confirmação", + :accepted => "precisa ser aceito", + :empty => "não pode ser vazio", + :blank => "não pode ser vazio", + :too_long => "é muito longo (não mais do que {{count}} caracteres)", + :too_short => "é muito curto (não menos do que {{count}} caracteres)", + :wrong_length => "não é do tamanho correto (precisa ter {{count}} caracteres)", + :taken => "não está disponível", + :not_a_number => "não é um número", + :greater_than => "precisa ser maior do que {{count}}", + :greater_than_or_equal_to => "precisa ser maior ou igual a {{count}}", + :equal_to => "precisa ser igual a {{count}}", + :less_than => "precisa ser menor do que {{count}}", + :less_than_or_equal_to => "precisa ser menor ou igual a {{count}}", + :odd => "precisa ser ímpar", + :even => "precisa ser par" + } + } + } + } +}
\ No newline at end of file diff --git a/public/stylesheets/base.css b/public/stylesheets/base.css index c366f3b..9f0449c 100644 --- a/public/stylesheets/base.css +++ b/public/stylesheets/base.css @@ -436,6 +436,7 @@ textarea { } textarea.text { height: 60px; } textarea.wide { width: 100%; } +textarea.shorter { height: 250px; } textarea.tall { height: 500px; } textarea.medium { width: 450px; height: 250px; } select { width: 200px; } diff --git a/vendor/plugins/localized_dates/CHANGELOG b/vendor/plugins/localized_dates/CHANGELOG new file mode 100644 index 0000000..6e9d381 --- /dev/null +++ b/vendor/plugins/localized_dates/CHANGELOG @@ -0,0 +1,10 @@ +[2 October 2008] +* Update initialization to work with latest change to Rails I18n. (Aslak Hellesøy) +* Update localized_dates.rb to use Rails.logger instead of puts. (Andreas Korth) + +[30 August 2008] +* Support new Rails i18n style for loading/storing translation (YAML and newly structured rb files). See + http://www.artweb-design.de/2008/8/28/ruby-on-rails-i18n-railsconf-europe-and-globalize2 for details. + +[3 August 2008] +* Initial release on GitHub.
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/README b/vendor/plugins/localized_dates/README new file mode 100644 index 0000000..106f3a7 --- /dev/null +++ b/vendor/plugins/localized_dates/README @@ -0,0 +1,149 @@ +localized_dates +================= + +The localized_dates plugin takes away some of the pain of localizing dates and times. It leverages the power of the +Rails i18n plugin (http://rails-i18n.org/) to facilitate localization of dates and times. + +Installation +================= + +To install the plugin, change into an existing Rails application and run + + ruby script/plugin install git://github.com/clemens/localized_dates.git + +This will download the plugin and store it in vendor/plugins/localized_dates. It will also create a directory named +config/locales and copy three locale files, en.rb, en.yml, and de.yml into this directory. While the "en" +locale files mimic current Rails formats, "de" serves as a demo on how date and time formats can be customized. + +Adding a new locale +================= + +To add a new locale, simply create a new file in config/locales. You can make your life easier by copying an existing +locale and basing your new locale on it. + +Adding new date and time formats +================= + +Adding new date and time formats is easy. Take a look at the basic structure of the locale file en.yml: + + en: + date: + formats: + default: "%Y-%m-%d" + short: "%e %b" + long: "%B %e, %Y" + only_day: "%e" + + time: + formats: + default: "%a %b %d %H:%M:%S %Z %Y" + time: "%H:%M" + short: "%d %b %H:%M" + long: "%B %d, %Y %H:%M" + only_second: "%S" + + datetime: + formats: + default: "%Y-%m-%dT%H:%M:%S%Z" + + am: 'am' + pm: 'pm' + +As you can see, there are two basic entites: date and time. time also has two children, datetime and time_with_zone +that both inherit from :time so you usually don't even need to define them (the "de" locale, for, example doesn't). + +If you need more complex Ruby constructs such as lambdas, you still need to define them in a separate Ruby file. Take +a look at the following default formats of en.rb: + + { + :en => { + :date => { + :formats => { + :long_ordinal => lambda { |date| "%B #{date.day.ordinalize}, %Y" } + } + }, + :time => { + :formats => { + :long_ordinal => lambda { |time| "%B #{time.day.ordinalize}, %Y %H:%M" } + }, + :time_with_zone => { + :formats => { + :default => lambda { |time| "%Y-%m-%d %H:%M:%S #{time.formatted_offset(false, 'UTC')}" } + } + } + } + } + } + +For example, if you define a time format named release_date, you can use Time.now.to_s(:release_date) in your views. +You should always define a format named default for both, date and time, that serves as the default format. You can use +the default format by simply writing Time.now.to_s without passing an additional parameter. + +You can either use a strftime compatible formatting string or a Proc that returns a strftime formatting string as a +date/time format. Take a look at the following examples: + + :short => "%d %B, %H:%M" # => "03 August, 22:49" + :long => lambda { |time| "%A, #{time.day}. %B %Y, %H:%M" } # => "Samstag, 3. August 2008, 22:49" + +Please note that the use of Procs is slightly different from Rails' original behavior: + + old: :long => lambda { |time| time.strftime("%A, #{time.day}. %B %Y, %H:%M") } + new: :long => lambda { |time| "%A, #{time.day}. %B %Y, %H:%M" } + +The old way should still work without throwing error messages, however, the dates and times will not be localized. + +For further information on strftime formatting, see http://ruby-doc.org/core/classes/Time.html#M000139. + +Check installed locales +================= + +To display a list of all locales installed in config/locales, you can use the following rake command: + + rake locales + +Customizing day and month names +================= + +If you localize your application for a language other than English, you most likely want to change the default month +and day names to your own countries' names. Here's how it's done: + + de: + date: + day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] + abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] + month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] + abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] + order: [ :year, :month, :day ] + +The only caveat here is that month_names and abbr_month_names *need* nil as their respective first elements. If you +don't use nil as the first element you'll end up with wrong dates (August will become September, etc.). Also note that +the definition of day names starts with Sunday (not Monday). + +Changing the default locale +================= + +If you want to use a default locale other than "en", you have to tell the i18n plugin the locale you want to use by +default. Simply put the following line in an initializer in config/initializers or include it in your environment.rb: + + I18n.default_locale = :de + +Contributors +================= + +* Aslak Hellesøy (http://blog.aslakhellesoy.com/) +* Andreas Korth +* Andreas Neuhaus + +Bugs and Feedback +================= + +If you discover any bugs I'd appreciate if you sent me an e-mail to clemens@railway.at. Please include a detailed +description of your problem if you want me to help you. + +If you have positive feedback and want to drop me a line that's fine, too! :-) + + +Copyright (c) 2008 Clemens Kofler <clemens@railway.at>, released under the MIT license + +http://www.railway.at +http://github.com/clemens/localized_dates
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/Rakefile b/vendor/plugins/localized_dates/Rakefile new file mode 100644 index 0000000..7e1954b --- /dev/null +++ b/vendor/plugins/localized_dates/Rakefile @@ -0,0 +1,11 @@ +require 'rake' +require 'spec/rake/spectask' + +desc 'Default: run specs.' +task :default => :spec + +desc 'Run the specs' +Spec::Rake::SpecTask.new(:spec) do |t| + t.spec_opts = ['--colour --format progress --loadby mtime --reverse'] + t.spec_files = FileList['spec/**/*_spec.rb'] +end diff --git a/vendor/plugins/localized_dates/init.rb b/vendor/plugins/localized_dates/init.rb new file mode 100644 index 0000000..90549c2 --- /dev/null +++ b/vendor/plugins/localized_dates/init.rb @@ -0,0 +1,13 @@ +require 'localized_dates' + +# load all locales from config/locales +locales_dir = File.join(RAILS_ROOT, 'config', 'locales') +Dir["#{locales_dir}/*.{rb,yml}"].uniq.each do |locale_file| + Rails.logger.info "** [localized_dates] loading file #{locale_file}" + I18n.load_path << locale_file +end + +Rails.logger.info '** [localized_dates] locales loaded from config/locales.' + +# set default locale to en +I18n.default_locale = 'en'
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/install.rb b/vendor/plugins/localized_dates/install.rb new file mode 100644 index 0000000..4373392 --- /dev/null +++ b/vendor/plugins/localized_dates/install.rb @@ -0,0 +1,11 @@ +require 'fileutils' + +locales_dir = File.join(RAILS_ROOT, 'config', 'locales') +Dir.mkdir(locales_dir) unless File.directory?(locales_dir) + +locales_template_dir = File.join(File.dirname(__FILE__), 'lib', 'templates', 'locales') +['en.rb', 'en.yml', 'de.yml'].each do |locale| + FileUtils.cp(File.join(locales_template_dir, locale), File.join(locales_dir, locale)) +end + +puts 'Copied locales to config/locales.'
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/lib/core_ext/date.rb b/vendor/plugins/localized_dates/lib/core_ext/date.rb new file mode 100644 index 0000000..9bae8b6 --- /dev/null +++ b/vendor/plugins/localized_dates/lib/core_ext/date.rb @@ -0,0 +1,21 @@ +::Date.class_eval do + def to_formatted_s(format = :default) + formats = ::Date::DATE_FORMATS + formatter = formats[format] + + unless formatter + formatters = I18n.translate(:'date.formats', :raise => true) rescue {} + formatter = formatters[format] + end + + format_to_localize = formatter.respond_to?(:call) ? formatter.call(self) : formatter + I18n.localize(self, :format => format_to_localize) + end + alias_method :to_s, :to_formatted_s +end + +::Date.const_set('DATE_FORMATS', { + :db => "%Y-%m-%d", + :number => "%Y%m%d", + :rfc822 => "%e %b %Y" +})
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/lib/core_ext/datetime.rb b/vendor/plugins/localized_dates/lib/core_ext/datetime.rb new file mode 100644 index 0000000..45b3299 --- /dev/null +++ b/vendor/plugins/localized_dates/lib/core_ext/datetime.rb @@ -0,0 +1,17 @@ +::DateTime.class_eval do + def to_formatted_s(format = :default) + formats = ::Time::DATE_FORMATS + formatter = formats[format] + + unless formatter + default_formatters = I18n.translate(:'time.formats', :raise => true) rescue {} + datetime_formatters = I18n.translate(:'time.datetime.formats', :raise => true) rescue {} + formatters = default_formatters.merge(datetime_formatters) + formatter = formatters[format] + end + + format_to_localize = formatter.respond_to?(:call) ? formatter.call(self) : formatter + I18n.localize(self, :format => format_to_localize) + end + alias_method :to_s, :to_formatted_s +end
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/lib/core_ext/time.rb b/vendor/plugins/localized_dates/lib/core_ext/time.rb new file mode 100644 index 0000000..29da8b3 --- /dev/null +++ b/vendor/plugins/localized_dates/lib/core_ext/time.rb @@ -0,0 +1,21 @@ +::Time.class_eval do + def to_formatted_s(format = :default) + formats = ::Time::DATE_FORMATS + formatter = formats[format] + + unless formatter + formatters = I18n.translate(:'time.formats', :raise => true) rescue {} + formatter = formatters[format] + end + + format_to_localize = formatter.respond_to?(:call) ? formatter.call(self) : formatter + I18n.localize(self, :format => format_to_localize) + end + alias_method :to_s, :to_formatted_s +end + +::Time.const_set('DATE_FORMATS', { + :db => "%Y-%m-%d %H:%M:%S", + :number => "%Y%m%d%H%M%S", + :rfc822 => "%a, %d %b %Y %H:%M:%S %z" +})
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/lib/core_ext/time_with_zone.rb b/vendor/plugins/localized_dates/lib/core_ext/time_with_zone.rb new file mode 100644 index 0000000..2c875bb --- /dev/null +++ b/vendor/plugins/localized_dates/lib/core_ext/time_with_zone.rb @@ -0,0 +1,17 @@ +ActiveSupport::TimeWithZone.class_eval do + def to_s(format = :default) + return utc.to_s(format) if format == :db + formats = ::Time::DATE_FORMATS + formatter = formats[format] + + unless formatter + default_formatters = I18n.translate(:'time.formats', :raise => true) rescue {} + twz_formatters = I18n.translate(:'time.time_with_zone.formats', :raise => true) rescue {} + formatters = default_formatters.merge(twz_formatters) + formatter = formatters[format] + end + + format_to_localize = formatter.respond_to?(:call) ? formatter.call(self) : formatter + I18n.localize(self, :format => format_to_localize) + end +end
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/lib/localized_dates.rb b/vendor/plugins/localized_dates/lib/localized_dates.rb new file mode 100644 index 0000000..de185b5 --- /dev/null +++ b/vendor/plugins/localized_dates/lib/localized_dates.rb @@ -0,0 +1,6 @@ +require 'core_ext/date' +require 'core_ext/datetime' +require 'core_ext/time' +require 'core_ext/time_with_zone' + +Rails.logger.info '** [localized_dates] localized_dates plugin loaded.'
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/lib/templates/locales/de.yml b/vendor/plugins/localized_dates/lib/templates/locales/de.yml new file mode 100644 index 0000000..baf8b9c --- /dev/null +++ b/vendor/plugins/localized_dates/lib/templates/locales/de.yml @@ -0,0 +1,22 @@ +de: + date: + formats: + default: "%d.%m.%Y" + short: "%e. %b" + long: "%e. %B %Y" + + day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag] + abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa] + month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember] + abbr_month_names: [~, Jan, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez] + order: [:day, :month, :year] + + time: + formats: + default: "%A, %e. %B %Y, %H:%M Uhr" + time: "%H:%M Uhr" + short: "%e.%m., %H:%M Uhr" + long: "%A, %e. %B %Y, %H:%M Uhr" + + am: "" + pm: ""
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/lib/templates/locales/en.rb b/vendor/plugins/localized_dates/lib/templates/locales/en.rb new file mode 100644 index 0000000..7793461 --- /dev/null +++ b/vendor/plugins/localized_dates/lib/templates/locales/en.rb @@ -0,0 +1,19 @@ +{ + :en => { + :date => { + :formats => { + :long_ordinal => lambda { |date| "%B #{date.day.ordinalize}, %Y" } + } + }, + :time => { + :formats => { + :long_ordinal => lambda { |time| "%B #{time.day.ordinalize}, %Y %H:%M" } + }, + :time_with_zone => { + :formats => { + :default => lambda { |time| "%Y-%m-%d %H:%M:%S #{time.formatted_offset(false, 'UTC')}" } + } + } + } + } +}
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/lib/templates/locales/en.yml b/vendor/plugins/localized_dates/lib/templates/locales/en.yml new file mode 100644 index 0000000..4bb407e --- /dev/null +++ b/vendor/plugins/localized_dates/lib/templates/locales/en.yml @@ -0,0 +1,28 @@ +en: + date: + formats: + default: "%Y-%m-%d" + short: "%e %b" + long: "%B %e, %Y" + only_day: "%e" + + day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] + abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] + month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] + abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] + order: [ :year, :month, :day ] + + time: + formats: + default: "%a %b %d %H:%M:%S %Z %Y" + time: "%H:%M" + short: "%d %b %H:%M" + long: "%B %d, %Y %H:%M" + only_second: "%S" + + datetime: + formats: + default: "%Y-%m-%dT%H:%M:%S%Z" + + am: 'am' + pm: 'pm'
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/spec/debug.log b/vendor/plugins/localized_dates/spec/debug.log new file mode 100644 index 0000000..f81d046 --- /dev/null +++ b/vendor/plugins/localized_dates/spec/debug.log @@ -0,0 +1 @@ +# Logfile created on Sun Aug 03 20:31:41 +0200 2008 by / diff --git a/vendor/plugins/localized_dates/spec/localized_dates_spec.rb b/vendor/plugins/localized_dates/spec/localized_dates_spec.rb new file mode 100644 index 0000000..25b40b9 --- /dev/null +++ b/vendor/plugins/localized_dates/spec/localized_dates_spec.rb @@ -0,0 +1,57 @@ +require File.dirname(__FILE__) + '/spec_helper' + +describe "Date and Time localization" do + before(:each) do + # load locale files + locales_dir = File.dirname(__FILE__) + "/../lib/templates/locales" + I18n.load_path << "#{locales_dir}/en.rb" + I18n.load_path << "#{locales_dir}/en.yml" + + # set up defaults + @date_defaults = { :default => "%Y-%m-%d", + :short => "%e %b", + :long => "%B %e, %Y", + :long_ordinal => lambda { |date| "%B #{date.day.ordinalize}, %Y" } } + @time_defaults = { :default => "%a %b %d %H:%M:%S %Z %Y", + :time => "%H:%M", + :short => "%d %b %H:%M", + :long => "%B %d, %Y %H:%M", + :long_ordinal => lambda { |time| "%B #{time.day.ordinalize}, %Y %H:%M" } } + @datetime_defaults = { :default => "%Y-%m-%dT%H:%M:%S%Z" } + @time_with_zone_defaults = { + :default => lambda { |time| "%Y-%m-%d %H:%M:%S #{time.formatted_offset(false, 'UTC')}" } + } + end + + describe Date do + it "should translate format when to_s is called" do + I18n.should_receive(:translate).with(:'date.formats', :raise => true).and_return(@date_defaults) + Date.today.to_s(:short) + end + end + + describe Time do + it "should translate format when to_s is called" do + I18n.should_receive(:translate).with(:'time.formats', :raise => true).and_return(@time_defaults) + Time.now.to_s(:short) + end + end + + describe DateTime do + it "should translate format when to_s is called" do + I18n.should_receive(:translate).with(:'time.formats', :raise => true).and_return(@time_defaults) + I18n.should_receive(:translate).with(:'time.datetime.formats', :raise => true).and_return(@datetime_defaults) + DateTime.now.to_s(:short) + end + end + + describe ActiveSupport::TimeWithZone do + it "should translate format when to_s is called" do + I18n.should_receive(:translate).with(:'time.formats', :raise => true).and_return(@time_defaults) + I18n.should_receive(:translate).with(:'time.time_with_zone.formats', :raise => true).and_return(@time_with_zone_defaults) + + t, z = Time.utc(2000, 1, 1, 0), ActiveSupport::TimeZone['UTC'] + ActiveSupport::TimeWithZone.new(t, z).to_s(:short) + end + end +end
\ No newline at end of file diff --git a/vendor/plugins/localized_dates/spec/spec_helper.rb b/vendor/plugins/localized_dates/spec/spec_helper.rb new file mode 100644 index 0000000..3424846 --- /dev/null +++ b/vendor/plugins/localized_dates/spec/spec_helper.rb @@ -0,0 +1,10 @@ +begin + require File.dirname(__FILE__) + '/../../../../spec/spec_helper' +rescue LoadError + puts "You need to install rspec in your base app" + exit +end + +plugin_spec_dir = File.dirname(__FILE__) +ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log") + diff --git a/vendor/plugins/localized_dates/tasks/localized_dates.rake b/vendor/plugins/localized_dates/tasks/localized_dates.rake new file mode 100644 index 0000000..1eda768 --- /dev/null +++ b/vendor/plugins/localized_dates/tasks/localized_dates.rake @@ -0,0 +1,7 @@ +desc 'Displays a list of all locales installed in config/locales' +task :locales do + locales_dir = File.join(RAILS_ROOT, 'config', 'locales') + Dir["#{locales_dir}/*.rb"].uniq.each do |locale| + puts File.basename(locale, '.rb') + end +end
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/MIT-LICENSE b/vendor/plugins/localized_templates/MIT-LICENSE new file mode 100644 index 0000000..5a25e20 --- /dev/null +++ b/vendor/plugins/localized_templates/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2007 Thomas Preston-Werner + +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.
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/README b/vendor/plugins/localized_templates/README new file mode 100644 index 0000000..d1a5210 --- /dev/null +++ b/vendor/plugins/localized_templates/README @@ -0,0 +1,71 @@ +Copyright (c) 2008 José Valim (jose.valim@gmail.com) +http://www.pagestacker.com/ +http://josevalim.blogspot.com/ +License: MIT +Version: 0.3.1 + +LocalizedTemplates +================== + +This plugin uses Rails I18n (http://rails-i18n.org/) to allow templates localization. +You can localize your views using the following naming convention: + + <tt>pt-BR/projects/index.html.erb</tt> + <tt>en-US/projects/edit.rss.builder</tt> + +And you can also localize rescue files: + + <tt>public/pt-BR/404.html</tt> + <tt>public/en-US/404.html</tt> + +If you don't want to localize a file (like a xml file), simply don't move it and it will be +rendered as default to all languages. + +Installation +================= + +Install LocalizedTemplates is very easy. It is stored in GitHub, so if you have +never installed a gem via GitHub run the following: + + gem sources -a http://gems.github.com + +Then install the gem: + + sudo gem install josevalim-localized_templates + +In RAILS_ROOT/config/environment.rb: + + config.gem "josevalim-localized_templates", :lib => "localized_templates", :source => "http://gems.github.com" + +If you want it as plugin, just do: + + cd myapp + git clone git://github.com/josevalim/localized_templates.git + rm -rf vendor/plugins/localized_templates/.git + +Adding a new locale +================= + +To add a new locale, simply create a new file in config/locales. You can make your life easier by copying an existing +locale and basing your new locale on it. + +Check installed locales +================= + +To display a list of all locales installed in config/locales, you can use the following rake command: + + rake locales + +Changing the default locale +================= + +If you want to use a default locale other than en-US, you have to tell the i18n plugin the locale you want to use by +default. Simply put the following line in an initializer in config/initializers or include it in your environment.rb: + + I18n.default_locale = 'de-AT' + +Bugs and Feedback +================= + +If you discover any bugs, please send me an e-mail to jose.valim@gmail.com +If you have positive feedback, that's fine too! =) diff --git a/vendor/plugins/localized_templates/Rakefile b/vendor/plugins/localized_templates/Rakefile new file mode 100644 index 0000000..ce153a4 --- /dev/null +++ b/vendor/plugins/localized_templates/Rakefile @@ -0,0 +1,18 @@ +require 'rake' +require 'rake/testtask' +require 'rake/rdoctask' + +desc 'Run tests.' +Rake::TestTask.new(:test) do |t| + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +desc 'Generate documentation.' +Rake::RDocTask.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'SimpleLocalization' + rdoc.options << '--line-numbers' << '--inline-source' + rdoc.rdoc_files.include('README') + rdoc.rdoc_files.include('lib/**/*.rb') +end
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/init.rb b/vendor/plugins/localized_templates/init.rb new file mode 100644 index 0000000..03a6d3d --- /dev/null +++ b/vendor/plugins/localized_templates/init.rb @@ -0,0 +1 @@ +require File.join(File.dirname(__FILE__), 'lib', 'localized_templates') diff --git a/vendor/plugins/localized_templates/lib/localized_rescue/README b/vendor/plugins/localized_templates/lib/localized_rescue/README new file mode 100644 index 0000000..cef0bb5 --- /dev/null +++ b/vendor/plugins/localized_templates/lib/localized_rescue/README @@ -0,0 +1,10 @@ +Localized rescue +---------------- + +This feature extends Rails rescue handling and allows the use of localized +rescues like <code>en-US/404.html</code> on the public dir. The plugin will +then pick the rescue page matching the currently used locale +(<code>I18n#locale</code>). + +If the localized rescue page isn't found, the plugin will render the +<code>404.html</code> file if it exists.
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/lib/localized_rescue/actioncontroller/rescue.rb b/vendor/plugins/localized_templates/lib/localized_rescue/actioncontroller/rescue.rb new file mode 100644 index 0000000..d273ad4 --- /dev/null +++ b/vendor/plugins/localized_templates/lib/localized_rescue/actioncontroller/rescue.rb @@ -0,0 +1,27 @@ +module ActionController + class Base + + protected + # Attempts to render a static error page based on the <tt>status_code</tt> thrown, + # or just return headers if no such file exists. For example, if a 500 error is + # being handled Rails will first attempt to render the file at the current locale + # such as <tt>public/en-US/500.html</tt>. Then the file with no locale + # <tt>public/500.html</tt>. If the files doesn't exist, the body of the response + # will be left empty. + # + def render_optional_error_file(status_code) + status = interpret_status(status_code) + locale_path = "#{Rails.public_path}/#{I18n.locale}/#{status[0,3]}.html" if I18n.locale + path = "#{Rails.public_path}/#{status[0,3]}.html" + + if locale_path && File.exist?(locale_path) + render :file => locale_path, :status => status + elsif File.exist?(path) + render :file => path, :status => status + else + head status + end + end + + end +end
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/lib/localized_templates.rb b/vendor/plugins/localized_templates/lib/localized_templates.rb new file mode 100644 index 0000000..e9bb9f0 --- /dev/null +++ b/vendor/plugins/localized_templates/lib/localized_templates.rb @@ -0,0 +1,5 @@ +require 'localized_rescue/actioncontroller/rescue' +require 'localized_templates/actioncontroller/base' +require 'localized_templates/actioncontroller/layout' +require 'localized_templates/actionview/base' +require 'localized_templates/actionview/partials'
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/lib/localized_templates/README b/vendor/plugins/localized_templates/lib/localized_templates/README new file mode 100644 index 0000000..6dea200 --- /dev/null +++ b/vendor/plugins/localized_templates/lib/localized_templates/README @@ -0,0 +1,24 @@ +Localized templates +------------------- + +This feature extends Rails template handling and allows the use of localized +templates on the root of your views folder like <code>pt-BR/projects/index.html.erb</code>. +The plugin will pick the template matching the currently used locale +(<code>I18n#locale</code>). + +If the localized template isn't found, the plugin will try to render the default +<code>projects/index.html.erb</code>. If <code>index.html.erb</code> doesn't +exist, a 404 will be raised. + +If you have a template that is the same for all languages (like a xml file) +just keep it without localization: <code>index.xml.builder</code>. + +Theoretically, we just need to overwrite _pick_template and _pick_partial_template +methods in order to have LocalizedTemplates, but memoize doesn't help +since it doesn't see locale changes and would memoize values for only one locale. + +We can fix this by passing the locale to _pick_template as argument or creating a +localized memoize, that would memoize different values based on the locale. + +For now, we will use the first solution: pass the locale to _pick_template. As +consequence, we need to overwrite all methods that call _pick_template.
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/lib/localized_templates/actioncontroller/base.rb b/vendor/plugins/localized_templates/lib/localized_templates/actioncontroller/base.rb new file mode 100644 index 0000000..12f7065 --- /dev/null +++ b/vendor/plugins/localized_templates/lib/localized_templates/actioncontroller/base.rb @@ -0,0 +1,12 @@ +module ActionController + class Base + + private + def template_exists?(template_name = default_template_name) + @template.send(:_pick_template, template_name, I18n.locale) ? true : false + rescue ActionView::MissingTemplate + false + end + + end +end
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/lib/localized_templates/actioncontroller/layout.rb b/vendor/plugins/localized_templates/lib/localized_templates/actioncontroller/layout.rb new file mode 100644 index 0000000..dad7793 --- /dev/null +++ b/vendor/plugins/localized_templates/lib/localized_templates/actioncontroller/layout.rb @@ -0,0 +1,12 @@ +module ActionController + class Base + + private + def layout_directory?(layout_name) + @template.__send__(:_pick_template, "#{File.join('layouts', layout_name)}.#{@template.template_format}", I18n.locale) ? true : false + rescue ActionView::MissingTemplate + false + end + + end +end
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/lib/localized_templates/actionview/base.rb b/vendor/plugins/localized_templates/lib/localized_templates/actionview/base.rb new file mode 100644 index 0000000..e4f7dab --- /dev/null +++ b/vendor/plugins/localized_templates/lib/localized_templates/actionview/base.rb @@ -0,0 +1,93 @@ +module ActionView + class Base + @@exempt_from_layout = Set.new([/\.rjs$/]) + + # Renders the template present at <tt>template_path</tt> (relative to the view_paths array). + # The hash in <tt>local_assigns</tt> is made available as local variables. + def render(options = {}, local_assigns = {}, &block) #:nodoc: + local_assigns ||= {} + + if options.is_a?(String) + ActiveSupport::Deprecation.warn( + "Calling render with a string will render a partial from Rails 2.3. " + + "Change this call to render(:file => '#{options}', :locals => locals_hash)." + ) + + render(:file => options, :locals => local_assigns) + elsif options == :update + update_page(&block) + elsif options.is_a?(Hash) + options = options.reverse_merge(:locals => {}) + if options[:layout] + _render_with_layout(options, local_assigns, &block) + elsif options[:file] + _pick_template(options[:file], I18n.locale).render_template(self, options[:locals]) + elsif options[:partial] + render_partial(options) + elsif options[:inline] + InlineTemplate.new(options[:inline], options[:type]).render(self, options[:locals]) + elsif options[:text] + options[:text] + end + end + end + + private + def _pick_template(template_path, locale = nil) + return template_path if template_path.respond_to?(:render) + + path = template_path.sub(/^\//, '') + if m = path.match(/(.*)\.(\w+)$/) + template_file_name, template_file_extension = m[1], m[2] + else + template_file_name = path + end + + # Try to render locale/controller/action + if locale && template = _template_view_path_check("#{locale}/#{template_file_name}") + template + # Try to render controller/action + elsif template = _template_view_path_check(template_file_name) + template + else + template = Template.new(template_path, view_paths) + + if self.class.warn_cache_misses && logger + logger.debug "[PERFORMANCE] Rendering a template that was " + + "not found in view path. Templates outside the view path are " + + "not cached and result in expensive disk operations. Move this " + + "file into #{view_paths.join(':')} or add the folder to your " + + "view path list" + end + + template + end + end + memoize :_pick_template + + def _template_view_path_check(template_file_name) + # OPTIMIZE: Checks to lookup template in view path + if template = self.view_paths["#{template_file_name}.#{template_format}"] + template + elsif template = self.view_paths[template_file_name] + template + elsif (first_render = @_render_stack.first) && first_render.respond_to?(:format_and_extension) && + (template = self.view_paths["#{template_file_name}.#{first_render.format_and_extension}"]) + template + elsif template_format == :js && template = self.view_paths["#{template_file_name}.html"] + @template_format = :html + template + else + nil + end + end + + def _exempt_from_layout?(template_path) #:nodoc: + template = _pick_template(template_path, I18n.locale).to_s + @@exempt_from_layout.any? { |ext| template =~ ext } + rescue ActionView::MissingTemplate + return false + end + + end +end
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/lib/localized_templates/actionview/partials.rb b/vendor/plugins/localized_templates/lib/localized_templates/actionview/partials.rb new file mode 100644 index 0000000..1d5254d --- /dev/null +++ b/vendor/plugins/localized_templates/lib/localized_templates/actionview/partials.rb @@ -0,0 +1,65 @@ +module ActionView + class Base + + private + def render_partial(options = {}) #:nodoc: + local_assigns = options[:locals] || {} + + case partial_path = options[:partial] + when String, Symbol, NilClass + if options.has_key?(:collection) + render_partial_collection(options) + else + _pick_partial_template(partial_path, I18n.locale).render_partial(self, options[:object], local_assigns) + end + when ActionView::Helpers::FormBuilder + builder_partial_path = partial_path.class.to_s.demodulize.underscore.sub(/_builder$/, '') + local_assigns.merge!(builder_partial_path.to_sym => partial_path) + render_partial(:partial => builder_partial_path, :object => options[:object], :locals => local_assigns) + when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope + render_partial_collection(options.except(:partial).merge(:collection => partial_path)) + else + object = partial_path + render_partial( + :partial => ActionController::RecordIdentifier.partial_path(object, controller.class.controller_path), + :object => object, + :locals => local_assigns + ) + end + end + + def render_partial_collection(options = {}) #:nodoc: + return nil if options[:collection].blank? + + partial = options[:partial] + spacer = options[:spacer_template] ? render(:partial => options[:spacer_template]) : '' + local_assigns = options[:locals] ? options[:locals].clone : {} + as = options[:as] + + index = 0 + options[:collection].map do |object| + _partial_path ||= partial || + ActionController::RecordIdentifier.partial_path(object, controller.class.controller_path) + template = _pick_partial_template(_partial_path, I18n.locale) + local_assigns[template.counter_name] = index + result = template.render_partial(self, object, local_assigns.dup, as) + index += 1 + result + end.join(spacer) + end + + def _pick_partial_template(partial_path, locale = nil) #:nodoc: + if partial_path.include?('/') + path = File.join(File.dirname(partial_path), "_#{File.basename(partial_path)}") + elsif controller + path = "#{controller.class.controller_path}/_#{partial_path}" + else + path = "_#{partial_path}" + end + + _pick_template(path, locale) + end + memoize :_pick_partial_template + + end +end
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/localized_templates.gemspec b/vendor/plugins/localized_templates/localized_templates.gemspec new file mode 100644 index 0000000..d1f331c --- /dev/null +++ b/vendor/plugins/localized_templates/localized_templates.gemspec @@ -0,0 +1,42 @@ +Gem::Specification.new do |s| + s.name = "localized_templates" + s.version = "0.3.1" + s.date = "2008-12-18" + s.summary = "Templates localization for Rails 2.2" + s.email = "jose.valim@gmail.com" + s.homepage = "http://github.com/josevalim/localized_templates" + s.description = "Templates localization for Rails 2.2" + s.has_rdoc = true + s.authors = [ "José Valim" ] + s.files = [ + "MIT-LICENSE", + "README", + "Rakefile", + "lib/localized_templates.rb", + "lib/localized_rescue/README", + "lib/localized_rescue/actioncontroller/rescue.rb", + "lib/localized_templates/README", + "lib/localized_templates/actioncontroller/base.rb", + "lib/localized_templates/actioncontroller/layout.rb", + "lib/localized_templates/actionview/base.rb", + "lib/localized_templates/actionview/partials.rb" + ] + s.test_files = [ + "test/localized_rescue_test.rb", + "test/localized_templates_test.rb", + "test/setup.rb", + "test/fixtures/en-US.yml", + "test/fixtures/pt-BR.yml", + "test/fixtures/layouts/default.html.erb", + "test/fixtures/projects/index.html.erb", + "test/fixtures/projects/index.rss.builder", + "test/fixtures/en-US/projects/index.rss.builder", + "test/fixtures/pt-BR/projects/index.html.erb", + "test/fixtures/pt-BR/layouts/default.html.erb", + "test/fixtures/public/500.html", + "test/fixtures/public/en-US/404.html", + "test/fixtures/public/pt-BR/404.html" + ] + s.rdoc_options = ["--main", "README"] + s.extra_rdoc_files = ["README"] +end diff --git a/vendor/plugins/localized_templates/test/fixtures/en-US.yml b/vendor/plugins/localized_templates/test/fixtures/en-US.yml new file mode 100644 index 0000000..4e8a58c --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/en-US.yml @@ -0,0 +1,2 @@ +"en-US": + about: "language fixture" diff --git a/vendor/plugins/localized_templates/test/fixtures/en-US/projects/index.rss.builder b/vendor/plugins/localized_templates/test/fixtures/en-US/projects/index.rss.builder new file mode 100644 index 0000000..e3b4c4b --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/en-US/projects/index.rss.builder @@ -0,0 +1 @@ +xml.en_US "text"
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/test/fixtures/layouts/default.html.erb b/vendor/plugins/localized_templates/test/fixtures/layouts/default.html.erb new file mode 100644 index 0000000..9f4d9a8 --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/layouts/default.html.erb @@ -0,0 +1,3 @@ +<none> + <%= yield %> +</none>
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/test/fixtures/projects/index.html.erb b/vendor/plugins/localized_templates/test/fixtures/projects/index.html.erb new file mode 100644 index 0000000..1a7f3f7 --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/projects/index.html.erb @@ -0,0 +1 @@ +none index view
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/test/fixtures/projects/index.rss.builder b/vendor/plugins/localized_templates/test/fixtures/projects/index.rss.builder new file mode 100644 index 0000000..98e4cf6 --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/projects/index.rss.builder @@ -0,0 +1 @@ +xml.none "text"
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/test/fixtures/pt-BR.yml b/vendor/plugins/localized_templates/test/fixtures/pt-BR.yml new file mode 100644 index 0000000..75ad87a --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/pt-BR.yml @@ -0,0 +1,2 @@ +"pt-BR": + about: "language fixture" diff --git a/vendor/plugins/localized_templates/test/fixtures/pt-BR/layouts/default.html.erb b/vendor/plugins/localized_templates/test/fixtures/pt-BR/layouts/default.html.erb new file mode 100644 index 0000000..13a176c --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/pt-BR/layouts/default.html.erb @@ -0,0 +1,3 @@ +<pt-BR> + <%= yield %> +</pt-BR>
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/test/fixtures/pt-BR/projects/index.html.erb b/vendor/plugins/localized_templates/test/fixtures/pt-BR/projects/index.html.erb new file mode 100644 index 0000000..f47ef98 --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/pt-BR/projects/index.html.erb @@ -0,0 +1 @@ +pt-BR index view
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/test/fixtures/public/500.html b/vendor/plugins/localized_templates/test/fixtures/public/500.html new file mode 100644 index 0000000..7c66c7a --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/public/500.html @@ -0,0 +1 @@ +500 error fixture diff --git a/vendor/plugins/localized_templates/test/fixtures/public/en-US/404.html b/vendor/plugins/localized_templates/test/fixtures/public/en-US/404.html new file mode 100644 index 0000000..cd3493e --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/public/en-US/404.html @@ -0,0 +1 @@ +404 en-US error fixture diff --git a/vendor/plugins/localized_templates/test/fixtures/public/pt-BR/404.html b/vendor/plugins/localized_templates/test/fixtures/public/pt-BR/404.html new file mode 100644 index 0000000..893b6a2 --- /dev/null +++ b/vendor/plugins/localized_templates/test/fixtures/public/pt-BR/404.html @@ -0,0 +1 @@ +404 pt-BR error fixture diff --git a/vendor/plugins/localized_templates/test/localized_rescue_test.rb b/vendor/plugins/localized_templates/test/localized_rescue_test.rb new file mode 100644 index 0000000..b44fa8e --- /dev/null +++ b/vendor/plugins/localized_templates/test/localized_rescue_test.rb @@ -0,0 +1,42 @@ +require File.dirname(__FILE__) + '/setup' + +class LocalizedRescueController < ActionController::Base + def index + render_optional_error_file params[:id] + end +end + +class LocalizedRescueTest < Test::Unit::TestCase + + def setup + @controller = LocalizedRescueController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + def test_render_optional_error_file_without_localization + I18n.locale = 'en-US' + get :index, :id => 500 + + assert_response 500 + body = File.read("#{FIXTURES_PATH}/public/500.html") + assert_equal body, @response.body + end + + def test_render_optional_error_file_with_localization + I18n.locale = 'en-US' + get :index, :id => 404 + + assert_response 404 + body = File.read("#{FIXTURES_PATH}/public/en-US/404.html") + assert_equal body, @response.body + + I18n.locale = 'pt-BR' + get :index, :id => 404 + + assert_response 404 + body = File.read("#{FIXTURES_PATH}/public/pt-BR/404.html") + assert_equal body, @response.body + end + +end
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/test/localized_templates_test.rb b/vendor/plugins/localized_templates/test/localized_templates_test.rb new file mode 100644 index 0000000..5ae4b1d --- /dev/null +++ b/vendor/plugins/localized_templates/test/localized_templates_test.rb @@ -0,0 +1,60 @@ +require File.dirname(__FILE__) + '/setup' + +class ProjectsController < ActionController::Base + layout 'default' + + def index + respond_to do |format| + format.html { + # + } + format.rss{ + render :layout => false + } + end + end +end + +class LocalizedTemplatesTest < Test::Unit::TestCase + + def setup + @controller = ProjectsController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + def test_render_without_localization + I18n.locale = 'en-US' + get :index + + assert_response 200 + assert_equal "<none>\n none index view\n</none>", @response.body + end + + def test_render_rss_without_localization + I18n.locale = 'pt-BR' + @request.env['CONTENT_TYPE'] = Mime::EXTENSION_LOOKUP['rss'].to_s + get :index + + assert_response 200 + assert_equal "<none>text</none>\n", @response.body + end + + def test_render_with_localization + I18n.locale = 'pt-BR' + get :index + + assert_response 200 + assert_equal "<pt-BR>\n pt-BR index view\n</pt-BR>", @response.body + end + + def test_render_rss_with_localization + I18n.locale = 'en-US' + @request.env['CONTENT_TYPE'] = Mime::EXTENSION_LOOKUP['rss'].to_s + get :index + + assert_response 200 + assert_equal "<en_US>text</en_US>\n", @response.body + end + +end
\ No newline at end of file diff --git a/vendor/plugins/localized_templates/test/setup.rb b/vendor/plugins/localized_templates/test/setup.rb new file mode 100644 index 0000000..d727bc5 --- /dev/null +++ b/vendor/plugins/localized_templates/test/setup.rb @@ -0,0 +1,16 @@ +# Those lines are plugin test settings +ENV['RAILS_ENV'] = 'test' + +require File.dirname(__FILE__) + '/../../../../config/environment' +require File.dirname(__FILE__) + '/../lib/localized_templates.rb' +require 'test_help' + +FIXTURES_PATH = File.join(File.dirname(__FILE__), 'fixtures') +ActionController::Base.view_paths = FIXTURES_PATH +Rails.public_path = "#{FIXTURES_PATH}/public" + +ActionController::Routing::Routes.draw do |map| + map.connect ':controller/:action/:id' +end + +I18n.locale = 'en-US'
\ No newline at end of file |