Skip to content

[localize] ph function #1890

@aomarks

Description

@aomarks

Add a ph function which allows specifying a human-readable name and example to placeholders to help translators.

import {ph} from '@lit/localize/ph.js';

msg(
 html`Hello ${ph(this.user.fullName, {
   name: "FULL_USER_NAME",
   example: "Jane Doe",
 })}`
);

XLIFF doesn't appear to have an element explicitly for examples, so we could encode it as:

<x id="FULL_USER_NAME (e.g. Jane Doe)"/>

In XLB I think we can encode this as:

<ph name="FULL_USER_NAME"><ex>Jane Doe</ex></ph>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    📋 Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions