20 $language =
'en', $msg_keys = [], $params = []
22 if ( count( $msg_keys ) < 1 ) {
23 throw new InvalidArgumentException( __FUNCTION__ .
" BAD PROGRAMMER. No message keys given." );
26 # look for the first message that exists
27 foreach ( $msg_keys as $m ) {
28 if ( WmfFramework::messageExists( $m, $language ) ) {
29 return WmfFramework::formatMessage( $m, $params );
33 # we found nothing in the requested language, return the first fallback message that exists
34 foreach ( $msg_keys as $m ) {
35 if ( WmfFramework::messageExists( $m, $language ) ) {
36 return WmfFramework::formatMessage( $m, $params );
40 # somehow we still don't have a message, return a default error message
41 return WmfFramework::formatMessage( $msg_keys[0], $params );