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

Translation should have the same document structures as its original #5321

Open
cocoatomo opened this issue Aug 20, 2018 · 5 comments
Open

Comments

@cocoatomo
Copy link
Contributor

cocoatomo commented Aug 20, 2018

Subject: Sphinx mistakenly use translation whose structure is not same as original

Problem

  • Sphinx accepts translations even if there are apparently difference between original texts and translated texts. These difference could easily occur (e.g. single whitespace inserted at head of line)

Procedure to reproduce the problem

sample.tar.gz

tar xvf sample.tar.gz
cd sample
make -e SPHINXOPTS="-D language='ja'" html
open build/html/index.html 

Error logs / results

Running Sphinx v1.7.6
loading translations [ja]... done
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                                   
/private/tmp/work/test/sample/source/index.rst:3: WARNING: Unexpected indentation.
/private/tmp/work/test/sample/source/index.rst:11: WARNING: Block quote ends without a blank line; unexpected unindent.
/private/tmp/work/test/sample/source/index.rst:13: WARNING: Definition list ends without a blank line; unexpected unindent.
/private/tmp/work/test/sample/source/index.rst:3: WARNING: Unexpected indentation.
/private/tmp/work/test/sample/source/index.rst:11: WARNING: Block quote ends without a blank line; unexpected unindent.
/private/tmp/work/test/sample/source/index.rst:13: WARNING: Definition list ends without a blank line; unexpected unindent.
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                                                                    
generating indices... genindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in Japanese (code: ja) ... done
dumping object inventory... done
build succeeded, 6 warnings.

The HTML pages are in build/html.

Expected results

When a structure of original texts and translated texts does not match, Sphinx should report warning.

Reproducible project / your project

  • attach file sample.tar.gz

Environment info

  • OS: macOS High Sierra 10.13.6
  • Python version: Python 3.7.0
  • Sphinx version: 1.7.6
@jfbu
Copy link
Contributor

jfbu commented Aug 21, 2018

Hi, thanks, somehow sample.tar.gz was not attached to your post?

@tk0miya
Copy link
Member

tk0miya commented Aug 21, 2018

It seems he attached it now :-)
I'll take a look later

@jfbu
Copy link
Contributor

jfbu commented Aug 21, 2018

I get

Error while executing "gzip -c -q -d < /path/to/sample.tar.gz"


gzip: stdin: not in gzip format

edit: perhaps the gzipping was removed at some stage by my Firefox when downloading sorry, the attached opens as archive file after renaming to simply sample.tar.

(sorry that I did not pay attention to @cocoatomo saying to do tar xvf sample.tar.gz which does work)

@tk0miya tk0miya modified the milestones: 1.7.8, 1.8.0 Aug 21, 2018
@tk0miya
Copy link
Member

tk0miya commented Aug 21, 2018

I moved this to 1.8.0 because some additional warnings will be needed for this.

@tk0miya
Copy link
Member

tk0miya commented Aug 21, 2018

Note: the main cause is publish_msgstr() only picks up the first node from parsed results.
The following nodes are dropped here.

try:
doc = doc[0]
except IndexError: # empty node
pass
return doc

@tk0miya tk0miya modified the milestones: 1.8.0, 2.0.0 Sep 2, 2018
@tk0miya tk0miya modified the milestones: 2.0.0, 2.1.0 Feb 8, 2019
@tk0miya tk0miya modified the milestones: 2.1.0, 2.2.0 Jun 1, 2019
@tk0miya tk0miya modified the milestones: 2.2.0, 2.3.0 Aug 18, 2019
@tk0miya tk0miya modified the milestones: 2.3.0, 2.4.0 Dec 8, 2019
@tk0miya tk0miya modified the milestones: 2.4.0, 3.0.0 Feb 5, 2020
@tk0miya tk0miya modified the milestones: 3.0.0, 4.0.0 Mar 14, 2020
@tk0miya tk0miya modified the milestones: 4.0.0, 4.1.0 Mar 5, 2021
@tk0miya tk0miya modified the milestones: 4.1.0, 5.0.0 Jul 10, 2021
@tk0miya tk0miya removed this from the 5.0.0 milestone May 22, 2022
@tk0miya tk0miya added this to the 5.x milestone May 22, 2022
@AA-Turner AA-Turner modified the milestones: 5.x, some future version May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants