Passing a translated string to variable or translate an option array for form select field

Hi,

i have an array of possible user roles as options for a select input field while create or update a user.

[“role” => “role name”, …]

How can i let translate the role name for selection?

Thank you

Mat

The translation function __() takes a string as argument, so you can simply do something like __( $roles[‘role’] ).