Skip to content
This repository was archived by the owner on Jul 11, 2026. It is now read-only.
This repository was archived by the owner on Jul 11, 2026. It is now read-only.

i18n format placeholders order #24

Open

Description

@deluxghost

A language may have different word order from English. Consider an example sentence:

Sentence {foo} {bar}.

that will be formatted to:

Sentence <b>foo</b> <i>bar</i>.

While translating to another language, the translator might need to change the order of placeholders:

{Bar} {foo} seeeenteeeeenceeee.

This will still be formatted in the original order like this:

<b>Bar</b> <i>foo</i> seeeenteeeeenceeee.

Many i18n frameworks have placeholders with number:

Sentence {1} {2}.

these placeholders can be moved to break the order and still work.

While I really like your placeholder concept, I suggest adding a feature like this, add an order number as a prefix:

Sentence {1:foo} {2:bar}.

therefore we can translate it like this:

{2:Bar} {1:foo} seeeenteeeeenceeee.

Activity

  1. ShadyMedic commented on Aug 19, 2022

    @ShadyMedic
    Collaborator

    Heya, thanks for your suggestion. We've been thinking about this issue before emerging the translation branch to master, but since there are no strings with multiple different format tags (at least as far as I remembered), we didn't think of this being an issue for now.

    But yeah, it might become an issue in the future, so I'll try to implement it the way you suggested once I have a little more time again.

  2. self-assigned this
    on Aug 19, 2022
  3. deluxghost commented on Aug 19, 2022

    @deluxghost
    ContributorAuthor

    There might be some way to also improve how we handle the news page i18n. Currently, at least we can't change these punctuation marks, since we are translating only parts of sentences. (yeah... there might be word order problems too, in the future)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions