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

[RFC] Translatable HTTP response payloads #49688

Closed
ro0NL opened this issue Mar 14, 2023 · 1 comment
Closed

[RFC] Translatable HTTP response payloads #49688

ro0NL opened this issue Mar 14, 2023 · 1 comment
Labels
RFC RFC = Request For Comments (proposals about features that you want to be discussed)

Comments

@ro0NL
Copy link
Contributor

ro0NL commented Mar 14, 2023

Description

In a controller it would be nice for i18n if we're able to do:

action() {
   return $this->json(['message' => new t('id')]);
}

The payload would contain the translated string, eg. {"message": "translated"}.

Note if one wants a custom payload, eg. {"message": {"id": ..., "domain": ...}} i tend to prefer a custom normalizer instead, or control it by a context option.

Example

No response

@carsonbot carsonbot added the RFC RFC = Request For Comments (proposals about features that you want to be discussed) label Mar 14, 2023
@ro0NL
Copy link
Contributor Author

ro0NL commented Mar 27, 2023

invoking translator service is relatively easy also 👍

@ro0NL ro0NL closed this as completed Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC RFC = Request For Comments (proposals about features that you want to be discussed)
Projects
None yet
Development

No branches or pull requests

2 participants