In reply to Caspar Hübinger.

Caspar, thanks for starting this discussion.

I was thinking about the possible ways of implementation.

If we needed a language attribute for posts only the ideal solution would be to add new "post_language" or just "language" column to posts DB table. Then extend the WP_Query with this new parameter and add a couple of post language related functions just like you did in your code. I think it would be the most natural way of handling that, keeping the relation between post and postmeta intact.

In this logic, WordPress comment, term and user tables should also be extended with a "language" column.

Unfortunatelly, that solution is impossible or at least not recommended to do in a plugin - it would require an involvment of the WP core team.

My second idea idea is to create 2 new DB tables similar to terms and term_relationships, for eg. languages and language_relationships. Language would store the languages you have in your site, language_relationships would contain the relationships beetween objects (posts, comments, terms, users) and the language. There's would be no need to extend existing tables here.