Add website locales

This commit is contained in:
Rei
2014-02-23 21:40:20 +08:00
parent a43f3b4c8e
commit b14455fb81
21 changed files with 240 additions and 65 deletions

View File

@@ -7,18 +7,19 @@
.markdown-area
ul.nav.nav-tabs
li.active
a href="##{write_pane_id}" data-toggle="tab" Write
a href="##{write_pane_id}" data-toggle="tab"
= t '.write'
li
a href="##{preview_pane_id}" data-toggle="tab" data-behaviors="preview" Preview
a href="##{preview_pane_id}" data-toggle="tab" data-behaviors="preview"
= t '.preview'
.tab-content
.tab-pane.active id=write_pane_id
= form.text_area name, class: 'form-control', placeholder: 'Type here...', data: { behaviors: 'autosize' }, tabIndex: tabIndex
= form.text_area name, class: 'form-control', data: { behaviors: 'autosize' }, tabIndex: tabIndex
.file-upload
= file_field_tag :file, multiple: true
.text.text-muted
| Attach images by
= t '.attach_images_by'
'
a selecting them
| .
a = t '.select_them'
.tab-pane id=preview_pane_id
article.preview

View File

@@ -3,16 +3,19 @@
.panel
.panel-body
.btn-group
a.btn.btn-default href=mark_notifications_path data-remote="true" data-method="post" Mark all as read
a.btn.btn-default href=mark_notifications_path data-remote="true" data-method="post"
= t '.mark_all_as_read'
a.btn.btn-default.dropdown-toggle data-toggle="dropdown"
i.fa.fa-caret-down
ul.dropdown-menu
li
a href=clear_notifications_path data-remote="true" data-method="delete" data-confirm="Are you sure you want to clear notifications?" Delete all notifications
a href=clear_notifications_path data-remote="true" data-method="delete" data-confirm=t('.are_you_sure_you_want_to_delete_all_notifications')
= t '.delete_all_notification'
.col-md-9.col-md-pull-3
.panel.panel-campo
.panel-heading
h3.panel-title Notifications
h3.panel-title
= t '.notifications'
.panel-body
ul.list-group.list-group-campo
- @notifications.each do |notification|

View File

@@ -11,7 +11,7 @@ li.list-group-item.notification id="notification_#{notification.id}" class=('rea
.list-group-item-heading
b = comment.user.name
'
| commented on
= t '.commented on'
'
b = comment_title(comment)
'

View File

@@ -11,7 +11,7 @@ li.list-group-item.notification id="notification_#{notification.id}" class=('rea
.list-group-item-heading
b = comment.user.name
'
| mentioned you on
= t '.mentioned you on'
'
b = comment_title(comment)
'

View File

@@ -3,7 +3,7 @@
.panel.panel-campo
.panel-heading
h3.panel-title
| Sign in
= t '.sign_in'
.panel-body
= form_tag login_path
= render 'share/flash_messages'
@@ -13,4 +13,4 @@
.form-group
= label_tag :password
= password_field_tag :password, nil, placeholder: 'Your password', tabindex: 4, class: 'form-control'
= submit_tag 'Sign in', class: 'btn btn-success', tabindex: 5
= submit_tag t('.sign_in'), class: 'btn btn-success', tabindex: 5

View File

@@ -4,19 +4,19 @@
- if subscription.nil?
i.fa.fa-eye
'
| Watch
= t '.watch'
'
i.fa.fa-caret-down
- elsif subscription.subscribed?
i.fa.fa-eye-slash
'
| Unwatch
= t '.unwatch'
'
i.fa.fa-caret-down
- elsif subscription.ignored?
i.fa.fa-ban
'
| Stop ignoring
= t '.stop_ignoring'
'
i.fa.fa-caret-down
ul.dropdown-menu.dropdown-menu-subscription
@@ -25,20 +25,19 @@
.subscription-status
i.fa.fa-check
.subscription-description
label Not Watching
p You only receive notifications if you are @mentioned
label = t '.not_watching'
p = t '.you_only_receive_notifications_if_you_are_mentioned'
li class=('selected' if subscription && subscription.subscribed?)
a href=polymorphic_url([subscribable, :subscription], status: 'subscribed') data-remote="true" data-method="put"
.subscription-status
i.fa.fa-check
.subscription-description
label Watching
p You will receive notifications for all comments.
label = t '.watching'
p = t '.you_will_receive_notifications_for_all_comments'
li class=('selected' if subscription && subscription.ignored?)
a href=polymorphic_url([subscribable, :subscription], status: 'ignored') data-remote="true" data-method="put"
.subscription-status
i.fa.fa-check
.subscription-description
label Ignoring
p You do not receive any notifications.
label = t '.ignoring'
p = t '.you_do_not_receive_any_notifications'

View File

@@ -5,13 +5,13 @@
= f.text_field :title, class: 'form-control', placeholder: 'Title', tabIndex: 1
.col-md-3
.form-group
= f.collection_select :category_id, Category.order(topics_count: :desc), :id, :name, { prompt: 'No category' }, class: 'form-control', tabIndex: 2
= f.collection_select :category_id, Category.order(topics_count: :desc), :id, :name, { prompt: t('.no_category') }, class: 'form-control', tabIndex: 2
.form-group
= markdown_area f, :body, tabIndex: 3
- if topic.new_record?
= f.submit 'Add this topic', class: 'btn btn-success', tabIndex: 4
= f.submit t('.create_topic'), class: 'btn btn-success', tabIndex: 4
- else
= f.submit 'Save changes', class: 'btn btn-success', tabIndex: 4
= f.submit t('.save_changes'), class: 'btn btn-success', tabIndex: 4
'
a.btn.btn-default href=topic_path(@topic) tabIndex="5" Cancel

View File

@@ -2,7 +2,7 @@
.panel-body
= form_tag search_topics_path, method: 'get', class: 'search-form', data: { behaviors: 'turboform' } do
.input-group
= text_field_tag :q, params[:q], class: 'form-control', placeholder: 'Search', tabIndex: 1, autocomplete: 'off', autofocus: params[:q].present?
= text_field_tag :q, params[:q], class: 'form-control', placeholder: t('.search'), tabIndex: 1, autocomplete: 'off', autofocus: params[:q].present?
.input-group-btn
button.btn.btn-default type='submit' tabIndex="2"
i.fa.fa-search

View File

@@ -12,6 +12,7 @@
li
a href=topic_path(@topic)
= @topic.title
li.active Edit
li.active
= t '.edit'
.panel-body
= render 'form', topic: @topic

View File

@@ -6,22 +6,22 @@
ul.nav.nav-pills
li class=('active' if params[:tab] == 'hot')
a href=url_for(tab: 'hot')
| Hot
= t '.hot'
li class=('active' if params[:tab] == 'newest')
a href=url_for(tab: 'newest')
| Newest
= t '.newest'
- if @category
ol.breadcrumb.panel-title
li
a href=topics_path Topics
li.active = @category.name
- else
h3.panel-title Topics
h3.panel-title = t '.topics'
.panel-body
.list-group.list-group-campo
- if @topics.empty?
.list-group-item.text-center.text-muted.empty-message
| No topic yet.
= t '.no_topic_yet'
- else
= render @topics
- if @topics.total_pages > 1
@@ -32,7 +32,8 @@
= render 'sidebar_search'
.panel.panel-campo
.panel-body
a.btn.btn-success.btn-block href=new_topic_path(category_id: @category.try(:slug)) Create Topic
a.btn.btn-success.btn-block href=new_topic_path(category_id: @category.try(:slug))
= t '.new_topic'
.panel.panel-campo
.panel-body
@@ -40,7 +41,7 @@
li class=('active' unless @category)
a href=topics_path
span.pull-right = Topic.no_trashed.count
| All topics
= t '.all_topics'
- Category.order(topics_count: :desc).each do |category|
li class=('active' if @category == category)
a href=categoried_topics_path(category_id: category.slug)

View File

@@ -9,7 +9,8 @@
li
a href=categoried_topics_path(category_id: @topic.category.slug)
= @topic.category.name
li.active New Topic
li.active
= t '.new'
.panel-body
= render 'form', topic: @topic

View File

@@ -4,7 +4,8 @@
.panel-heading
ol.breadcrumb.panel-title
li
a href=topics_path Topics
a href=topics_path
= t '.topics'
- if @topic.category
li
a href=categoried_topics_path(category_id: @topic.category.slug)
@@ -36,17 +37,18 @@
= @topic.likes_count
a.btn data-visible-to="creator" href=edit_topic_path(@topic)
i.fa.fa-pencil
a.btn data-visible-to="creator" href=trash_topic_path(@topic) data-remote="true" data-method="delete" data-confirm="Are you sure you want to delete this topic?"
a.btn data-visible-to="creator" href=trash_topic_path(@topic) data-remote="true" data-method="delete" data-confirm=t('.are_you_sure_you_want_to_delete_this_topic')
i.fa.fa-trash-o
.panel.panel-campo#comments
.panel-heading
h3.panel-title Comments
h3.panel-title
= t '.comments'
.panel-body
ul.list-group.list-group-campo id="comments-for-topic-#{@topic.id}"
- if @comments.empty?
li.list-group-item.text-center.text-muted.empty-message
| No comment yet.
= t '.no_comment_yet'
- else
= render @comments
- if @comments.total_pages > 1
@@ -66,17 +68,17 @@
= form_for @topic.comments.new, url: topic_comments_path(@topic), remote: true do |f|
.form-group
= markdown_area f, :body
= f.submit 'Add this comment', class: 'btn btn-success', tabIndex: 2
= f.submit t('.add_this_comment'), class: 'btn btn-success', tabIndex: 2
- else
| Your account is locked.
= t '.your_account_had_been_locked'
- else
| Need
'
a href=login_path Login
'
| or
= t '.or'
'
a href=signup_path Sign up
'
= t '.to_comment'
.col-md-3
- if login?
.panel.panel-campo
@@ -85,7 +87,7 @@
.panel.panel-campo
.panel-heading
h4.panel-title
| Relate topics
= t '.related_topics'
.panel-body
.list-group.list-group-campo
- more_like_this_topics = @topic.more_like_this.limit(5).records
@@ -95,8 +97,7 @@
= topic.title
- else
.list-group-item.text-center.text-muted
| No more topics
= t '.no_more_topics'
- if login?
- if @topic.liked_by?(current_user)

View File

@@ -11,4 +11,4 @@
.panel-footer.clearfix
.pull-right
a.btn.btn-default href=settings_profile_path
| Edit profile
= t '.edit_profile'

View File

@@ -2,8 +2,11 @@
.panel-body
ul.nav.nav-pills.nav-stacked
li class=('active' if controller_name == 'topics')
a href=user_topics_path(username: user.username) Topics
a href=user_topics_path(username: user.username)
= t '.topics'
li class=('active' if controller_name == 'comments')
a href=user_comments_path(username: user.username) Comments
a href=user_comments_path(username: user.username)
= t '.comments'
li class=('active' if controller_name == 'likes')
a href=user_likes_path(username: user.username) Likes
a href=user_likes_path(username: user.username)
= t '.likes'

View File

@@ -3,12 +3,13 @@
= render 'users/profile', user: @user
#comments.panel.panel-campo
.panel-heading
h3.panel-title Comments
h3.panel-title
= t '.comments'
.panel-body
.list-group.list-group-campo
- if @comments.empty?
.list-group-item.text-center.text-muted.empty-message
| No comment yet.
= t '.no_comment_yet'
- else
= render @comments
- if @comments.total_pages > 1

View File

@@ -3,12 +3,13 @@
= render 'users/profile', user: @user
#likes.panel.panel-campo
.panel-heading
h3.panel-title Likes
h3.panel-title
= t '.likes'
.panel-body
ul.list-group.list-group-campo data-creator-id=@user.id
- if @likes.empty?
li.list-group-item.text-center.text-muted.empty-message
| No like yet.
= t '.no_like_yet'
- else
- @likes.each do |like|
= render "users/likes/like/#{like.likeable_type.downcase}", like: like

View File

@@ -3,7 +3,7 @@
.panel.panel-campo
.panel-heading
h3.panel-title
| Sign up
= t '.sign_up'
.panel-body
= form_for @user, html: { id: 'new-user-form' } do |f|
= render 'share/form_error_messages', form: f
@@ -19,7 +19,7 @@
.form-group
= f.label :password, class: 'control-label'
= f.password_field :password, placeholder: 'Create a password', tabindex: 4, class: 'form-control'
= f.submit 'Create Account', class: 'btn btn-success', tabindex: 5
= f.submit t('create_account'), class: 'btn btn-success', tabindex: 5
javascript:
$('#new-user-form').validate({

View File

@@ -3,12 +3,13 @@
= render 'users/profile', user: @user
#topics.panel.panel-campo
.panel-heading
h3.panel-title Topics
h3.panel-title
= t '.topics'
.panel-body
.list-group.list-group-campo
- if @topics.empty?
.list-group-item.text-center.text-muted.empty-message
| No topic yet.
= t '.no_topic_yet'
- else
= render partial: 'topics/topic', collection: @topics
- if @topics.total_pages > 1

View File

@@ -1,5 +1,6 @@
---
en:
create_account: Create account
layouts:
application:
likes: Likes
@@ -8,3 +9,83 @@ en:
sign_in: Sign in
sign_up: Sign up
topics: Topics
markdown:
area:
attach_images_by: Attach images by
preview: Preview
select_them: Select them
write: Write
notifications:
index:
are_you_sure_you_want_to_delete_all_notifications: Are you sure you want to
delete all notifications
delete_all_notification: Delete all notification
mark_all_as_read: Mark all as read
notifications: Notifications
sessions:
new:
sign_in: Sign in
subscriptions:
subscription:
ignoring: Ignoring
not_watching: Not watching
stop_ignoring: Stop ignoring
unwatch: Unwatch
watch: Watch
watching: Watching
you_do_not_receive_any_notifications: You do not receive any notifications
you_only_receive_notifications_if_you_are_mentioned: You only receive notifications
if you are mentioned
you_will_receive_notifications_for_all_comments: You will receive notifications
for all comments
topics:
edit:
edit: Edit
form:
create_topic: Create topic
no_category: No category
save_changes: Save changes
index:
all_topics: All topics
hot: Hot
new_topic: New topic
newest: Newest
no_topic_yet: No topic yet
topics: Topics
new:
new: New
show:
add_this_comment: Add this comment
are_you_sure_you_want_to_delete_this_topic: Are you sure you want to delete
this topic?
comments: Comments
no_comment_yet: No comment yet
no_more_topics: No more topics
or: Or
related_topics: Related topics
to_comment: To comment
topics: Topics
your_account_had_been_locked: Your account had been locked
sidebar_search:
search: Search
users:
comments:
index:
comments: Comments
no_comment_yet: No comment yet
likes:
index:
likes: Likes
no_like_yet: No like yet
new:
sign_up: Sign up
profile:
edit_profile: Edit profile
sidebar:
comments: Comments
likes: Likes
topics: Topics
topics:
index:
no_topic_yet: No topic yet
topics: Topics

View File

@@ -1,10 +1,87 @@
---
zh-CN:
create_account: "创建帐号"
layouts:
application:
likes: 收藏
logout: 退出
settings: 设置
sign_in: 登录
sign_up: 注册
topics: 话题
likes: "收藏"
logout: "退出"
settings: "设置"
sign_in: "登录"
sign_up: "注册"
topics: "话题"
markdown:
area:
attach_images_by: "添加图片"
preview: "预览"
select_them: "选择文件"
write: "编辑"
notifications:
index:
are_you_sure_you_want_to_delete_all_notifications: "你确定要删除所有通知吗?"
delete_all_notification: "删除所有通知"
mark_all_as_read: "标记所有为已读"
notifications: "通知"
sessions:
new:
sign_in: "登录"
subscriptions:
subscription:
ignoring: "忽略"
not_watching: "未关注"
stop_ignoring: "停止忽略"
unwatch: "不关注"
watch: "关注"
watching: "关注中"
you_do_not_receive_any_notifications: "你不会收到任何通知"
you_only_receive_notifications_if_you_are_mentioned: "你只会在被提及的时候收到通知"
you_will_receive_notifications_for_all_comments: "每当有新评论时你都会收到通知"
topics:
edit:
edit: "编辑"
form:
create_topic: "创建话题"
no_category: "不分类"
save_changes: "保存修改"
index:
all_topics: "所有话题"
hot: "热门"
new_topic: "新话题"
newest: "最新"
no_topic_yet: "还没有话题"
topics: "话题"
new:
new: "新建"
show:
add_this_comment: "添加评论"
are_you_sure_you_want_to_delete_this_topic: "确认删除这个话题?"
comments: "评论"
no_comment_yet: "还没有评论"
no_more_topics: "没有更多话题"
or: "或"
related_topics: "相关话题"
to_comment: "后发表评论"
topics: "话题"
your_account_had_been_locked: "你的帐号已被锁定"
sidebar_search:
search: '搜索'
users:
comments:
index:
comments: "评论"
no_comment_yet: "还没有评论"
likes:
index:
likes: "收藏"
no_like_yet: "还没有收藏"
new:
sign_up: "注册"
profile:
edit_profile: "编辑个人资料"
sidebar:
comments: "评论"
likes: "收藏"
topics: "话题"
topics:
index:
no_topic_yet: "还没有话题"
topics: "话题"

4
lib/tasks/i18n.rake Normal file
View File

@@ -0,0 +1,4 @@
namespace :i18n do
desc 'update locales, remove unused'
task :update => ['i18n:add_missing', 'i18n:fill:blanks', 'i18n:remove_unused']
end