Introduction
Why i neeed to manually translate my personal blog post into Spanish. Sometimes the browser translatro breaks the format of the post. I also asked myself if translation APIs are better now.
i decided to add this job to my GitLab CI. Before building it. I read an article that helped me a lot to process the markdown post format. πThis is the article GitHub Action to Publish Hugo Posts to Dev.to .
My problem
There is no single language for me. I read technical articles in Russian, Hindi, English, and Spanish. In my opinion switching the browser traductor between languages is painful and takes time.
The Solution: Automation Through GitLab CI
The ideal solution would be to configure the browser to automatically translate pages into your preferred language. However, this can be unreliable on mobile phones and sometimes even on laptops.
So I decided to automate the process using GitLab CI.
The Solution: Automation Through GitLab CI
The ideal solution would be to configure the browser to automatically translate my post. However, this can be unreliable on mobile phones and sometimes even on laptops. So I decided to automate the process using GitLab CI.
Key Features
-
Front matter mapping β I process the metadata and content from personal blog Markdown files. I convert the front matter correctly and translate only the values, not the keys.
-
Handling limitations β I choose which metadata should be translated and which should not.
-
Update rules β The translation job runs only when a new blog post is created. It does not run when I update an existing post.
I made this rule because sometimes I only fix one small word, and I do not want to re-translate the entire article for that small change.
I also try to use translation tools responsibly while building technology.
Conclusion
Building this automation makes me feel happy because one of my tasks is now automated. I’m happy share with u my small adventures.
My code: translate.py and .gitlab-ci.yml
