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
Bring quality checks documentation within Pootle #3684
Bring quality checks documentation within Pootle #3684
Conversation
lgtm didn't test. I'm not sure about the unescaped & that appear in the reference EN HTML file. |
Please note that we added some new quality checks and descriptions recently (couple of weeks ago). Is this based on most recent edits? After this PR is merged, who's going to maintain this file? |
My personal preference to have all HTML files actually XHTML (so that they can be parsed/validated as a part of the test/build process). So I'd suggest using |
@iafan All Evernote quality checks have description except https://github.com/translate/pootle/blob/master/pootle/apps/pootle_misc/checks.py#L455-L463 which doesn't look like a quality check. Or at least it seems not to be used anywhere. About maintenance. I suppose it is up to the people that adds or removes checks. IMHO it might be better to put each quality check description in the docstring, like we just did with TTK ones: translate/translate@602b9286 I am replacing the |
0102100
to
7e840ca
Compare
cc9004b
to
0f399d8
Compare
@@ -268,7 +274,7 @@ def create_default_projects(): | |||
'guide</a>.</div>'), | |||
'virtual_path': "announcements/projects/"+tutorial.code, | |||
} | |||
ann = Announcement(**criteria) | |||
ann = StaticPage(**criteria) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm just saw the change in the import. Still, I don't believe it's necessary the rename, and it's completely irrelevant in the context of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I first imported StaticPage
was for using it on announcement creation, so I imported it as Announcement
. Now that we are creating regular static pages it feels cleaner to use instead StaticPage
since using Announcement
can be confusing.
|
91aeb6d
to
49415ea
Compare
We require latest available Toolkit code, because of the changes we recently merged there (each check function now keeps its description on its docstring for easier maintenance and to ease programmatic regeneration), so I would say it is necessary.
I don't like the idea, but I changed it that way. In fact I think the best approach to keep the descriptions updated would be to move them to each quality check docstring (like in TTK), but since that would take time I would leave it for future cleanups. Also I am not sure if you are even ok with this approach.
There is no way to do that in this PR. Any suggestion? Maybe some management command to regenerate the whole checks descriptions staticpage? |
@unho a management command does sound like the easiest to recreate the pages, buys us time to not have to solve the further for a bit of time. |
49415ea
to
2f811c2
Compare
@translate/evernote @translate/house Added a missing requirement and a new management command to recreate the checks descriptions on demand (docs included). |
2642ef2
to
fe9b5f5
Compare
The new dependency on |
@julen So you suggest to include a static HTML page that has to be recreated on each release? Do you suggest us to handle the descriptions for the TTK checks in the same way? |
@julen Let me try to explain my point a bit more clearly. Having to maintain static HTML files both in Pootle and TTK to avoid having a new dependency feels like a high toll. I see that as a maintenance nightmare, to be clear. In fact I was looking more towards even removing the existing HTML file in Pootle for the Evernote checks description, specially after @iafan asked about who is going to maintain that file (which I understood as that he sees that as maintenance burden). On the other hand I don't like the idea of pulling new dependencies. |
I personally don't quite like what @julen have proposed: if we change the description in the bundled html file, it won't get propagated to static files in the database. We'd better simply serve this as a static page (and outside the /pages/ prefix) without having to copy it anywhere. |
This is not any new proposal, but how the code in the PR operates.
Agreed, this would avoid the maintenance cost on creating a |
Ok, I was probably confused by this comment of yours:
This is what I would like to avoid. We don't have to copy template into a 'static page' entity in the database just to be able to show static content. We can render it straight from the template. |
Forbid me if my comment wasn't clear enough, but I'm not suggesting to maintain any HTML files on TTK. The explanation/help page is on the Pootle side, so any HTML file belong there. Also, here a static HTML string is being generated, which is then fed to an |
fe9b5f5
to
a962374
Compare
@julen @iafan OK let me weigh in here. Firstly, this PR was originally done to try quickly get TTK check descriptions into Pootle and also EN check descriptions into a default install. Secondly, to make it possible to keep those well maintained without duplication. So lets keep that in mind. I also think there is a better way to support check descriptions and that's close to the check and not in a static page. But we didn't want to go that route for this, at that would be a long fix... which ironically this quick fix is now turning into. @julen from what I understand your issues and suggestions are these:
@unho raises the following concern with this approach:
My suggestion for going forward:
|
Your understanding is correct @dwaynebailey and the suggestion is reasonable. Also note the current |
@julen @iafan I see no problem on having the descriptions on a static HTML that is served directly. But note that that requires to adjust the links on the editor and to agree in which URL is the static HTML going to be served. @dwaynebailey Keeping the command to regenerate the descriptions (necessary since a given Pootle version can support multiple TTK releases with possibly different checks) pulls in the All of this just reminded me that we have to include checks description regeneration in the upgrade instructions. |
@translate/evernote @translate/house Reworked the whole PR. Now quality checks descriptions are being served in |
body = u"\n".join(filterdocs) | ||
|
||
# Output the quality checks descriptions to the HTML file. | ||
filename = os.path.join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better:
from django.conf import settings
filename = os.path.join(settings.WORKING_DIR,
'templates/checks/_ttk_descriptions.html')
Thanks @unho, this looks good now. I don't believe an empty _ttk_descriptions.html needs to be under version control, and even more, it should probably be in the .gitignore file as it should be generated when creating a distribution package. You might as well want to align file names with URLs (checks/descriptions.html -> help/quality_checks.html), but up to you. The only concern I have is that when the command hasn't been run (or when there's no plan to use TTK checks), it still displays an empty header (Translate Toolkit Checks) and a paragraph mentioning two types of checks. GTM from my side but let's wait to hear thoughts on the previous point before merging. |
53983b6
to
73017e6
Compare
This template now contains a placeholder text saying TTK checks are not enabled.
Done.
Now the Translate Toolkit Checks part displays a placeholder saying that those are not enabled. I think this approach might not be clean enough, and I have been thinking on having a third include for the problematic paragraph while having the TTK include blank. But I would like to hear from you. |
1e1957f
to
79e5310
Compare
with codecs.open(filename, 'w', 'utf-8') as f: | ||
f.write(body) | ||
|
||
self.stdout.write('Regenerating descriptions... done.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realize you're repeating Regenerating descriptions here, it's already written above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@julen It is intentional. Lets not force users to guess what is done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd understand it if it was displayed as Regenerating descriptions... at the beginning, and once it's done it was overwritten with Regenerating descriptions... done. There's no guesswork involved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@julen Ok, changing this so you can gtm.
The core issue I was trying to highlight wasn't the fact of having an empty file. It was about the fact of having a target file which can be generated and therefore possibly end up accidentally modified in version control, potentially creating conflicts or causing other trouble that can initially be avoided. |
<h2>Translate Toolkit Checks</h2> | ||
|
||
|
||
<p>This server has not enabled the Translate Toolkit quality checks.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have this at all if the server is not using TTK checks?
@unho did a review and the generation works. One concern. The docs that we're replacing in TTK have full description of checks, much like Evernote. Yet in the autogenerated ones we only have the first line of the content. Is this a bug, the code looks like it wants to give the full description. Or was it intentional? |
79e5310
to
65ac1ff
Compare
@dwaynebailey That might be you not having upgraded translate-toolkit dependency. Note that we require the latest version on git. Once we release 1.13 final we will require that. |
@unho spot on it was an older toolkit instead of the one from Git. With a new version from github this works as expected. |
65ac1ff
to
784f1bc
Compare
@translate/house @translate/evernote All issues have been addressed. Now the |
784f1bc
to
5e2af4b
Compare
|
||
<p>Pootle has an ability to check for common translation mistakes. Once you submit a translation, it will compare its certain features with the original string and identify potential problems. Сhecks are displayed in the upper right corner, just above the submit button. Once there are checks in red, you will stay on the same unit, until you have each check resolved or muted. Note that you should only mute checks if you know what you're doing. Muted checks will be reviewed periodically by the managers.</p> | ||
|
||
<p>If you are not sure what a particular error means and how to fix it properly, use <i>"Report a problem with this string"</i> link at the top of the unit. The managers will try to assist you as soon as possible.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realize this only applies if CAN_CONTACT = True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed that, despite the string errors report form is displayed indepedently of the value of CAN_CONTACT
.
5e2af4b
to
f3bd6a0
Compare
This allows us to have a specific URL pattern to refer to them. Note that the help/_ttk_quality_checks.html template is not added since it is intended to be automatically generated. Part of translate#3604.
f3bd6a0
to
991e541
Compare
@translate/house @translate/evernote Any new issue? |
@unho lgtm |
The resulting descriptions are saved as the help/_ttk_quality_checks.html template. That filepath is added to ignore in order to avoid inadvertently commits changes in this template. This requires the latest available code of Translate Toolkit in order to work as expected. The docutils library is also required. If not present an error message is displayed asking for it. Fixes translate#3604.
991e541
to
e63082c
Compare
Merged since it seems I have gtms from both sides. If any other issue arises it can be fixed on master. |
This reverts commit 6008d34. Here's the comment in the original PR about why it shouldn't be there #3684 (comment)
This staticpage also have to be created on the upgrade to 2.6. Working on that.
@translate/evernote @translate/house Please review.
Ideally Evernote checks would use the same approach it is used for TTK checks: retrieve description from each check docstring.
Also note that this doesn't handle the scenario where TTK is upgraded and new checks are added, or removed or changed.