Skip to content

[Validator] Add "Translatable Objects" example #19054

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

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

cavasinf
Copy link
Contributor

Resolve #19049

@alexandre-daubois
Copy link
Member

First of all, congrats on your first doc contribution!

I think we can make this even simpler. Just after "You may need to clear your cache (even in the dev environment) after creating this file for the first time.", we could add something like:

You can also use :class:`Ns\\TranslatableMessage` to build your violation message::

// Your PHP example

You can learn more about translatable messages in :ref:`the dedicated section <translatable-objects>`.

If you can, try not to get further than 80 chars lines 🙂

@cavasinf
Copy link
Contributor Author

Sure 👍
I made it shorter as you recommended.

I still have the code blocks error about an undefined class.
Looking at https://github.com/symfony/symfony-docs/blob/6.4/reference/constraints/NotBlank.rst it is made the same way, am I missing something?

@alexandre-daubois
Copy link
Member

I think it's safe to ignore the error of the codeblocks as we're importing a "folder" here (and the parser is surely looking for some class or something)

@cavasinf
Copy link
Contributor Author

I think it's safe to ignore the error of the codeblocks as we're importing a "folder" here (and the parser is surely looking for some class or something)

Good to go then 🤔

Copy link
Member

@alexandre-daubois alexandre-daubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a little nitpick, otherwise it's fine to me! 🙂

@javiereguiluz javiereguiluz changed the base branch from 6.4 to 6.3 October 25, 2023 11:25
@javiereguiluz
Copy link
Member

Nice update! Florian, thanks for adding this and for your patience during the review process (thanks to Alex for reviewing it too).

And congrats on your first Symfony Docs contribution 🎉

@javiereguiluz javiereguiluz merged commit 56c3af1 into symfony:6.3 Oct 25, 2023
@cavasinf cavasinf deleted the patch-1 branch October 25, 2023 12:46
@SebTM
Copy link

SebTM commented Mar 12, 2024

Hey, not sure about this - stumbled on the docs and for v7 and at least v6 I'm using atm.

https://github.com/symfony/validator/tree/7.0/Context#L157
https://github.com/symfony/validator/blob/6.4/Context/ExecutionContext.php#L157

this seems not working and triggers an error now as it's typed to string and has translation built-in ✌🏻

@xabbuh
Copy link
Member

xabbuh commented Mar 20, 2024

@SebTM Please open a new issue if you think that you discovered a bug. Comments on merged PRs are likely to get lost.

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

Successfully merging this pull request may close these issues.

[validation/translations] Add TranslatableMessage class to doc
6 participants