9.1 KiB
title | author |
---|---|
Is React Translated Yet? ¡Sí! Sim! はい! | [tesseralis] |
We’re excited to announce an ongoing effort to maintain official translations of the React documentation website into different languages. Thanks to the dedicated efforts of React community members from around the world, React is now being translated into over 30 languages! You can find them on the new Languages page.
In addition, the following three languages have completed translating most of the React Docs! 🎉
- Spanish: es.reactjs.org
- Japanese: ja.reactjs.org
- Brazilian Portuguese: pt-br.reactjs.org
Special congratulations to Alejandro Ñáñez Ortiz, Rainer Martínez Fraga, David Morales, Miguel Alejandro Bolivar Portilla, and all the contributors to the Spanish translation for being the first to completely translate the core pages of the docs!
Why Localization Matters
React already has many meetups and conferences around the world, but many programmers don't use English as their primary language. We’d love to support local communities who use React by making our documentation available in most popular languages.
In the past, React community members have created unofficial translations for Chinese, Arabic, and Korean; by making an official channel for these translated docs we're hoping to make them easier to find and help make sure that non-English-speaking users of React aren't left behind.
Contributing
If you would like to help out on a current translation, check out the Languages page and click on the "Contribute" link for your language.
Can't find your language? If you'd like to maintain your language's translation fork, follow the instructions in the translation repo!
Backstory
Hi everyone! I'm Nat! You may know me as the polyhedra lady. For the past few weeks, I've been helping the React team coordinate their translation effort. Here's how I did it.
Our original approach for translations was to use a SaaS platform that allows users to submit translations. There was already a pull request to integrate it and my original responsibility was to finish that integration. However, we had concerns about the feasibility of that integration and the current quality of translations on the platform. Our primary concern was ensuring that translations kept up to date with the main repo and didn't become "stale".
Dan encouraged me to look for alternate solutions, and we stumbled across how Vue maintained its translations -- through different forks of the main repo on GitHub. In particular, the Japanese translation used a bot to periodically check for changes in the English repo and submits pull requests whenever there is a change.
This approach appealed to us for several reasons:
- It was less code integration to get off the ground.
- It encouraged active maintainers for each repo to ensure quality.
- Contributors already understand GitHub as a platform and are motivated to contribute directly to the React organization.
We started off with an initial trial period of three languages: Spanish, Japanese, and Simplified Chinese. This allowed us to work out any kinks in our process and make sure future translations are set up for success. I wanted to give the translation teams freedom to choose whatever tools they felt comfortable with. The only requirement is a checklist that outlines the order of importance for translating pages.
After the trial period, we were ready to accept more languages. I created a script to automate the creation of the new language repo, and a site, Is React Translated Yet?, to track progress on the different translations. We started 10 new translations on our first day alone!
Because of the automation, the rest of the maintenance went mostly smoothly. We eventually created a Slack channel to make it easier for translators to share information, and I released a guide solidifying the responsibilities of maintainers. Allowing translators to talk with each other was a great boon -- for example, the Arabic, Persian, and Hebrew translations were able to talk to each other in order to get right-to-left text working!
The Bot
The most challenging part was getting the bot to sync changes from the English version of the site. Initially we were using the che-tsumi bot created by the Japanese Vue translation team, but we soon decided to build our own bot to suit our needs. In particular, the che-tsumi bot works by cherry picking new commits. This ended up causing a cavalade of new issues that were interconnected, especially when Hooks were released.
In the end, we decided that instead of cherry picking each commit, it made more sense to merge all new commits and create a pull request around once a day. Conflicts are merged as-is and listed in the pull request, leaving a checklist for maintainers to fix.
Creating the sync script was easy enough: it downloads the translated repo, adds the original as a remote, pulls from it, merges the conflicts, and creates a pull request.
The problem was finding a place for the bot to run. I'm a frontend developer for a reason -- Heroku and its ilk are alien to me and endlessly frustrating. In fact, until this past Tuesday, I was running the script by hand on my local machine!
The biggest challenge was space. Each fork of the repo is around 100MB -- which takes minutes to clone on my local machine. We have 32 forks, and the free tiers of most deployment platforms I checked limited you to 512MB of storage.
After lots of notepad calculations, I found a solution: delete each repo once we've finished the script and limit the concurrency of sync
scripts that run at once to be within the storage requirements. Luckily, Heroku dynos have a much faster Internet connection and are able to clone even the React repo quickly.
There were other smaller issues that I ran into. I tried using the Heroku Scheduler add-on so I didn't have to write any actual watch
code, but it end up running too inconsistently, and I had an existential meltdown on Twitter when I couldn't figure out how to send commits from the Heroku dyno. But in the end, this frontend engineer was able to get the bot working!
There are, as always, improvements I want to make to the bot. Right now it doesn't check whether there is an outstanding pull request before pushing another one. It's still hard to tell the exact change that happened in the original source, and it's possible to miss out on a needed translation change. But I trust the maintainers we've chosen to work through these issues, and the bot is open source if anyone wants to help me make these improvements!
Thanks
Finally, I would like to extend my gratitude to the following people and groups:
- All the translation maintainers and contributors who are helping translate React to more than thirty languages.
- The Vue.js Japan User Group for initiating the idea of having bot-managed translations, and especially Hanatani Takuma for helping us understand their approach and helping maintain the Japanese translation.
- Soichiro Miki for many contributions and thoughtful comments on the overall translation process, as well as for maintaining the Japanese translation.
- Eric Nakagawa for managing our previous translation process.
- Brian Vaughn for setting up the languages page and managing all the subdomains.
And finally, thank you to Dan Abramov for giving me this opportunity and being a great mentor along the way.