WP Manifestindependent plugin directory
manifest / i18n / polylang-rest-strings

Polylang REST Strings

Extends Polylang Pro to have REST API support for Polylang UI string translations.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/bloxweaver/polylang-rest-strings/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Extends Polylang Pro to have REST API support for Polylang UI string translations.

Features

  • List registered strings with translations via REST API
  • Get single string with all language translations
  • Update string translations for specific languages
  • Batch update multiple translations efficiently
  • Export strings as XLIFF format
  • Import strings from XLIFF format
  • Filter by translation status (translated/untranslated)
  • Filter by modification timestamp for incremental sync
  • Filter by string context/group

Requirements

  • WordPress 6.0 or later
  • PHP 7.4 or later
  • Polylang (free or Pro)
  • Polylang Pro required for XLIFF export/import

Installation

  1. Install by uploading and Activating Plugin, or Copy the plugin to /wp-content/plugins/polylang-rest-strings
  2. Activate via WordPress admin Plugins page
  3. Ensure Polylang is installed and activated

REST Endpoints

Method Endpoint Description
GET /wp-json/pll-strings/v1/strings List registered strings with translations
GET /wp-json/pll-strings/v1/strings/{id} Get single string with all language translations
PUT /wp-json/pll-strings/v1/strings/{id} Update string translation for a language
POST /wp-json/pll-strings/v1/strings/batch Batch update multiple translations
POST /wp-json/pll-strings/v1/strings/export Export strings as XLIFF
POST /wp-json/pll-strings/v1/strings/import Import strings from XLIFF payload

Query Parameters

Parameter Type Description
lang string Language code to check translation status against
status string Filter: translated, untranslated, all (default: all)
modified_after ISO 8601 Strings modified after this timestamp (incremental sync)
context string Filter by string context/group (e.g., WordPress, URL slugs)
page int Pagination page number (default: 1)
per_page int Results per page (default: 100, max: 500)

Examples

List all strings

curl -u "$USER:$PASS" "$SITE/wp-json/pll-strings/v1/strings"

Filter untranslated strings for French

curl -u "$USER:$PASS" "$SITE/wp-json/pll-strings/v1/strings?lang=fr&status=untranslated"

Filter by context

curl -u "$USER:$PASS" "$SITE/wp-json/pll-strings/v1/strings?context=URL%20slugs"

Incremental sync (modified after timestamp)

curl -u "$USER:$PASS" "$SITE/wp-json/pll-strings/v1/strings?modified_after=2026-01-23T14:20:00Z"

Update a single translation

curl -X PUT -u "$USER:$PASS" \
  -H "Content-Type: application/json" \
  -d '{"lang": "fr", "translation": "Déployez-le !"}' \
  "$SITE/wp-json/pll-strings/v1/strings/51adf5e3840efc0f3c09610363a30fb2"

Batch update multiple translations

curl -X POST -u "$USER:$PASS" \
  -H "Content-Type: application/json" \
  -d '{"translations": [
    {"id": "51adf5e3840efc0f3c09610363a30fb2", "lang": "fr", "translation": "Déployez-le !"},
    {"id": "c4ef352f74e502ef5e7bc98e6f4e493d", "lang": "fr", "translation": "categorie"},
    {"id": "e4d23e841d8e8804190027bce3180fa5", "lang": "fr", "translation": "etiquette"}
  ]}' \
  "$SITE/wp-json/pll-strings/v1/strings/batch"

Response:

{
  "success": true,
  "updated": 3,
  "total": 3,
  "errors": []
}

Export as XLIFF

curl -X POST -u "$USER:$PASS" \
  -H "Content-Type: application/json" \
  -d '{"target_lang": "fr", "untranslated_only": true}' \
  "$SITE/wp-json/pll-strings/v1/strings/export"

Import from XLIFF

curl -X POST -u "$USER:$PASS" \
  -H "Content-Type: application/json" \
  -d '{"xliff": "<?xml version=\"1.0\"?>...", "target_lang": "fr"}' \
  "$SITE/wp-json/pll-strings/v1/strings/import"

Modification Tracking

Polylang doesn't track timestamps natively. This plugin stores modification times in a WordPress option (pll_string_timestamps):

{
  "md5_hash": {
    "registered": "2026-01-23T14:15:55+00:00",
    "last_modified": "2026-01-23T14:26:41+00:00"
  }
}

Timestamps update when:

  • A translation is updated via PUT /strings/{id}
  • A batch update modifies the string
  • An XLIFF import updates the string

Permissions

All endpoints require the manage_options capability.

License

MIT License - see LICENSE file.