Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wvteijlingen/f7a2d6be317940b9cb101fe657240dd8 to your computer and use it in GitHub Desktop.
Save wvteijlingen/f7a2d6be317940b9cb101fe657240dd8 to your computer and use it in GitHub Desktop.
Blog/Using Google Sheets to localise your app or website
excerpt
If you're building a mobile app or website, chances are that you need to manage translations for multiple languages. In this post I want to show how to use a free tool called "Localeasy", to use Google Sheets to store and manage your translation strings

Using Google Sheets to localise your app or website

If you're building a mobile app or website, chances are that you need to manage translations for multiple languages. There are many complicated paid platforms that you can use to do this, but in this post I want to show you a free alternative: Localeasy.

With Localeasy you can use Google Sheets to store and manage your app translations. This has many benefits such as easy user management, change tracking, comments, no limits on contributors, and best of all: it's free of charge!

In this post I will show you how you to integrate Localeasy with your project. For this example we will use two languages: English and Dutch.

1. Creating a Google sheet

The first step is to create a new Google Sheet which will contain all translations in all the languages that you support. I've already created a template that you can duplicate: Template sheet. Go ahead and duplicate it, it should look something like this:

  • The key column will hold the key of the translation.

  • The en and nl columns will hold the English and Dutch translations respectively.

  • The comment column can be used to add an optional comment to the row.

2. Add view-only rights for Localeasy

Go to the Share options of your sheet, and enable the public view-only link. This ensures that Localeasy can access it.

3. Call the Localeasy endpoint

There is no need to install or configure anything locally! Simply make a GET request to https://localeasy.dev/generate with the required query parameters, and get a formatted localization file in return.

Make sure you include the following query parameters

sheet: The ID of the Google Sheet that contains your translations. format: The format of the translation file that you want to receive. For example: cocoa-strings locale: The locale that you want to receive.

Example

curl "https://localeasy.dev/generate?sheet=1lf71Q7J_By6_X46u-wisU5G3KoZx_uD8PX4PkYyVzOk&format=json&locale=en&nest-by=.&variant=web"

That's it!

The process of managing your translations is now much easier. Just make a change to the Google sheet, call the Localeasy endpoint, and Localeasy will take care of the rest!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment