Microsoft MakeCode is a web-based platform
for creating engaging computer science learning experiences.
It provides a block-based programming environment that allows students
to create games, animations, and interactive stories.
One major challenge in localizing the MakeCode resource is that
tools like Bing Translator or Google Translate had the tendency to destroy the custom macro
annotation; thus breaking the rich rendering of the documentation.
Let’s illustrate this with the Step 6 of the Rock Paper Scissors tutorial:
In this content, it is critical to keep the ||variables:hand||
and ||logic:0 = 0|| annotations as they are. And also the blocks macro should be left untouched.
Unfortunately, traditional translation system do not have a way to “teach” the syntax or emphasize
the importance of these annotations.
For example, when translated to French in Bing Translate, a number of errors are introduced:
`` becomes ', extra whitespaces, logic becomes logique, and so forth.
Teaching the LLM how to translate
GenAIScript allowed to develop and automate a script that create high-quality LLM-based translations
for the MakeCode documentation.
A (simplified) version of the script is shown below and annotated with comments.
Using this script, the translation of Step 6 to French is as follows, and
you’ll notice that all the errors have been solved.
Automation
Note that we use env.vargs.langvariable which allows to modify this value through the command line.
Using the genaiscript CLI, we can run the script for each desired language in a GitHub Action.
Validation and upload
The CLI can be automated using your favorite bash/script runtime.
For example, using zx, we automate for a number of locales:
translate documentation,
save translation to files,
run the MakeCode compiler to validate the translations
upload/update translation to the translation database