Skip to content

Commit

Permalink
Merge pull request #544 from yukinarit/add-japanese-translation
Browse files Browse the repository at this point in the history
Add mdbook project for Japanese translation
  • Loading branch information
yukinarit authored Jun 10, 2024
2 parents b564f3f + a3cc4cd commit 55df223
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ docs:
mkdir -p docs out/api out/guide/en
$(POETRY) run pdoc -e serde=https://github.com/yukinarit/pyserde/tree/main/serde/ serde -o out/api
mdbook build -d ../../out/guide/en ./docs/en
mdbook build -d ../../out/guide/ja ./docs/ja

open-docs:
$(POETRY) run pdoc -e serde=https://github.com/yukinarit/pyserde/tree/main/serde serde
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<a href = "https://piptrends.com/package/pyserde" alt = "pyserde Downloads Last Month"><img alt="pyserde Downloads Last Month by pip Trends" src="https://assets.piptrends.com/get-last-month-downloads-badge/pyserde.svg"></a>
</p>
<p align="center">
<a href="https://yukinarit.github.io/pyserde/guide/en">Guide</a> | <a href="https://yukinarit.github.io/pyserde/api/serde.html">API Docs</a> | <a href="https://github.com/yukinarit/pyserde/tree/main/examples">Examples</a>
<a href="https://yukinarit.github.io/pyserde/guide/en">Guide🇬🇧</a> | <a href="https://yukinarit.github.io/pyserde/guide/ja">ガイド🇯🇵</a> | <a href="https://yukinarit.github.io/pyserde/api/serde.html">API Docs</a> | <a href="https://github.com/yukinarit/pyserde/tree/main/examples">Examples</a>
</p>

## Overview
Expand Down
2 changes: 1 addition & 1 deletion docs/en/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ title = "pyserde documentation"

[output.html]
git-repository-url = "https://github.com/yukinarit/pyserde"
edit-url-template = "https://github.com/yukinarit/pyserde/edit/main/{path}"
edit-url-template = "https://github.com/yukinarit/pyserde/edit/main/en/{path}"
13 changes: 13 additions & 0 deletions docs/ja/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Summary

- [Introduction](introduction.md)
- [Getting Started](getting-started.md)
- [Data Formats](data-formats.md)
- [Types](types.md)
- [Decorators](decorators.md)
- [Class Attributes](class-attributes.md)
- [Field Attributes](field-attributes.md)
- [Union](union.md)
- [Type Checking](type-check.md)
- [Extension](extension.md)
- [FAQ](faq.md)
10 changes: 10 additions & 0 deletions docs/ja/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[book]
authors = ["yukinarit"]
language = "ja"
multilingual = true
src = "./"
title = "pyserde documentation"

[output.html]
git-repository-url = "https://github.com/yukinarit/pyserde"
edit-url-template = "https://github.com/yukinarit/pyserde/edit/main/ja/{path}"
Empty file added docs/ja/class-attributes.md
Empty file.
Empty file added docs/ja/data-formats.md
Empty file.
Empty file added docs/ja/decorators.md
Empty file.
Empty file added docs/ja/extension.md
Empty file.
Empty file added docs/ja/faq.md
Empty file.
Empty file added docs/ja/field-attributes.md
Empty file.
Empty file added docs/ja/getting-started.md
Empty file.
27 changes: 27 additions & 0 deletions docs/ja/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Introduction

`pyserde`[dataclasses](https://docs.python.org/3/library/dataclasses.html)ベースのシンプルで強力なシリアライゼーションライブラリです。

クラスに`@serde`デコレータを付けるだけで、クラスを様々なデータフォーマットに変換可能になります。

```python
@serde
class Foo:
i: int
s: str
f: float
b: bool
```

`Foo`クラスは以下のようにJSONにシリアライズ出来るようになります。

```python
>>> to_json(Foo(i=10, s='foo', f=100.0, b=True))
'{"i":10,"s":"foo","f":100.0,"b":true}'
```

また、JSONから`Foo`クラスにデシリアライズも出来るようになります。
```python
>>> from_json(Foo, '{"i": 10, "s": "foo", "f": 100.0, "b": true}')
Foo(i=10, s='foo', f=100.0, b=True)
```
Empty file added docs/ja/type-check.md
Empty file.
Empty file added docs/ja/types.md
Empty file.
Empty file added docs/ja/union.md
Empty file.

0 comments on commit 55df223

Please sign in to comment.