Logo
Paragraph blog

How to translate a Laravel application using Google Translate

Paragraph 24 May 2022

Google Translate is getting pretty good at machine translation and even if sometimes it's not generating ready-to-use content, it's still useful as a starting point. Translate your texts using Google Translate, then manually fix the typos or stylistic errors and you have saved yourself a lot of time!

Laravel ships with standard localization features such as global helper functions like __() and Blade directives like @lang(). It's assumed that you manage your language files manually by editing these files and committing them to the repository. Let's try to speed this process up by using Google Translate.

Create a Laravel project

Unless you have already done this, first you need to create a Laravel project in Paragraph dashboard. Make sure you choose "Laravel" as the project framework:

Creating a new project in Paragraph

Choosing a translator

Once you have done this, head to the project settings by clicking on a cog icon, here you will see a dropdown with a list of machine translation services that we support, including Google Translate:

Project settings allow to choose a specific MT service

Using translations

Now that we set the project translation service as Google Translate, let's go to the text editor and see how we can use it in practise:

Machine translation option is displayed automatically

Basically, every time you edit a text and there is no existing translation but we do have this text in the application's base (default) language, we will use your chosen translation service to provide a good start (who knows, maybe even the final text!). Just click "Use it" to set the editor text to this value. And once you are happy with the result, click "Save". That's it!

There is no easier way to translate a Laravel app, than to use the powers Google Translate API and Paragraph integration.

Tags

#laravel #google cloud

Similar posts

About this blog

Paragraph is a SaaS app that allows to manage your product’s texts and communications as if it was a CMS — using a nice web interface. No more editing in code!

This blog will discuss emerging trends and technologies related to development and product localization.

Paragraph