-
-
Notifications
You must be signed in to change notification settings - Fork 96
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 - scripts, the final part #154
base: master
Are you sure you want to change the base?
Conversation
e4b2480
to
524b89a
Compare
testdeploy |
Great work! Thanks to @maiska and @marmarek! BTW, the line
doesn't seem to work as expected. At least, I see the lang menu with the English entry only. The following should work (without having tested it):
It's a Liquid thing … |
It works, just ignore wwwpreview instance - it got built with empty _translated dir... See wwwtest instance, linked in the PR description. |
I see multiple langs in the menu in the However, I tried the following mini examples right now: Example 1
outputs nothing. Also, I got a syntax error warning. Example 2
outputs Example 3
outputs Example 4
outputs Do I have a different Liquid version? Sorry for the noise. I just want to avoid errors in the long run. |
You are correct, it worked only because |
524b89a
to
680545b
Compare
|
||
echo "============================ post processing step 2 ======================================" | ||
#read b | ||
ruby _utils/_translation_utils/merge_md_heading_ids.rb "$1" /tmp/tx-mapping |
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.
At least for the merge_md_heading_ids.rb
script, called here, it is important that the checked out commit is not the most recent one but that commit that was the current one when the files have been pushed to Transifex the last time. The reason is that headlines may have changed or added or removed meanwhile and thus, the merge_md_heading_ids.rb
script may produce a wrong output.
I can't see any attempt to checkout that correct commit or have I overseen something?
IMHO when pushing files to Transifex, the related commit hash should be saved. When pulling the files from Transifex, that related (old) commit should be checked out for the postprocessing steps.
Is it understandable what I mean?
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.
This all is called just after pushing and pulling from transifex. See https://github.com/QubesOS/qubesos.github.io/pull/154/files#diff-037ea159eb0a7cb0ac23b851e66bee30fb838ee8d0d99fa331a1ba65283d37f7R38-R39
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.
Ah, okay, now I see. Both pushing and pulling belong to the same commit and thus everything is right. Thank you for clarification!
680545b
to
bde5342
Compare
I've rebased it on top of recent version and added few improvement discussed in the meantime (including @tokideveloper 's updated script). |
cfdcf4e
to
e8d7029
Compare
I'll simplify it further when rebasing on top of #178 (when it will be merged). |
e8d7029
to
0cca399
Compare
PipelineRefresh |
fe3a31c
to
095179a
Compare
PipelineRetry |
095179a
to
664af4c
Compare
PipelineRetry |
664af4c
to
43d83c7
Compare
PipelineRetry |
Remove translated files when the source file get removed. This includes also renaming files.
Do not attempt to verify correctness of the website before refreshing all languages. If any structural change happened (rename, permalink change etc), it will fail because of the old files, not the freshly downloaded ones. Make htmlproofer postprocessing script language agnostic. This is mostly about removing "language" parameter, which wasn't used anyway.
43d83c7
to
67520a6
Compare
Just to confirm... you're not waiting or expecting me to do anything with this, right @marmarek? I've been intentionally leaving this PR alone because you seem like you're managing it yourself (and of course the big "[DO NOT MERGE]" warning). |
testdeploy |
trestdeploy |
testdeploy |
You are correct. I want to get it working again first. It's almost there. For example QubesOS/qubes-translated@a102a9e was just made. There is still some issue with language switcher (just "en" visible there). As for the "[DO NOT MERGE]" commits - it's just about that commit - it enables the translations to be visible for some languages (es, fr, de) - which I think we want only when sufficient part will be translated already. |
Currently (if language switcher enabled at all), for a certain page P, the language switcher only shows those languages where translations exist for P in |
I think this design is fine (even if may look weird at places). The issue is I see only "en" on pages I manually verified the "translated" version exists in the |
That's strange because I tested it on my machine a few minutes ago and it works. Okay, actually I only tested two files: EDIT: Of course, I enabled the switcher in |
testdeploy |
Ok, that was not very smart from me. "testdeploy" command took the version without downloaded translations 🤦 Now it is better :) |
It's a lot better! It looks great! 🎉 ❤️ |
https://wwwpreview.qubes-os.org/de/team/#inquiries - this doesn't look properly handled, especially "Business" should be "Geschäft" (it is translated in the qubes-translated repo). This is because
I can easily change that to appropriate entry from Some ideas:
I'm not sure how to do either of those. |
Anyway, now is the time to review both the content of this very PR, but more importantly its output at wwwpreview. As for the scripts in |
Yes! Maybe other entries need to be locked, too.
No. I like the current design where the team itself has its own data file.
Me neither. @maiska, can you describe how to lock certain strings? Maybe via the API? |
I agree. First, the output should be good. Afterwards, we can review the code.
In the past, I reviewed maiska's files and they seemed to be good. But I can do another review again. |
The smart tag "locked" means "nobody can touch it" and the smart tag "notranslate" means in our case "replace with source string". We should use both. See https://docs.transifex.com/projects/preventing-resource-edits#locking-strings
See _utils/_translation_utils/tag_strings_as_locked.py. You may need to load the diff manually. |
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've reviewed all files. At least, I tried it and tried to understand the files.
@@ -0,0 +1 @@ | |||
current counter: 251 |
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.
Can we be sure that this value is correct once the PR is merged?
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.
Yes, I'll rerun the script shortly after merging again. And generally, once it lands in master, the script will be called frequently.
- de | ||
- fr | ||
- es | ||
|
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 would start with en
only for now. This way, we could test the workflow on the live system.
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.
That's the plan. Adding those extra languages is a part of the "[DO NOT MERGE] enable languages: de fr es" commit.
result = merge_ids_in_gfm_files(original_lines, translated_lines) | ||
write_lines(result, item) | ||
|
||
|
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.
Actually, this Python script isn't needed anymore since it's not called and it has been ported to a Ruby script (which is called). See _utils/_translation_utils/merge_md_heading_ids.rb.
EDIT: Also, this Python version is not up-to-date.
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.
Ah, right. I'll remove it.
# headline starting with '#' | ||
gfm_lines[line_number] = '# ' + placeholder + "\n" | ||
hl = look_for_headline(render(gfm_lines), placeholder) | ||
elsif next_line.length >= 3 and (line_only_made_of(next_line, '=') or line_only_made_of(next_line, '-')) |
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.
Since next_line
contains a \n
at the end, the check above must be next_line.length >= 3 + 1
instead of next_line.length >= 3
.
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.
Good point.
|
||
mapping = create_dict_from_tx_config(ARGV[0], ARGV[1]) | ||
mapping.each do |key, value| | ||
if !key.end_with?(".yml") |
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.
Since there could be more files on Transifex in the future (e.g. HTML, PO etc), the check should check for accepted file endings like *.md
: if key.end_with?(".md")
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.
Good point.
What I forget in the review: Some scripts run recursively through directories like |
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.
In this review, I marked the spots where .git
is not ignored.
Sometimes there seems to be no need to ignore .git
since the root directory of such a walk is a repo subdirectory (not containing any .git
directory). However, to be on the safe side, .git
directories should be ignored in general.
mapping = {} | ||
perms = [] | ||
yml_files = [] | ||
for dirname, subdirlist, filelist in walk(translated_dir): |
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.
This walk doesn't ignore .git
.
|
||
href = set() | ||
reg ='(?<=href=\").*?(?=\")' | ||
for dirname, subdirlist, filelist in walk(translated_dir): |
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.
This walk doesn't ignore .git
.
""" | ||
|
||
perms = set() | ||
for dirname, subdirlist, filelist in walk(translated_dir): |
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.
This walk doesn't ignore .git
.
|
||
return counter | ||
|
||
for dir_name, subdir_list, file_list in os.walk(root_dir): |
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.
This walk doesn't ignore .git
.
Any progress? |
This PR focuses on internationalization of the Qubes OS website including the documentation, using Markdown and Jekyll. Meanwhile, we moved away from that approach towards a conversion of the documentation from Markdown to reStructuredText, render it using Sphinx and host it on ReadTheDocs. This is our (new) next step. The next steps afterwards would be internationalization and localization of the documentation and later the Qubes OS website. |
This is the final part of the translation integration. Previous two:
#153
QubesOS/qubes-doc#1123
Similar to previous parts, the majority of work was done by @maiska and @tokideveloper. Thanks!
On top of their work, this PR integrates all those scripts with Gitlab CI pipeline. It handles pushing/pulling content to/from Transifex automatically. I have performed the first iteration of this, to populate https://github.com/QubesOS/qubes-translated repository with initial content (we did have some content translated before, so indeed some (small) parts are translated, mostly in Spanish language). For the test purposes, I've enabled languages
es
,de
,fr
, but this commit should not be merged until substantial part of the documentation there is translated (right now most of those pages are simply copies from English).See README for high level description of how it works.
The resulting website, with translations enabled can be seen at https://wwwtest.qubes-os.org/