Register a translatable string

pom_translate_register_string( string $name, string $source, string $group = 'polylang', bool $multiline = false ): int creates or updates a registered source string and returns its storage ID, or 0 on failure.

add_action(
    'init',
    static function (): void {
        if ( function_exists( 'pom_translate_register_string' ) ) {
            pom_translate_register_string( 'acme.checkout.notice', 'Delivery takes 2–3 days.' );
        }
    }
);

Choose a stable namespaced identifier. The current storage contract uses the name and source value; the legacy group and multiline arguments remain accepted but are not separate storage dimensions.

Register stable public interface text, not user records, order data, tokens, or values that change on every request. Registration writes storage, so do it in a bounded initialization, activation, save, or migration path rather than inside a template loop.

Changing the source under the same name updates the registered entry. Review translations after a semantic source change.

Read by registration name

pom_translate_registered_string( string $name, string $source, string $locale = '' ): string reads a translation using the same stable name. Omit the locale to use the current language. It does not register or change strings during rendering.

$source = 'Delivery takes 2–3 days.';
$text = function_exists('pom_translate_registered_string')
    ? pom_translate_registered_string('acme.checkout.notice', $source)
    : $source;
echo esc_html($text);

Use named lookup when identical originals need different translations in different contexts. The caller must escape the result for its output context. Missing translations and source values that no longer match the registration return the supplied source. Matching older text-based registrations remain a fallback when there is no named translation.

The pom/forms/ namespace belongs to POM Forms. Those entries use explicit form rendering and are excluded from automatic source-text replacements in unrelated page HTML.