Include language variable in url

In your example

Change this:

public function custom_permastruct() 
{
    add_permastruct('language', '%lang%', false);
}

to this:

public function custom_permastruct() 
{
    add_rewrite_tag('%lang%','(lang)s','post_type=");
    add_permastruct("language', '%lang%', false);
}

Please note that this will only work on WordPress 3.4+

Other ways of doing it:

You need to create a new permalink and after to set some rewrite rules. The function add_permastruct is a good start.
You can find a good example here: http://shibashake.com/wordpress-theme/wordpress-permalink-add and also here: https://code.tutsplus.com/articles/the-rewrite-api-post-types-taxonomies–wp-25488

That’s a media library example, but you can use the same functionality for your language module.