Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n format placeholders order #24

Open
deluxghost opened this issue Aug 19, 2022 · 2 comments
Open

i18n format placeholders order #24

deluxghost opened this issue Aug 19, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@deluxghost
Copy link
Contributor

deluxghost commented Aug 19, 2022

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.
@ShadyMedic
Copy link
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.

@ShadyMedic ShadyMedic added the enhancement New feature or request label Aug 19, 2022
@ShadyMedic ShadyMedic self-assigned this Aug 19, 2022
@deluxghost
Copy link
Contributor Author

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
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants