Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持 docstrings ? #105

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

支持 docstrings ? #105

wants to merge 8 commits into from

Conversation

Gnimuc
Copy link
Member

@Gnimuc Gnimuc commented Jun 26, 2020

#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 。

@@ -11,6 +11,9 @@ using Documenter, DocumenterLaTeX
include("../contrib/HTMLWriter.jl")
include("../contrib/LaTeXWriter.jl")

using JuliaZH
zh_CN()

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@Roger-luo Roger-luo left a comment

Choose a reason for hiding this comment

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

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

@@ -0,0 +1,85 @@
using JSON, JSON3
Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
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
Copy link
Member Author

Gnimuc commented Jun 27, 2020

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

还有一些事情需要确认:

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


[[JuliaZH]]
deps = ["JSON", "JSON3", "REPL"]
path = ".."
Copy link
Member Author

@Gnimuc Gnimuc Jun 27, 2020

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