Skip to content

Is there an error for rst format when translate to zh_TW? #30

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

Closed
Nienzu opened this issue Sep 30, 2018 · 6 comments
Closed

Is there an error for rst format when translate to zh_TW? #30

Nienzu opened this issue Sep 30, 2018 · 6 comments

Comments

@Nienzu
Copy link
Contributor

Nienzu commented Sep 30, 2018

When I review the #26 issue, I found that the translation tutorial may be wrong. Please see below:
If I follow the tutorial, like this

Here is a code example::

此時翻譯應為:

以下是個程式範例:

::

注意額外的空行是必須的

Then, type make and open the file in the browser. The result would be in English instead of Chinese.
So, I use to replace ::, then the result is correct.

@adrianliaw
Copy link
Collaborator

Hi @Nienzu, for me it's working normally if I change all the double-colons into the translated form as described in the translation guideline. Could you please provide more information on which string, with what translated string would produce the English result? Please also include the warning messages from Sphinx when you run make.

@Nienzu
Copy link
Contributor Author

Nienzu commented Oct 3, 2018

I am not sure whether the warning messages are the reason or not. I will leave another comment to point the double-colons problem.

Part of the messages is below:

Running Sphinx v1.7.9
loading translations [zh_TW]... done
building [mo]: all of 477 po files
writing output... [100%] locales/zh_TW/LC_MESSAGES/library/turtle.mo
building [html]: all source files
updating environment: 474 added, 0 changed, 0 removed
reading sources... [100%] whatsnew/index
/Users/tommy/Desktop/cpython/Doc/library/functions.rst:260: WARNING: Inline literal start-string without end-string.
/Users/tommy/Desktop/cpython/Doc/library/functions.rst:260: WARNING: Inline literal start-string without end-string.
looking for now-outdated files... none found

Content of /Users/tommy/Desktop/cpython/Doc/library/functions.rst:260 is below:

#: ../../library/functions.rst:260
msgid ""
"The argument *optimize* specifies the optimization level of the compiler; "
"the default value of ``-1`` selects the optimization level of the "
"interpreter as given by :option:`-O` options.  Explicit levels are ``0`` (no "
"optimization; ``__debug__`` is true), ``1`` (asserts are removed, "
"``__debug__`` is false) or ``2`` (docstrings are removed too)."
msgstr ""
"*optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器的 :option:"
"`-O` 選項相同的最佳化級別。其他級別為 ``0`` (沒有最佳化;``__debug__`` 為 "
"True)、``1`` (斷言被刪除, ``__debug__`` 為 False)或 ``2``(文件字串也被刪"
"除)。"

I have tried to fix it, but I didn't figure it out.

@Nienzu
Copy link
Contributor Author

Nienzu commented Oct 3, 2018

One of the double-colons problem is like below. Btw, any of the double-colons is the same as this example.

#: ../../library/functions.rst:64
msgid ""
"Return ``True`` if any element of the *iterable* is true.  If the iterable "
"is empty, return ``False``.  Equivalent to::"
msgstr ""
"如果 *iterable* 的任一元素為 True,返回 ``True`` 。如果 iterable 為空,返回 "
"``False``。等價於:\n"
"::"

Result
2018-10-03 12 26 27

If I use , it will look like below.

#: ../../library/functions.rst:64
msgid ""
"Return ``True`` if any element of the *iterable* is true.  If the iterable "
"is empty, return ``False``.  Equivalent to::"
msgstr ""
"如果 *iterable* 的任一元素為 True,返回 ``True`` 。如果 iterable 為空,返回 "
"``False``。等價於:"

Result
2018-10-03 12 38 54

@adrianliaw
Copy link
Collaborator

You need an extra blank line between the double colon and the previous line of text, that's what "注意額外的空行是必須的" is about, see rST spec on literal blocks for the syntax specification.

The generated output may not look different because of the rST directives defined specifically for Python documentations, but without the double-colons they actually mean a different thing called block quotes. It's better to explicitly represent a literal block with a literal block.

@Nienzu
Copy link
Contributor Author

Nienzu commented Oct 4, 2018

@adrianliaw Thanks for your explanation. I fixed rST syntax and the reason for the warning message( rST 260).
I think this issue could be closed now.

@Nienzu Nienzu closed this as completed Oct 4, 2018
@adrianliaw
Copy link
Collaborator

@Nienzu Thanks a lot! Let me review it in a bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants