If you have worked with enterprise software, you’ve probably been asked to translate your app at some point. This implies translating small pieces of text, such as buttons, checkboxes, radio buttons, etc. This process often implies exporting CSV files from some database, sending these files to the employee doing the translation, importing the files into the database afterwards, etc. It’s normally an insanely manual process, requiring some of your most expensive employees, working with the problem for hours and sometimes days. With Magic you can completely automate this process however.

In the above video, I demonstrate how you can automate this job, by looking up entities you need to translate using Google Translate. I’ve used this pattern myself several times, and Google Translate actually does a decent job 95% of the times, especially for Latin languages. Sometimes it’ll mess up things for far east languages, such as Japanese, Chinese, etc – But for these cases, you can easily edit the translated entity afterwards, by giving access to the “translation app” to some back office worker responsible for that language.

All in all, I’d say the above video illustrates how you can completely automates the problem of translation, eliminating 95% of the workload associated with the problem. A far cry from manually having to export CSV files from your database, sending these on email to the translation unit, importing them again after a couple of days, etc. The database schema I started with looks like the following.

The above is its MySQL version, but Magic also has a Microsoft SQL Server version if you download its latest version. After creating my database, I generated my backend using the Magic Dashboard.

This created my backend code in approximately 1 second. After the backend was generated, I generated the frontend, which took me another second.


When Magic was done creating my app, I spent some 5 minutes applying a couple of changes. Most importantly, I added Google Translate lookups in my translations POST endpoint, which I did by exchanging its “translations.post.hl” file’s content with the following.

The above Hyperlambda will kick in if the translation entity you create is of type “en”, implying English. If it is, it will create a background thread, that selects all languages from your database except English, and iterate through all of these languages, invoking Google Translate once for each language, and saving the result from Google Translate into your translations database table with the correct language association. Some roughly 25 lines of Hyperlambda, reducing the workload of your translation unit by 95% – And off loading your need for manual labour in this space by probably 100%. And if an error occurs, it will create a detailed log entry in your database log.

If you want to apply some slightly improved UX for your app, I go through all the steps in this article.

No reasons to work, when you can have Magic do the heavy lifting

Source link

Write A Comment