Skip to content

Conversation

@steppi
Copy link
Contributor

@steppi steppi commented Jul 21, 2023

Brief description of what is fixed or changed

Following up on @rgommers' comment #652 (comment), this PR adds autotranslation of the list of releases to the build process. I'm marking this as draft because I think we should wait until after we go live with the first batch of translations before considering whether to merge this.

Autotranslation is accomplished with a simple Python script. I've briefly documented how to add new languages in a module level docstring for the script. The autotranslated releases can be included with a new shortcode "layouts/shortcodes/releases.html".

@netlify
Copy link

netlify bot commented Jul 21, 2023

Deploy Preview for numpy-org ready!

Name Link
🔨 Latest commit d7daa49
🔍 Latest deploy log https://app.netlify.com/sites/numpy-org/deploys/64bac2b0ea09c500081a467b
😎 Deploy Preview https://deploy-preview-654--numpy-org.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@steppi steppi marked this pull request as draft July 21, 2023 17:17
@rgommers
Copy link
Member

Thanks Albert! This looks like the right approach to me from a quick look. Agreed with continuing after the translations launch. It may require a rebase or a few tweaks after that.

@@ -0,0 +1,3 @@
{{ $lang := .Page.Lang }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to use one of the existing shortcodes provided by the theme:

https://theme.scientific-python.org/shortcodes/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we could also just use the include-md short-code and in the news.md for each language, hard code the path to the releases.md for that particular language. Figuring out the language in the shortcode and generating the path dynamically might be too clever for its own good. Do you think the first option I mentioned with just include-md is better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a simpler option is to generate a JSON data file, and to then use a language-specific template to generate the release lines:

https://gohugo.io/templates/data-templates/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, cool. Thanks @stefanv, I didn't know about this stuff! It looks like I've re-implemented something Hugo is already pretty good at. Data-templates does seem like the way to go.

@steppi
Copy link
Contributor Author

steppi commented Aug 8, 2023

Closing this, because I plan to use @stefanv's data templates approach, and I think it will be easier to start from scratch.

@steppi steppi closed this Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants