Introduction
Preparing your app to localize
Estimated time to complete: 2 hours - 5 days
If you've ever translated your app before, you can skip this step. Nice work! If not, you have a small project ahead of you, but it will totally be worth it when you see your app in a new language for the first time.
Preparing your app to localize is a simple two step process:
- Install a translation library.
- Wrap all your strings in translation helpers.
TranslateCI can take over from there and handle the rest. You only need to do this once and then you can translate your app into as many languages as you want.
Let's get started!
Step 1: Install a translation library
This is going to vary depending on your framework. But we can give you some pointers.
React
If you're using React, we recommend using i18next. It's straightforward and easy to use. We've written a detailed walkthrough to help you get started.
Laravel
If you're using Laravel, you're in luck. Laravel has fantastic localization support build right in. Check out the docs on Laravel Localization. And of course, we've also written a detailed guide to help you get started.
Vue
If you're using Vue, we recommend using vue-i18n. It's easy to use and has great support for Vue. We've written a detailed walkthrough to help you get started.
Ruby on Rails
Ruby on Rails has localization support shipped from 2.2 on. Check out their docs on Rails Internationalization (I18n) API.
Don't see your framework here? Send me an email at jack@translateci.com and I'll help you out.
Step 2: Wrap all your strings in translation helpers
For each string in your app, you'll need to wrap it in a translation helper. This is what tells the translation library that this string needs to be translated. It's usually as simple as wrapping your string in a function call. For example, in i18next, you would wrap your string like this:
t('Hello World')
That's it! Now you're ready to translate your app.
This can be a good bit of a work for a developer to do, but it's a one time thing. Secret pro-trick, ChatGPT is actually really good at this. If you paste in your template and ask it to prep it for localization, it typically does a really nice job.