wordpress notice

I’d guess the problem is the end(), which accepts an array reference. Try saving the explode() result in a variable and passing that to end():

$path_components = @explode( get_template(), str_replace( '\\', "https://wordpress.stackexchange.com/", dirname( __FILE__ ) ) );
$path = ltrim( end( $path_components ), "https://wordpress.stackexchange.com/" );
define( 'OT_LANG_DIR', trailingslashit( trailingslashit( get_template_directory() ) . $path ) .
                       trailingslashit( 'languages' ) . 'theme-mode' );

Or there are plenty of other ways to get the last element of an array you could use instead of end().