How to Prepare for Software Translation: A Step-by-Step Guide

Get your software ready for translation with PTC (Private Translation Cloud). Learn how to set up resource files, handle dynamic content, and add language support to make your software ready for users around the world.

Most software isn’t built for multiple languages out of the box. To make it translatable, you need to take a few steps to prepare it—a process known as internationalization (i18n).

This guide will walk you through those steps, showing you how to organize your text into resource files, manage dynamic content, and load the right translations based on the user’s language preferences.

Once you’ve prepared your software, PTC makes the translation easy. With AI-powered translations that deliver better-than-human quality, you’ll get translations requiring little to no revisions in minutes. PTC integrates with Git, automatically updating translations with every code change, so you never have to worry about manually managing your localization. And best of all, this high-quality, fast translation service comes at a fraction of the usual cost.

Steps to Make Your Software Translation-Ready

Preparing your software for translation involves a few crucial steps that will save you time and prevent common problems, like untranslated strings or broken features. We’ll go into much more detail throughout the tutorial, but here’s a brief overview of what you’ll need to do:

  • Store all user-facing text in resource files instead of embedding it directly into your source code
  • Use placeholders for dynamic content—like names, dates, and other variables—to ensure it displays properly across all languages
  • Configure your software to load the appropriate translation files based on user language preferences
  • If relevant, provide a language switcher so users can easily change languages


You can get your software ready for global use, no matter what programming language it uses. PTC works with all major languages and frameworks. 

Follow this tutorial for general guidelines, or check out our step-by-step tutorials for help with:

Step 1: Avoid Hard-Coding Text

You work with two types of content in software: user-facing text and the code that powers the functionality.

Hard-coding text directly into your code can cause issues when translating. For example, if you hard-code “Submit” into your HTML, you’ll need to search through the entire codebase to change it during translation. This can:

  • Slow down the translation process
  • Increase the chance of missing text
  • Introduce bugs

To avoid this, don’t hard-code any visible text. Instead, pull those strings into a separate file, often referred to as a resource file

This leads us to the next key step.

Step 2: Organize Text into Resource Files 

Resource files store all the user-facing text from your software—everything from button labels and error messages to prompts and notifications. This text is often referred to as “strings.” By organizing these strings into resource files, you keep them separate from your code, making it easier to manage translations and updates.

Different frameworks rely on various formats for resource files. Here’s a look at common formats and how they organize translatable text:

.po

PO (Portable Object)

Common in PHP-based projects like WordPress

Example of Resource File with Source Language Text:

po 

msgid "Welcome to our site!"
msgstr ""

msgid "Submit"
msgstr ""

.json

JSON (JavaScript Object Notation)

Used in JavaScript frameworks like React or Vue

Example of Resource File with Source Language Text:

Json

{
  "welcome_message": "Welcome to our site!",
  "submit_button": "Submit”
}

.yaml

YAML (YAML Ain’t Markup Language)

Common in Ruby on Rails

Example of Resource File with Source Language Text:

Yaml

en:
  welcome_message: "Welcome to our site!"
  submit_button: "Submit"

.strings

STRINGS

Used by iOS apps

Example of Resource File with Source Language Text:

Strings

"welcome_message" = "Welcome to our site!";
"submit_button" = "Submit";

.xml

XML (Extensible Markup Language)

Used in Android apps

Example of Resource File with Source Language Text:

Xml

<stringname="welcome_message">Welcome</string> <stringname="submit_button">Submit</string>

Most frameworks provide internationalization functions or libraries that help you identify text for translation and store it in resource files. These tools simplify the process by letting you mark user-facing text directly in the code, so you don’t need to manually organize the strings. For example:

  • In React and Vue, libraries like react-intl and vue-i18n provide you with a way to load and use translation files. The translations are then stored in the JSON files you generate.
  • Ruby on Rails includes the I18n module.
  • WordPress uses the __() function to mark strings for translation, which then get compiled into PO files.

PTC works with all localization resource file formats. From PO and JSON to YAML, STRINGS, and XML, PTC automatically handles translations and keeps them up-to-date with every code change.

Step 3: Use Placeholders to Handle Dynamic Content

Now that you’ve separated your translatable text and organized it into resource files, you need to handle dynamic content. Dynamic content—such as usernames, dates, or any variable information—requires placeholders to avoid breaking your translations.

Placeholders allow you to insert dynamic values at runtime. For instance, instead of writing “Hello, John!” directly, you’d use a placeholder for the person’s name, like this:

PO File:

msgid "Hello, %s!"
msgstr ""

JSON File:

{
  "greeting": "Hello, {name}!"
}

YAML File:

greeting: "Hello, %{name}!"

The exact format of placeholders depends on the library or framework you’re using, and it’s usually customizable. For example, in Rails, placeholders might look like %{name}, while in Android they appear as %1$s. The flexibility to define placeholder formats allows you to adapt them to your specific needs.

When you send your software for translation, placeholders remain untouched. PTC’s AI-powered translation system recognizes placeholders as markers for where dynamic content will go.

Step 4: Make Sure Your Software Knowns How to Load Resource Files

With your translatable text organized into resource files and your placeholders set up, your software needs to know how to load the right resource files based on the user’s language. Here’s how it works in different environments:

  • React/Vue: Use libraries like react-intl or vue-i18n, which handle loading the correct files at runtime
  • Ruby on Rails: The I18n module loads YAML translation files automatically
  • WordPress: Automatically uses PO and MO files according to the language settings in the user’s admin panel

For mobile apps, platforms like Android and iOS load resource files differently:

  • Android: Stores translation files in the res/values directory, with subfolders for each language (e.g., res/values-fr for French). Android loads the correct language file based on the device’s system settings.
  • iOS: Uses .lproj directories for localized strings (e.g., en.lproj for English, fr.lproj for French). iOS loads the right language based on the device settings.

Step 5: Set the Default Language Based on Browser Settings

When building multilingual software, it’s important you make sure that users can interact with your software in their language from the start. 

For mobile apps, the device automatically handles language settings based on the system preferences, so you don’t need to do anything. In web applications, however, you’ll need to identify the user’s preferred language. You can do this by detecting the user’s browser language and setting it as the default.

Here’s how you can set the default language based on the browser settings in different frameworks:

React/Vue

Use the i18next-browser-languagedetector library to automatically detect the browser language. This library checks the browser’s language settings and applies the appropriate language as the default.

Ruby on Rails

Detect the browser language using the HTTP_ACCEPT_LANGUAGE header and set the language with I18n.locale.

WordPress

WordPress relies on the language settings configured in the site’s backend. When users set their site to a specific language, WordPress will load the corresponding translation files for your theme or plugin’s UI.

Step 6: Add a Language Switcher (When Relevant)

Once you’ve set the default language, it’s important to give users the flexibility to change it. Some users may prefer a different language than the one their browser or system selects automatically.

To provide them with this option, you can add a language switcher, usually in the form of a dropdown or button.

Here’s how you can implement a language switcher across different frameworks:

  • In React or Vue, localization libraries like react-intl and vue-i18n only give you the option to set the language. You need to build the language switcher (such as a dropdown or button) yourself. The app then reloads the correct resource files based on the user’s language choice.
  • In Ruby on Rails, the I18n library allows you to programmatically change the language, but you’re responsible for creating the language switcher interface. Once a user selects a language, the app reloads the page with the correct YAML file for that language.
  • In WordPress, your theme or plugin automatically uses the language set in the site’s backend. For translating user-generated content and providing a front-end language switcher, users will need a multilingual plugin like WPML.

While most mobile apps automatically match the language the user has set on their device, you can also set up a language switcher in the app’s settings. This allows users to:

  • Manually change the language within the app
  • Override the system’s default language

You can use both methods—automatic system language and a manual switcher— in the same mobile app. The app can start with the system language but give users the option to switch languages if they want to. This combination offers both convenience and control for users.

Step 7: Translate Your Resource File with PTC

Once you’ve set up your resource file and prepared it for translation, PTC makes it easy to translate your file into multiple languages.

PTC’s Free resource files translation tool offers a fast, efficient, and completely free way to translate your resource files. It supports all common resource file formats, including PO, JSON, YAML, STRINGS, and XML. 

You only need to upload your resource files, choose the languages you want to translate to, and let PTC automatically translate text using advanced AI-powered translations.

The original JSON resource file in English and the Spanish translations generated by PTC

Coming soon – PTC Subscription

While PTC’s free resource files translation tool is a great starting point, PTC’s full subscription offers premium features at a very low price. Even better, it comes with a 30-day free trial, so you can experience the full functionality risk-free—no commitment required.

With a full subscription, you can:

Enjoy powerful AI translations

PTC takes the time to understand the context of your project. It then combines advanced AI with proprietary technology to deliver Better Than Human Translations.

Integrate translations with your Git flow

PTC automatically translates your resource file(s) and sends the translations to your code repository as a merge request.

Enjoy continuous localization

In PTC, you can choose to automatically update translations whenever you add or change content. This way, you’ll keep your project fully localized at all times and give users a smooth experience in all languages.

Create a personalized glossary

Ensure consistent translations by building a custom glossary of terms specific to your project. This glossary will be applied automatically across all project translations.

When you purchase the full PTC subscription, you gain access to all these features and can translate as many resource files as you need.

Start Preparing Your Software for Translation Now

Preparing your software for translation may take some upfront work, but it pays off by making your app accessible to users worldwide.

By organizing your text into resource files, handling dynamic content properly, and avoiding hard-coded strings, you can set up your project for success in multiple languages.

With PTC, you’ll get high-quality translations quickly. Once you prepare your resource files, PTC generates Better Than Human Translations that require little to no manual revisions. Translations arrive in minutes, not weeks, and at a very low cost.

Whether you’re working on a small app or a large software project, PTC streamlines the translation process, allowing you to focus on development while ensuring accurate and up-to-date translations.

Developer Guides

How to Prepare for Software Translation: A Step-by-Step Guide

Scroll to Top