I display messages using code snippets but how can I use the right language?

You already have it in the code:

__( 'Your message will only be visible after manual moderation', 'your_text_domain' )

__ is a translation function and part of the static string translation system in WordPress core. Polylang might allow you to translate dynamic content, but __() and its friends are for static strings. These use the standardised gettext format of .po and .pot/.mo files, with each file listing out all the strings and their counterpart in another language. Each language has its own file.

This system is great for user interfaces, and theme/plugin strings that don’t change. Do not try to use it with variables and dynamic data though.

Normally you would need to change the language of your site to switch these to another language for everybody, but since you have Polylang you can use its built in language selection tools to switch between languages.

See the internationalisation section of the theme handbook.

E.g. if you had this:

<h1>A big title</h1>

Then it would be best practice to make this translatable e.g.

<h1><?php echo __( 'A big title', 'text-domain-goes-here' ); ?></h1>

Notice each call specifies a text domain which lets it know to use the string from your theme/plugin.