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
Fix i18n paths for hourofcode project #33002
Conversation
bin/i18n/hourofcode_crowdin.yml
Outdated
"source": "/**/*.md", | ||
"translation": "/%language%/hourofcode/**/%file_name%.md", | ||
"source": "/source/hourofcode/**/*.md", | ||
"translation": "%language%/hourofcode/**/%file_name%.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.
is this intentional? Specifically, is it intentional that the translation field for en.yml
has a leading slash and this one doesn't?
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.
oh that looks like a mistake. I'll fix that
|
||
# API Credentials must be loaded from a separate identity file. See | ||
# https://support.crowdin.com/configuration-file/#split-project-configuration-and-api-credentials | ||
"api_key" : "" | ||
|
||
"preserve_hierarchy": 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.
I believe we want to preserve this; otherwise, source files will all be uploaded to the root directory of the crowdin project
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.
They were being uploaded into the source
directory of the crowdin project with it, which was extra strange
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.
The dryrun above was without this flag and it looks right? The code-dot-org
crowdin project doesn't have this setting so I'm not sure why this one is different?
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.
Okay I read the documentation and it isn't clear. If preserve_hierarchy
is set to true it will preserve the whole hierarchy but I'm not sure what happens when it's not set.
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.
upon further investigation, it looks like we actually aren't using it in the config for the regular codeorg sync either, so I think I had some misunderstanding about how this is used
next unless File.directory?(crowdin_dir) | ||
|
||
FileUtils.cp_r File.join(crowdin_dir, '.'), dest_dir | ||
FileUtils.rm_r crowdin_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.
Don't we still need this operation, and also the "remove unused" one below? Before, translations would get downloaded to (for example) /i18n/locales/source/hourofcode/Spanish/
and now they'll be downloaded to /i18n/locales/Spanish/hourofcode/
; we want them to be in /i18n/locales/es-MX/hourofcode/
; the work needed hasn't changed, just the specific location of the source.
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.
But the sync-out
does that now.
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.
Specifically this function now also copies the hourofcode
downloaded files:
code-dot-org/bin/i18n/sync-out.rb
Line 31 in 1058958
def rename_from_crowdin_name_to_locale |
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.
ooooooh of course. I forgot to consider that these syncs are unified now
This PR moves the files downloaded from Crowdin into
i18n/locales/<locale>/hourofcode
and distributes them from there.Testing
Dry run with new config:
Which looks the same as the current set of files in the hour-of-code project.
I ran the sync out and after pulling all the files from the hourofcode project.
Links
Reviewer Checklist: