Get the content inside shortcode and apply external function to it?

The following adds the shortcode [my_t_shortcode], which accepts an attribute ‘lang’, and applys the above mentioned function to the content.

//Add shortcodes
add_shortcode( 'my_t_shortcode', 'wpse41477_shortcode_handler' );

//It's good practise to make sure your functions are prefixed by something unique
function wpse41477_shortcode_handler( $atts, $content = null ) {
       //This will extract 'lang' attribute as $lang. You can supply default values too.
       extract( shortcode_atts( array(
          'lang' => 'default_lang',
          ), $atts ) );
    //The above lowercases all values.

    /* Apply external function. 'display' is too generic, 
     * give it a unique prefix to prevent a clash with another plugin/theme/WordPress 
     */
    $content = wpse41477_display($content,13);
    //why not do $content = mb_substr($content,0,13); instead?

    //Apply divs
    $content = "<div id='translator' class="translate_".$lang."">".$content."</div>";

    //Not sure what the following is for, but I've left it in.
    if($lang == $_SESSION['language']):
        return $content;
    endif;
    }

And the custom function:

function wpse41477_display($shortcodecontent, $noofchars){
     $content2 = mb_substr($shortcodecontent,0,$noofchars);
return $content2;
}

If that all wpse41477_display does, I would strongly recommend that you include it directly in the shortcode handler (see the comments).

The above code is not tested.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)