Skip to content

Commit

Permalink
Merge pull request #66 from baidu/feature-i18n
Browse files Browse the repository at this point in the history
英文翻译
  • Loading branch information
errorrik authored Oct 18, 2018
2 parents 9265fbf + 0b03934 commit 8ab5de9
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 73 deletions.
41 changes: 41 additions & 0 deletions source/_posts/en/doc/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Component API
categories:
- doc
---

This document describes components API, the San module API
please refer to [San API](../../doc/main-members/).


Initialization Arguments
-------

### data

`Explanation`

Initialization Data. Can be used for [component reverse](../../tutorial/reverse/).


`Type`: Object


`Usage`

```javascript
var MyComponent = san.defineComponent({});

var myComponent = new MyComponent({
el: document.getElementById('my-label'),
data: {
email: 'errorrik@gmail.com',
name: 'errorrik'
}
});

/* html:
<label id="my-label">
<span title="errorrik@gmail.com" prop-title="{{email}}">errorrik</span>
</label>
```
2 changes: 2 additions & 0 deletions source/en/index.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
layout: index
---
5 changes: 5 additions & 0 deletions themes/san/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ menu:
Archives: /archives
rss: /atom.xml

# i18n
language:
- zh-cn
- en

# Content
excerpt_link: Read More
fancybox: true
Expand Down
19 changes: 0 additions & 19 deletions themes/san/languages/default.yml

This file was deleted.

8 changes: 8 additions & 0 deletions themes/san/languages/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
index:
nav:
features: Features
resources: Resources
facilities: Facilities
practice:
data:
title: Data
27 changes: 8 additions & 19 deletions themes/san/languages/zh-CN.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
categories: 分类
search: 搜索
tags: 标签
tagcloud: 标签云
tweets: 推文
prev: 上一页
next: 下一页
comment: 留言
archive_a: 归档
archive_b: 归档:%s
page: 第 %d 页
recent_posts: 最新文章
newer: Newer
older: Older
share: Share
powered_by: Powered by
rss_feed: RSS Feed
category: Category
tag: Tag
index:
nav:
features: 特性
resources: 资料
facilities: 周边
practice:
data:
title: 数据
19 changes: 0 additions & 19 deletions themes/san/languages/zh-TW.yml

This file was deleted.

30 changes: 15 additions & 15 deletions themes/san/layout/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ layout: false

<body id="home">
<div class="overlay">
<img height="220" src="img/logo-colorful.svg" class="logo" alt="LOGO" title="San">
<img height="220" src="/san/img/logo-colorful.svg" class="logo" alt="LOGO" title="San">
<h1>San</h1>
<iframe src="https://ghbtns.com/github-btn.html?user=baidu&repo=san&type=star&count=true&size=large" class="home-iframe"></iframe>
<p class="overlay-p">A Flexible JavaScript Component Framework</p>
Expand All @@ -17,14 +17,14 @@ layout: false
<nav class="navbar-default" role="navigation">
<div class="navbar-container">

<a href="#home"><img class="nav-logo" src="img/logo2.png"></a>
<a href="#home"><img class="nav-logo" src="/san/img/logo2.png"></a>


<div class="navbar-right">
<ul class="nav navbar-nav">
<li><a class="nav-a1" href="#Features">特性</a></li>
<li><a class="nav-a2" href="#Resources">资料</a></li>
<li><a class="nav-a3" href="#Facilities">周边</a></li>
<li><a class="nav-a1" href="#Features"><%= __('index.nav.features') %></a></li>
<li><a class="nav-a2" href="#Resources"><%= __('index.nav.resources') %></a></li>
<li><a class="nav-a3" href="#Facilities"><%= __('index.nav.facilities') %></a></li>
</ul>
</div>

Expand All @@ -39,59 +39,59 @@ layout: false

<div class="feature-row">
<div class="feature-item">
<img src="img/8.svg" width="44" height="44">
<img src="/san/img/8.svg" width="44" height="44">
<h5>HTML模版</h5>
<p>声明式的模板,在编写视图时就像是在写一个普通的页面,更符合 HTML 开发人员的习惯。</p>
</div>
<div class="feature-item">
<img src="img/1.svg" width="44" height="44">
<img src="/san/img/1.svg" width="44" height="44">
<h5>数据驱动</h5>
<p>修改数据,视图引擎会根据绑定关系自动刷新视图,从此摆脱手工调用 DOM API 的繁琐与可能的遗漏。</p>
</div>
<div class="feature-item">
<img src="img/2.svg" width="44" height="44">
<img src="/san/img/2.svg" width="44" height="44">
<h5>组件化</h5>
<p>组件是数据、逻辑与视图的聚合体。通过组件,我们封装独立的功能区块,小到输入组合,大到一个页面。</p>
</div>
</div>

<div class="feature-row">
<div class="feature-item">
<img src="img/3.svg" width="44" height="44">
<img src="/san/img/3.svg" width="44" height="44">
<h5>高性能视图</h5>
<p>通过修改数据的方法,视图引擎能够直接刷新需要变更的视图区域,无需进行任何检测,性能更高。</p>
</div>
<div class="feature-item">
<img src="img/5.svg" width="44" height="44">
<img src="/san/img/5.svg" width="44" height="44">
<h5>组件反解</h5>
<p>为首屏时间优化,服务端通常直接输出HTML。我们能从现有的元素中反向解析出组件,并构建绑定关系。</p>
</div>
<div class="feature-item">
<img src="img/4.svg" width="44" height="44">
<img src="/san/img/4.svg" width="44" height="44">
<h5>体积小巧</h5>
<p>13k (gzipped) 的体积,无需担心对页面下载带来负担。体积强迫症患者的福音。</p>
</div>
</div>

<div class="feature-row">
<div class="feature-item">
<img src="img/9.svg" width="44" height="44">
<img src="/san/img/9.svg" width="44" height="44">
<h5>良好的兼容性</h5>
<p>通过方法修改数据的另一好处是,可以获得更好的浏览器兼容性。毕竟有时我们产品的受众用户有点死板。</p>
</div>
<div class="feature-item">
<img src="img/6.svg" width="44" height="44">
<img src="/san/img/6.svg" width="44" height="44">
<h5>模块管理自由</h5>
<p>项目中可以任意选择 ESNext Module 或 AMD 管理模块。当然,如果你想要用全局变量也是支持的。</p>
</div>
<div class="feature-item">
<img src="img/7.svg" width="44" height="44">
<img src="/san/img/7.svg" width="44" height="44">
<h5>引用方便</h5>
<p>支持多种引用方式:NPM、GitHub、下载、HTTP 与 HTTPS CDN,让开发和线上引用更便利。</p>
</div>
</div>
</section>
<img src="img/san-perf.png" class="san-perf">
<img src="/san/img/san-perf.png" class="san-perf">
</div>

<!--Resources -->
Expand Down
2 changes: 1 addition & 1 deletion themes/san/layout/practice.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<main class="practice">
<input type="text" id="practice-search">
<dl id="practice-list">
<dt>数据</dt>
<dt><%= __('practice.data.title') %></dt>
<dd><a href="<%- url_for('practice/data-valid/') %>">什么东西可以保存在 data 里?</a></dd>
<dd><a href="<%- url_for('practice/data-invalid/') %>">什么东西不要保存在 data 里?</a></dd>
<dd><a href="<%- url_for('practice/auto-camel/') %>">data bind 时的 auto camel</a></dd>
Expand Down

0 comments on commit 8ab5de9

Please sign in to comment.