How to Translate JSON Files with PTC

PTC delivers Better Than Human AI translations for JSON files used in web and mobile frameworks like React, Vue.js, Angular, React Native, Swift, and Kotlin. Learn how to prepare and translate your JSON files using PTC.

Translating JSON Files with PTC: First-Time Setup

Your first setup will take a few steps. You’ll structure your JSON files correctly, set up your project in PTC, and provide PTC with the context it needs to deliver great translations. Then, PTC will handle the rest.

Step 1: Add All User-Facing Text to JSON Files

Store every UI string in your JSON files as key-value pairs. PTC reads these keys and values and returns translated versions for the selected languages.

Organize related strings into nested objects to keep files manageable and provide valuable context for translation.

Correct – Well-structured JSON file:

.json:

echo __( 'Read more', 'your-plugin' );
_e( 'Submit', 'your-plugin' );

Code:

console.log(t('homepage.title'));

Incorrect – Hardcoded strings in code:

console.log("Welcome to our site");

Don’t hardcode translatable text directly in your source code. Hardcoded text like this won’t be extracted or translated by PTC.

Step 2: Use Placeholders for Dynamic Values

Use placeholders for variable content like usernames, counts, or dates. This helps preserve sentence structure and grammar in each language.

Your placeholder format may vary depending on your localization library. PTC supports all common placeholder formats, such as {userName}, {name}, %1$s, or {{name}}, so your dynamic content is preserved correctly in translation.

Correct – One full string with placeholders:

.json:

{
  "greeting": "Hello, {userName}! Today is {currentDate}."
}

Code:

const message = t('greeting', { userName: 'Alex', currentDate: 'Monday' });

Incorrect – Split string with concatenation:

{
  "greetingStart": "Hello, ",
  "greetingEnd": "! Today is "
}

const message = t('greetingStart') + userName + t('greetingEnd') + date;

Splitting strings can break grammar and word order in other languages, leading to bad translations.

Step 3: Create a Free PTC Account and Choose How to Use PTC

To start translating your JSON files, create your free 30-day PTC account and choose how you want to work with PTC:

  • Connect your GitHub, GitLab, or Bitbucket repository
    PTC detects your JSON files, watches for changes, and sends updated translations as merge requests. This is the best option for continuous localization.
  • Upload your files manually
    Upload a .json file to see how PTC works. You’ll get a ZIP file with the translations, which you can test in your app. This is a good option for trying out PTC before full integration.
  • Use the API
    Send and receive files programmatically. You control when updates are sent, and PTC responds with translated JSON files.

Step 4: Tell PTC About Your Software and Choose Target Languages

PTC uses context to deliver accurate, natural translations. You’ll need to:

  • Provide the name of your software
  • Describe what it does
  • Say who it’s for

This helps PTC choose the right tone, terminology, and phrasing for each language.

After that, choose the languages you want to translate into. PTC supports 33+ languages.

Step 5: Check the Translated Files

After PTC finishes translating your JSON files, you’ll receive the translated output based on how you chose to connect your project:

  • Git integration: PTC creates a merge request in your repository.
  • Manual upload: You download a ZIP file with the translated files.
  • API: You receive the translated files in the API response.

Look at the translated files and make sure everything looks correct:

  • The files are named and structured as expected
  • All keys are preserved
  • Placeholders are still in place and correctly formatted
  • The files are in the right format for your localization setup

Here’s an example of what a translated file might look like:

{
  "homepage": {
    "title": "Bienvenido a nuestro sitio",
    "description": "Descubre nuestros productos y servicios"
  },
  "form": {
    "submit": "Enviar",
    "reset": "Restablecer",
    "greeting": "Hola, {userName}! ¿Cómo podemos ayudarte hoy?"
  },
  "footer": {
    "contact": "Contáctanos",
    "terms": "Términos del servicio",
    "privacy": "Política de privacidad"
  }
}

If you didn’t use Git integration, place the translated files in the correct folder manually or update your configuration so your app can find them.

If anything looks off, go to Settings in your PTC dashboard to adjust file paths, branches, or placeholder formats.

Step 6: Make Sure Your Software Loads the Translated Files

Make sure your software loads the correct JSON file based on the user’s selected or detected language.

If your project already uses a localization library like i18next or vue-i18n, and your file paths match its expected structure, you don’t need to make further changes.

If not, check that:

  • Your software’s configuration points to the correct folders and filenames
  • Your language selection logic is working and loading the right file for each language

Once set up correctly, your software will automatically display translations based on the selected or detected language.

Bonus Step: Translate Content That Isn’t Stored in JSON Files

PTC handles all your JSON translation automatically, but if your software includes translatable content that isn’t stored in JSON files, you can translate it manually using Paste to translate.

Common use cases include:

  • Email content
  • App store listings 
  • Release notes
  • Other content not tracked in version control but still part of the user experience

To translate this type of content:

  1. Navigate to your PTC project dashboard
  2. Go to Translations → Paste to translate
  3. Add your text, choose the languages, and get instant translations

These translations aren’t added to your codebase automatically—you’ll need to paste them into your app store listing, release notes, or email configuration.

How PTC Keeps Your Translations Up to Date

If you use Git integration, PTC automatically updates your translations when your source JSON files change. It detects any new or modified strings, translates them, and creates a new merge request.

If you’re using the PTC API with your CI library, automate translation updates by making the steps run as part of your CI/CD workflow.

If you uploaded files manually, you’ll need to re-upload updated files each time. For automatic translation updates, consider switching to Git integration, which allows translation to happen in the background.

Start Translating Your JSON Files with PTC

Sign up for a free 30-day trial. PTC delivers Better Than Human translations you don’t need to review or edit, so you can focus on development instead of managing localization.

Scroll to Top