Skip to content

Commit

Permalink
Merge pull request #13 from Tassandar/master
Browse files Browse the repository at this point in the history
提交
  • Loading branch information
RubyChinaTranslation committed Apr 13, 2012
2 parents d25078f + af94f4f commit f9a3e9d
Show file tree
Hide file tree
Showing 37 changed files with 880 additions and 878 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -5,4 +5,4 @@ tags
.lock
/.git*
/.gitignore

/rails-guides/source/CN/google6a3b64c272ed36b0.html
230 changes: 227 additions & 3 deletions README.markdown
@@ -1,6 +1,8 @@
# Ruby on Rails Guides 中文指南

如果你也想为 Ruby on Rails 社区出一份力就从这里开始吧!

http://www.railschina.org/

## Rails Guides 中文

Expand Down Expand Up @@ -37,7 +39,6 @@ Rails Guides 中文用了一些关键字来让你的文章生成更加便捷。

* [textile 语法](http://redcloth.org/textile)

**由于 markdown 没有提供设置 id 的内建语法,生成的目录无法产生链接,我会尽快修复**

##### 概要

Expand Down Expand Up @@ -86,8 +87,225 @@ xxx包括以下关键字:
work_in_progress: true #如果加入这一栏说明你正在更新或者对他进行写作
contributor: ME #这里可以写上你的 github 帐号名
description: 这里是描述
##### 生成

#### 翻译约定
**请大家加入意见**

* 专有名词保持大写:HTML, HAML, SASS, REST...等等。

* 英文及数字夹在中文之间显得薄弱的关系,之间保留 1 格的空格:大家都来翻译 Rails 指南吧,Rails 目前版本为 3.2.2。

* 代码与文字之间保留1格:`` `rvm` 是 Ruby 的版本管控工具。``

由于没有照字母顺序排序的关系,建议你使用浏览器的搜索(`ctrl+F`, `cmd+F`)来寻找名词。

**请大家加入名词**

##### 约定翻译的名词:

<table>
<tr>
<th>原文</th>
<th>中文</th>
</tr>
<tr>
<td>class</td>
<td>类别</td>
</tr>
<tr>
<td>object</td>
<td>对象</td>
</tr>
<tr>
<td>instance</td>
<td>实例</td>
</tr>
<tr>
<td>instantiate</td>
<td>实例化</td>
</tr>
<tr>
<td>instance variable</td>
<td>实例变量</td>
</tr>
<tr>
<td>local variable</td>
<td>局域变数</td>
</tr>
<tr>
<td>inherit</td>
<td>继承</td>
</tr>
<tr>
<td>interface</td>
<td>接口</td>
</tr>
<tr>
<td>library</td>
<td>函式库</td>
</tr>
<tr>
<td>server</td>
<td>服务器</td>
</tr>
<tr>
<td>database</td>
<td>数据库</td>
</tr>
<tr>
<td>(database)table</td>
<td>数据表</td>
</tr>
<tr>
<td>code</td>
<td>代码</td>
</tr>
<tr>
<td>command-line</td>
<td>命令行</td>
</tr>
<tr>
<td>terminal</td>
<td>终端机</td>
</tr>
<tr>
<td>method</td>
<td>方法</td>
</tr>
<tr>
<td>application</td>
<td>应用程序、应用</td>
</tr>
<tr>
<td>framework</td>
<td>框架</td>
</tr>
<tr>
<td>template</td>
<td>模版</td>
</tr>
<tr>
<td>layout</td>
<td>版型</td>
</tr>
<tr>
<td>request</td>
<td>请求</td>
</tr>
<tr>
<td>timestamp</td>
<td>时间戳章</td>
</tr>
<tr>
<td>form</td>
<td>表单</td>
</tr>
<tr>
<td>array</td>
<td>数组</td>
</tr>
<tr>
<td>iterate</td>
<td>迭代</td>
</tr>
<tr>
<td>escaped</td>
<td>逸出</td>
</tr>
<tr>
<td>tag</td>
<td>标签</td>
</tr>
<tr>
<td>attribute</td>
<td>属性</td>
</tr>
<tr>
<td>routing</td>
<td>路由</td>
</tr>
<tr>
<td>collection</td>
<td>集合</td>
</tr>
<tr>
<td>macro</td>
<td>宏</td>
</tr>
</table>

##### 保留不译的名词:

... 基本上 Rails、Ruby 有的特有名词,除了计算机科学中常见的词儿以外,在不造成读者困扰的情况下,尽量保持原汁原味。

<table>
<tr>
<th>原文</th>
<th>说明</th>
</tr>
<tr>
<td>ActiveXXX</td>
<td>比如 ActiveRecord</td>
</tr>
<tr>
<td>resource</td>
<td>资源</td>
</tr>
<tr>
<td>partial</td>
<td>片段的 view</td>
</tr>
<tr>
<td>schema</td>
<td>资料库纲要</td>
</tr>
<tr>
<td>migration</td>
<td>资料库迁移</td>
</tr>
<tr>
<td>REST</td>
<td></td>
</tr>
<tr>
<td>helper</td>
<td>辅助的 Ruby 代码</td>
</tr>
<tr>
<td>scaffold</td>
<td>鹰架</td>
</tr>
<tr>
<td>mock</td>
<td>行为驱动测试用词</td>
</tr>
<tr>
<td>stub</td>
<td>行为驱动测试用词</td>
</tr>
<tr>
<td>param</td>
<td>参数</td>
</tr>
<tr>
<td>Rake</td>
<td>任务</td>
</tr>
<tr>
<td>Cucumber</td>
<td>不是小黄瓜</td>
</tr>
<tr>
<td>validator</td>
<td>验证器</td>
</tr>

</table>




#### 生成

使用命令

Expand Down Expand Up @@ -137,3 +355,9 @@ https://github.com/lifo/docrails
![Creative Commons License](http://i.creativecommons.org/l/by-nc-sa/2.5/cn/88x31.png)

有什么问题可以联系我<mailto:cool.zhikai@gmail.com>.






Binary file added assets/images/icons/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions config/deploy.rb
@@ -1,8 +1,8 @@
set :application, "RailsGuides"
set :domain, "railschina.org"
set :domain, "www.railschina.org"
set :use_sudo, false
set :user, "ruby"
set :version, "v3.2.2"
set :version, "v3.2.3"
set :repository, "./output"
set :scm, :none

Expand Down
6 changes: 3 additions & 3 deletions source/CN/_feedback.html.erb
Expand Up @@ -3,11 +3,11 @@
你也可以为 Rails Guides 中文做出贡献.
</p>
<p>
如果你发现了任何翻译上的错误或者不足.请到<%= link_to 'GitHub帐号','http://github.com/RubyChinaTranslation/rails-guides-china'%> clone 并且 fork 一份进行更正提交,我们会很快做出回应。
如果你发现了任何翻译上的错误或者不足.请到<%= link_to 'GitHub帐号','https://github.com/ruby-china/rails-guides/'%> clone 并且 fork 一份进行更正提交,我们会很快做出回应。
如果你发现了任何代码上的bug或者不足,你可以到<%= link_to 'docrails', 'https://github.com/lifo/docrails' %> 进行反馈与更正。
如果你发现了某一篇文章已经过时了并且并没有做出相应的提示,你也同样可以在<%= link_to '这里','http://github.com/rubychinatranslation/rails-guides-china/issues' %>上发起一个请求来提醒我们。
如果你发现了某一篇文章已经过时了并且并没有做出相应的提示,你也同样可以在<%= link_to '这里','https://github.com/ruby-china/rails-guides/issues' %>上发起一个请求来提醒我们。
</p>
<p> 如果对rails有什么建议的话去这里<%= link_to 'open an issue for rails', 'https://github.com/rails/rails/issues'%>. </p>
<p> 如果对rails有什么建议的话去这里<%= link_to 'open an issue for rails', 'https://github.com/rails/rails/issues/'%>. </p>
<p>当然你不管你有什么想要说的都可以发到 <%= link_to 'ruby china社区','http://ruby-china.org' %> 讨论或者<%= mail_to "cool.zhikai@gmail.com","mail我"%>.欢迎加入到Ruby on Rails 社区!</p>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions source/CN/_welcome.html.erb
Expand Up @@ -5,7 +5,7 @@
这是一个 <b>Edge Guides</b>, 基於 <a href="https://github.com/rails/rails/tree/<%= @version %>">master</a> 分支.
</p>
<p>
如果你需要的是一个稳定版的文档,你可以参见 <a href="#">这里</a>
如果你需要的是一个稳定版的文档,你可以参见 <a href="www.railschina.org">这里</a>
</p>
<% else %>
<p>
Expand All @@ -17,5 +17,5 @@
你能在这里找到官方的原版<a href="http://guides.rubyonrails.org"> Rails Guide </a> .
</p>
<p>
Ruby on Rails Guides 中文需要热心的你,<a href="rails_guides_contribute_rules.html">加入翻译</a>或者<a href="http://github.com/rubychinatranslation/rails-guides-china/issues">建议</a>.
Ruby on Rails Guides 中文需要热心的你,<a href="https://github.com/ruby-china/rails-guides/wiki/_pages">加入翻译</a>或者<a href="https://github.com/ruby-china/rails-guides/issues">建议</a>.
</p>
26 changes: 13 additions & 13 deletions source/CN/action_mailer_basics.textile
@@ -1,22 +1,22 @@
h2. Action Mailer Basics

This guide should provide you with all you need to get started in sending and receiving emails from and to your application, and many internals of Action Mailer. It also covers how to test your mailers.
本教程将告诉你如何让你的应用程序可以发送和接收邮件,还有 Action Mailer 的一些内部原理。 同时也包括如何编写 Mailer 的测试。

endprologue.

WARNING. This Guide is based on Rails 3.0. Some of the code shown here will not work in earlier versions of Rails.
警告. 本教程是基于 Rails 3.0 , 一些代码可能无法在旧版本的 Rails 中运行。

h3. Introduction
h3. 简介

Action Mailer allows you to send emails from your application using a mailer model and views. So, in Rails, emails are used by creating mailers that inherit from +ActionMailer::Base+ and live in +app/mailers+. Those mailers have associated views that appear alongside controller views in +app/views+.
Action Mailer 让你的应用可以用一个 mailer model views 来发送邮件。所以,在 Rails 里面,邮件是通过一个继承至 +ActionMailer::Base+ 的 mailer 来创建的,并存放在 +app/mailers+ 目录下面。这些 mailer 将依靠在 +app/views+ 目录下面对应名称的 view 来生成。

h3. Sending Emails
h3. 发送邮件

This section will provide a step-by-step guide to creating a mailer and its views.
本节将一步一步的教你创建一个 mailer 和它对应的 views

h4. Walkthrough to Generating a Mailer
h4. 生成一个 Mailer

h5. Create the Mailer
h5. 创建 Mailer

<shell>
$ rails generate mailer UserMailer
Expand All @@ -27,19 +27,19 @@ invoke test_unit
create test/functional/user_mailer_test.rb
</shell>

So we got the mailer, the views, and the tests.
现在就有了一个 mailer, 还有它的 view 和 test 文件.

h5. Edit the Mailer
h5. 修改 Mailer

+app/mailers/user_mailer.rb+ contains an empty mailer:
+app/mailers/user_mailer.rb+ 里面有个空的 mailer:

<ruby>
class UserMailer < ActionMailer::Base
default :from => "from@example.com"
end
</ruby>

Let's add a method called +welcome_email+, that will send an email to the user's registered email address:
让我们来添加一个叫 +welcome_email+ 的方法, 它将用于发送用户注册成功的邮件:

<ruby>
class UserMailer < ActionMailer::Base
Expand All @@ -48,7 +48,7 @@ class UserMailer < ActionMailer::Base
def welcome_email(user)
@user = user
@url = "http://example.com/login"
mail(:to => user.email, :subject => "Welcome to My Awesome Site")
mail(:to => user.email, :subject => "欢迎来到某某网站")
end
end
</ruby>
Expand Down

0 comments on commit f9a3e9d

Please sign in to comment.