URL Structure for translated articles

One option is a Rewrite Endpoint (or multiple endpoints).

The language would be appended to a single post URL, all translations could be stored in post meta attached to that single post.

For example, the article URL is:

http://example.com/article-1/

with a single endpoint the translated article could be:

http://example.com/article-1/lang/de/

The code for adding that endpoint is pretty simple:

function wpd_language_endpoint() {
    add_rewrite_endpoint( 'lang', EP_PERMALINK );
}
add_action( 'init', 'wpd_language_endpoint' );

Then you can filter the_content() function to substitute the translation. For example, say the above translation is stored under the key lang_de, we check if a language has been requested and we output the translation if that key exists:

function wpd_language_content( $content ){
    if( false !== get_query_var( 'lang', false )
        && in_array( 'lang_' . get_query_var( 'lang' ), get_post_custom_keys( get_the_ID() ) ) ){
            return get_post_meta( get_the_ID(), 'lang_' . get_query_var( 'lang' ), true );
    }
    return $content;
}
add_filter( 'the_content', 'wpd_language_content', 0 );

The multiple endpoint strategy would work much like above, but for a more abbreviated URL, you could add an endpoint for each language:

function wpd_language_endpoint() {
    add_rewrite_endpoint( 'de', EP_PERMALINK );
    add_rewrite_endpoint( 'es', EP_PERMALINK );
    add_rewrite_endpoint( 'ja', EP_PERMALINK );
    // etc..
}
add_action( 'init', 'wpd_language_endpoint' );

Then your URL would be:

http://example.com/article-1/de/

Your other code would then have to change to possibly check from an array of potential languages to determine which has been requested. In that case, it’s maybe easier to access the query object directly to get the language:

global $wp_query;

$languages = [
    'es' => 'es',
    'de' => 'de',
    'ja' => 'ja'
];

$keys = array_intersect_key( $languages, $wp_query->query );

if( ! empty( $keys ) ){
    $lang = current( $keys );
    echo 'language is' . $lang;
}