Skip to content

支持 docstrings ?#105

Open
Gnimuc wants to merge 8 commits into
masterfrom
docstring
Open

支持 docstrings ?#105
Gnimuc wants to merge 8 commits into
masterfrom
docstring

Conversation

@Gnimuc

@Gnimuc Gnimuc commented Jun 26, 2020

Copy link
Copy Markdown
Member

#88 中已经描述的挺清楚了,可以把这个 PR 作为一个 demo,这里为了简化,采用了更直白的 JSON 文件作为文档翻译的载体。

本地化流程与 markdown 文档基本一致,唯一不同之处是,markdown 是利用 Transifex 的自动同步源功能,自动与 Julia repo 进行同步,而 docstrings 是本地提取的,需要手动用 tx push -s 同步。

julia> using JuliaZH
[ Info: Precompiling JuliaZH [652e05fd-ed22-5b6c-bf99-44e63a676e5f]

julia> zh_CN()

help?> sinc
search: sinc sincos sincosd significand isinteractive MissingException CartesianIndices

  sinc(x)

  当 x \neq 0 时,计算 \sin(\pi x) / (\pi x) ,当 x = 0 时,返回 1 。

Comment thread doc/make.jl

using JuliaZH
zh_CN()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Roger-luo Roger-luo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我们可以先merge了试试?反正不影响其它部分的功能。

Comment thread src/docstrings.jl
@@ -0,0 +1,85 @@
using JSON, JSON3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是使用两个JSON库是为什么呢?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最开始想用JSON3的struct mapping,后来发现直接用Dict就行。只用JSON就可以,下面的dump_docstrings的实现调整一下,这是个demo,就懒得改了。

@Roger-luo Roger-luo requested a review from findmyway June 26, 2020 17:10
@Gnimuc

Gnimuc commented Jun 27, 2020

Copy link
Copy Markdown
Member Author

我们可以先merge了试试?反正不影响其它部分的功能。

还有一些事情需要确认:

  • 现在dump的是1.4-release的docstrings,merge的话,要对1.5-release重新dump.
  • 同一个session,docstrings替换只能生效一次,这个问题之前好像讨论过,替换的实现需要调整。
  • Transifex 上可能出现的潜在的docstrings解析问题。
  • dump stdlibs的docstrings。

Comment thread doc/Manifest.toml

[[JuliaZH]]
deps = ["JSON", "JSON3", "REPL"]
path = ".."

@Gnimuc Gnimuc Jun 27, 2020

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是为了在PR中触发docstrings的替换,并在Gitlab Pages中预览,实际上,commit Manifest.toml是非必要的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants