Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 13, 2016
2 parents d1bcb10 + 6fc6bd2 commit 9b82f3e
Show file tree
Hide file tree
Showing 6 changed files with 243 additions and 303 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# translater.js

[![](https://jaywcjlove.github.io/sb/ico/npm.svg)](https://www.npmjs.com/package/translater.js) [![](http://jaywcjlove.github.io/sb/ico/gulp-build-with.svg)](#) [![](http://jaywcjlove.github.io/sb/status/no-dependencies.svg)](#) [![](http://jaywcjlove.github.io/sb/status/stable.svg)](#) [![](https://jaywcjlove.github.io/sb/license/mit.svg)](#)
[![](https://jaywcjlove.github.io/sb/ico/npm.svg)](https://www.npmjs.com/package/translater.js) [![](http://jaywcjlove.github.io/sb/status/no-dependencies.svg)](#) [![](http://jaywcjlove.github.io/sb/status/stable.svg)](#) [![](https://jaywcjlove.github.io/sb/license/mit.svg)](#)

这是一个利用HTML注释的页面翻译解决方案。对于少量的静态页面,这种解决方案显得更简单。它没有依赖,压缩只有只有(~2kb)。

Expand Down Expand Up @@ -59,3 +59,15 @@ http://127.0.0.1:9005/test/test.html?lang=jp
```html
<img alt="images" src="../img/image.jpg" data-lang-cn="../img/image_cn.jpg" data-lang-jp="../img/image_jp.jpg" />
```


## getLang/setLang

获取或设置当前语言。

```html
<script type="text/javascript">
var tran = new Translater();
if (tran.getLang() === "default") tran.setLang('en');
</script>
```
Loading

0 comments on commit 9b82f3e

Please sign in to comment.