30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Extract Strings To Template

translations/extract-strings scans a bundle’s source code for translatable strings and writes a fresh POT template.

It is how a bundle with no template gets one, and how a stale template catches up with code that has moved on.

At a glance

Abilitytranslations/extract-strings
ToolsetLoco Translate — toolset/loco-translate
GroupLoco Translate › Maintenance
RequiresLoco Translate, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI Abilities Manager 0.0.34 and later

The gate on this one

Requires confirm: true, because a template is the thing every translation is measured against. Strings that no longer appear in the source are dropped from the new template — and on the next translations/sync-translations they are dropped from every translation too, taking the translated text with them.

How it works

The number to read afterwards is skipped_files. Loco refuses to scan source files over its size limit, and any translatable string inside one of those is simply absent from the template.

That matters because a template can look complete — a healthy string count, no errors — while missing every string in the largest file in the plugin. Reporting the skip count is the only way that becomes visible.

Nothing is translated by this. It produces the list of what could be translated; translations/sync-translations then brings each locale into line with it.

Input

NameTypeRequiredWhat it is
bundlestringYesBundle id, handle or slug — all three appear in Loco’s own screens. Use core for WordPress itself.
domainstringNoText domain. Omit for the bundle default.

What comes back

NameTypeWhat it is
filestringThe POT template that was written.
string_countintegerHow many strings it holds.
skipped_filesintegerSource files Loco refused to scan for exceeding its size limit. Any string in them is missing from this template.
bytesintegerSize of the template written.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation.

Example

Ask your assistant:

Rebuild the POT template for our custom plugin — we added a lot of new strings.

It resolves to one call:

{
  "ability": "translations/extract-strings",
  "parameters": {
    "bundle": "acrossai-abilities-manager",
    "confirm": true
  }
}

Worth knowing

  • Check skipped_files. Anything above zero means the template is incomplete in a way the string count will not show you.
  • Sync afterwards, and expect to see translations dropped for strings the source no longer contains.
  • Not idempotent — each run rewrites the template from whatever the source says now.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading