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

Start free trial

Get Translation String

translations/get-string reads a single string out of a POT or a translation, addressed by its exact source text.

It is the confirmation step before a write: does this string exist, in this domain, in this locale, spelled exactly this way?

At a glance

Abilitytranslations/get-string
ToolsetLoco Translate — toolset/loco-translate
GroupLoco Translate › Strings
RequiresLoco Translate, active on the site
Capabilitymanage_options
SafetyRead-only — changes nothing
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI Abilities Manager 0.0.34 and later

How it works

The source must match the file byte for byte. A trailing space, a curly apostrophe where the source has a straight one, an ellipsis character instead of three dots — any of those makes it a different string as far as gettext is concerned.

context disambiguates when the same source text appears more than once. Gettext uses it precisely so that “Post” the noun and “Post” the verb can be translated differently.

The fuzzy flag is worth reading before overwriting. A fuzzy string already has a translation that somebody thought was close; replacing it blindly discards that.

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.
localestringNoLocale such as de_DE. Omit to address the POT template instead of a translation.
sourcestringYesThe exact source text, as it appears in the file.
contextstringNoGettext context, when the same source text appears more than once.

What comes back

NameTypeWhat it is
stringobjectSource, translation, context, references and fuzzy flag.
filestringThe file that was read.
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:

What is “Add to cart” currently translated as in French?

It resolves to one call:

{
  "ability": "translations/get-string",
  "parameters": {
    "bundle": "woocommerce",
    "locale": "fr_FR",
    "source": "Add to cart"
  }
}

Worth knowing

  • Byte-for-byte match. Copy the source from translations/list-strings rather than retyping it.
  • Pass context when the same text appears twice, or you may read the wrong one.
  • A fuzzy result means somebody already tried. Read it before replacing it.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading