Supported Resource File Formats for Translation with PTC
PTC (Private Translation Cloud) supports various resource file formats that store translatable text like app labels, error messages, and user content.
For supported file formats, PTC provides two translation workflows:
- Upload any supported file type to Free resource files translation and choose the languages you want to translate into. In minutes, you’ll get back the automatic translations, ready for you to download and add to your project.
- With a PTC subscription, you connect PTC to your code repository and select a branch to manage translations. PTC automatically detects files needing translation, understands your project’s context, and delivers Better Than Human Translations. These translations are sent back as a merge request.
Below, you can find all the file formats that PTC supports, along with examples that will help you in preparing them for translation.
On This Page
Gettext (POT, PO)
Technical Overview
File Extensions:
- .pot (Portable Object Template): This file acts as a template, listing all the translatable strings in the original language.
- .po (Portable Object): This file contains the actual translations in both the original and target languages.
Common Use Cases:
- Open-source projects, like WordPress themes and plugins
- Python internationalization
Structure:
Each .po file contains key elements:
- msgid: The original string in the source language
- msgstr: The corresponding translation in the target language
Encoding:
UTF-8
Example
po
msgid "Hello, world!"
msgstr "Hola, mundo!"
How to prepare Gettext PO and POT files for translation with PTC
JSON (JavaScript Object Notation)
Technical Overview
File Extension:
- .json
Common Use Cases:
- Web applications (React, Angular, Vue.js)
- Mobile apps (iOS, Android)
Structure:
- Key-Value Pairs
JSON files often store text in simple key-value pairs. Each key represents the original string, and each value holds the translation.
Encoding:
UTF-8
Example
Source language file
json
{
"welcome_message": "Welcome to our app!",
"error_message": "Something went wrong. Please try again."
}
In a translated file, the values change to the target language:
json
{
"welcome_message": "¡Bienvenido a nuestra aplicación!",
"error_message": "Algo salió mal. Inténtalo de nuevo."
}
JSON Array
JSON also supports arrays for storing multiple related strings, such as lists of steps or options. Each item in the array represents a translatable string.
Source language file:
json
{
"steps": [
"Open the app.",
"Log in to your account.",
"Select your profile."
]
}
File with translations:
json
{
"steps": [
"Abre la aplicación.",
"Inicia sesión en tu cuenta.",
"Selecciona tu perfil."
]
}
How to prepare JSON files for translation with PTC
YAML (YAML Ain’t Markup Language)
Technical Overview
File Extension:
.yaml or .yml
Common Use Cases:
- Ruby on Rails applications (for managing translatable strings)
- Web applications and static site generators (e.g., Jekyll, Hugo)
- Configuration files for CI/CD pipelines and software projects
Structure:
YAML uses a clean, indented structure for key-value pairs. Each key represents the original string, and the value contains the translation.
Encoding:
UTF-8
Example
Source language file
yml
welcome_message: "Welcome to our app!"
error_message: "Something went wrong. Please try again."
In a translated YAML file, the values change to the target language:
yml
welcome_message: "¡Bienvenido a nuestra aplicación!"
error_message: "Algo salió mal. Inténtalo de nuevo."
How to prepare YAML files for translation with PTC
Android Strings (XML)
Technical Overview
File Extension:
.xml
Common Use Cases:
- Android mobile apps (UI strings and messages)
Structure:
Android XML string files follow a structured format, with each string wrapped in <string> tags and identified by a unique key.
Encoding:
UTF-8
Example
Source language file
xml
<resources>
<string name="welcome_message">Welcome to our app!</string>
<string name="error_message">Something went wrong. Please try again.</string>
</resources>
When translated, only the values inside the tags change, while the keys remain the same:
xml
<resources>
<string name="welcome_message">¡Bienvenido a nuestra aplicación!</string>
<string name="error_message">Algo salió mal. Inténtalo de nuevo.</string>
</resources>
How to prepare Android XML files for translation with PTC
Apple Strings
Technical Overview
File Extension:
.strings
Common Use Cases:
- iOS and macOS applications (UI strings, system messages, etc.)
Structure:
Each .strings file uses a simple key-value format where the key is the original text in the app, and the value holds the translation. You can add comments to provide context to translators.
Encoding:
UTF-16 encoding by default, with the option to convert .strings files to UTF-8 encoding
Example
Source language:
strings
/* Welcome message shown on the home screen */
"welcome_message" = "Welcome to our app!";
/* Error message when something goes wrong */
"error_message" = "Something went wrong. Please try again.";
In a translated file, the values change to reflect the target language, while the keys stay in the source language:
strings
/* Welcome message shown on the home screen */
"welcome_message" = "¡Bienvenido a nuestra aplicación!";
/* Error message when something goes wrong */
"error_message" = "Algo salió mal. Inténtalo de nuevo.";
Apple Stringsdict
Technical Overview
File Extension:
.stringsdict
Common Use Cases:
- iOS and macOS applications (handling plural forms, dynamic content, or gender-based language)
Structure:
A .stringsdict file uses nested dictionaries to define multiple versions of a string based on the values of variables. It allows you to provide both singular and plural versions of a message based on a numeric value.
Encoding:
Like .strings files, .stringsdict files typically use UTF-8 or UTF-16 encoding.
Example
Source language file:
xml
<plist version="1.0">
<dict>
<key>apples_count</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@apples@</string>
<key>apples</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d apple</string>
<key>other</key>
<string>%d apples</string>
</dict>
</dict>
</dict>
</plist>
In the translated version, only the values for the plural forms change to the target language, while the keys remain the same:
xml
<plist version="1.0">
<dict>
<key>apples_count</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@apples@</string>
<key>apples</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d manzana</string>
<key>other</key>
<string>%d manzanas</string>
</dict>
</dict>
</dict>
</plist>
Apple Property List
Technical Overview
File Extension:
.plist
Common Use Cases:
- iOS and macOS applications (UI text, configuration settings)
Structure:
.plist files organize data in a structured, XML-based format. For localization, they store key-value pairs where the key identifies the string, and the value holds the text you want to translate.
Encoding:
UTF-8 or UTF-16
Example
Source language:
xml
<plist version="1.0">
<dict>
<key>welcome_message</key>
<string>Welcome to our app!</string>
<key>error_message</key>
<string>Something went wrong. Please try again.</string>
</dict>
</plist>
In the translated file, the values change to reflect the target language:
xml
<plist version="1.0">
<dict>
<key>welcome_message</key>
<string>¡Bienvenido a nuestra aplicación!</string>
<key>error_message</key>
<string>Algo salió mal. Inténtalo de nuevo.</string>
</dict>
</plist>
Java Properties
Technical Overview
File Extension:
.properties
Common Use Cases:
- Java-based web applications
- Desktop applications built with Java
- Localization of UI elements, error messages, and system prompts
Structure:
Java properties files use a key-value structure where each key represents an identifier for a translatable string, and the value contains the actual text.
Encoding:
ISO-8859-1 (Latin-1) encoding by default, but you can also use UTF-8 encoding to support a wider range of characters. Special characters often need to be escaped when using ISO-8859-1.
Example
Source language:
properties
welcome_message=Welcome to our app!
error_message=Something went wrong. Please try again.
In the translated version, the values change to reflect the target language, while the keys stay the same:
properties
welcome_message=¡Bienvenido a nuestra aplicación!
error_message=Algo salió mal. Inténtalo de nuevo.
CSV (Magento / Adobe Commerce)
Technical Overview
File Extension:
.csv
Common Use Cases:
- Magento and Adobe Commerce for managing product descriptions, UI labels, and other translatable strings
- Importing and exporting large volumes of localization data in e-commerce platforms
Structure:
CSV files consist of rows, with each row representing a key-value pair. The first column holds the key (usually an identifier or original string), and the second column contains the corresponding translation.
Encoding:
UTF-8
Example
Source language:
csv
"welcome_message","Welcome to our store!"
"error_message","Something went wrong. Please try again."
In the translated version, the second column changes to reflect the target language, while the keys remain the same:
csv
"welcome_message","¡Bienvenido a nuestra tienda!"
"error_message","Algo salió mal. Inténtalo de nuevo."
XLIFF (XML Localization Interchange File Format)
Technical Overview
File Extension:
.xliff
Common Use Cases:
- Software and website localization
- Translation management systems
- Content management systems (CMS) and authoring tools
Structure:
Each .xliff file typically contains key elements within a structured XML format:
<source>
: Contains the original string in the source language<target>
: Contains the corresponding translation in the target language.<trans-unit>
: Defines each translation unit, grouping the<source>
and<target>
pairs. Each<trans-unit>
may have additional metadata, such as identifiers, context information, and status.
Encoding:
UTF-8
Example
<xliff version="1.2">
<file source-language="en" target-language="es">
<body>
<trans-unit id="1">
<source>Hello, world!</source>
<target>Hola, mundo!</target>
</trans-unit>
</body>
</file>
</xliff>
Supported Resource File Formats
Supported Resource File Formats for Translation with PTC