Skip to content

Runtime translations use case (ICU Message Syntax support) #62

@apellerano-pw

Description

@apellerano-pw

I think this API could be really valuable as a way for websites to easily offer translations in more languages. Lots of websites do diminishing returns assessments on their visitors or target markets, and only provide translation digests in a handful of languages. It would be cost or time prohibitive to perform further static compilation of every possible language.

But it could be easy for them to add support for many more languages at runtime, if they could offload the task to the Translator API whenever an official translation digest isn't available.

I think most websites would have their strings stored in Unicode's ICU format, so this format would be the ideal input into a proposed translateICU call.

The advantage of ICU format is that it can provide additional context to the LLM, such as which tokens should not be translated as they are Proper or proprietary terms, and metadata about pluralization, gender, declension, etc.

How to performantly cache results (IndexedDB etc) should be left as an exercise for the website, and not a concern of this API.

translator.translateICU('Eat {numEggs} {numEggs, plural, =1 {egg} other {eggs}}?')`

This API would compose with the context support in #9 to create even more accurate translations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions