Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

untymage's avatar

Force user to write in specific language (Validation)

Is that possible ? For example i want to user writes only in arabic

0 likes
1 reply
ARG's avatar

If this is server-side validation to detect the language of a post, then you could use a library like the ones discussed in these threads to detect the language and to return an error if the language is not Arabic:

Users would still be able to type non-Arabic text into the field on the client side, but it would prevent, for example, a user from posting comments in Japanese onto an Arabic website.

There could also be a character whitelist on the client and/or server-side, implemented similarly to what is discussed here:

1 like

Please or to participate in this conversation.