Index: trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/class-translation-editors-list-table.php
===================================================================
--- trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/class-translation-editors-list-table.php	(revision 0)
+++ trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/class-translation-editors-list-table.php	(working copy)
@@ -0,0 +1,182 @@
+<?php
+
+if ( ! class_exists( 'WP_List_Table' ) ) {
+	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
+}
+
+class Rosetta_Translation_Editors_List_Table extends WP_List_Table {
+
+	public $role;
+
+	public $user_can_promote;
+
+	/**
+	 * Constructor.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		parent::__construct( array(
+			'singular' => 'translation-editor',
+			'plural'   => 'translation-editors',
+			'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+
+		$this->role = $args['role'];
+		$this->user_can_promote = current_user_can( 'promote_users' );
+	}
+
+	/**
+	 * Prepare the list for display.
+	 */
+	public function prepare_items() {
+		$search = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
+		$per_page = 20;
+		$paged = $this->get_pagenum();
+
+		$args = array(
+			'number' => $per_page,
+			'offset' => ( $paged - 1 ) * $per_page,
+			'role'   => $this->role,
+			'search' => $search,
+			'fields' => 'all_with_meta'
+		);
+
+		if ( '' !== $args['search'] ) {
+			$args['search'] = '*' . $args['search'] . '*';
+		}
+
+		if ( isset( $_REQUEST['orderby'] ) ) {
+			$args['orderby'] = $_REQUEST['orderby'];
+		}
+
+		if ( isset( $_REQUEST['order'] ) ) {
+			$args['order'] = $_REQUEST['order'];
+		}
+
+		$user_query = new WP_User_Query( $args );
+		$this->items = $user_query->get_results();
+
+		$columns = $this->get_columns();
+		$hidden = array();
+		$sortable = $this->get_sortable_columns();
+		$this->_column_headers = array( $columns, $hidden, $sortable );
+
+		$this->set_pagination_args( array(
+			'total_items' => $user_query->get_total(),
+			'per_page'    => $per_page,
+		) );
+	}
+
+	/**
+	 * Output 'no users' message.
+	 */
+	public function no_items() {
+		_e( 'No users were found.', 'rosetta' );
+	}
+
+	/**
+	 * Get a list of columns for the list table.
+	 *
+	 * @return array Array in which the key is the ID of the column,
+	 *               and the value is the description.
+	 */
+	public function get_columns() {
+		return array(
+			'cb'       => '<input type="checkbox" />',
+			'username' => __( 'Username', 'rosetta' ),
+			'name'     => __( 'Name', 'rosetta' ),
+			'email'    => __( 'E-mail', 'rosetta' ),
+		);
+	}
+
+	/**
+	 * Get a list of sortable columns for the list table.
+	 *
+	 * @return array Array of sortable columns.
+	 */
+	protected function get_sortable_columns() {
+		return array(
+			'username' => 'login',
+			'name'     => 'name',
+			'email'    => 'email',
+		);
+	}
+
+	/**
+	 * Return a list of bulk actions available on this table.
+	 *
+	 * @return array Array of bulk actions.
+	 */
+	protected function get_bulk_actions() {
+		return array(
+			'remove' => _x( 'Remove', 'user', 'rosetta' ),
+		);
+	}
+
+	/**
+	 * Generates content for a single row of the table.
+	 *
+	 * @param WP_User $user The current user.
+	 */
+	public function single_row( $user ) {
+		$user->filter = 'display';
+		parent::single_row( $user );
+	}
+
+	/**
+	 * Prints the checkbox column.
+	 *
+	 * @param WP_User $user The current user.
+	 */
+	public function column_cb( $user ) {
+		if ( $this->user_can_promote ) {
+			?>
+			<label class="screen-reader-text" for="cb-select-<?php echo $user->ID; ?>"><?php _e( 'Select user', 'rosetta' ); ?></label>
+			<input id="cb-select-<?php echo $user->ID; ?>" type="checkbox" name="translation-editors[]" value="<?php echo $user->ID; ?>" />
+			<?php
+		}
+	}
+
+	/**
+	 * Prints the username column.
+	 *
+	 * @param WP_User $user The current user.
+	 */
+	public function column_username( $user ) {
+		$avatar = get_avatar( $user->ID, 32 );
+
+		if ( $this->user_can_promote ) {
+			$page_url = menu_page_url( 'translation-editors', false );
+			$edit_link = esc_url( add_query_arg( 'user_id', $user->ID, $page_url ) );
+			$edit = "<strong><a href=\"$edit_link\">$user->user_login</a></strong>";
+
+			$actions = array();
+			$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit', 'rosetta' ) . '</a>';
+			$actions['remove'] = '<a class="submitdelete" href="' . wp_nonce_url( $page_url . "&amp;action=remove-translation-editor&amp;translation-editor=$user->ID", 'remove-translation-editor' ) . '">' . __( 'Remove', 'rosetta' ) . '</a>';
+			$edit .= $this->row_actions( $actions );
+		} else {
+			$edit = "<strong>$user->user_login</strong>";
+		}
+
+		echo "$avatar $edit";
+	}
+
+	/**
+	 * Prints the name column.
+	 *
+	 * @param WP_User $user The current user.
+	 */
+	public function column_name( $user ) {
+		echo "$user->first_name $user->last_name";
+	}
+
+	/**
+	 * Prints the email column.
+	 *
+	 * @param WP_User $user The current user.
+	 */
+	public function column_email( $user ) {
+		echo "<a href='mailto:$user->user_email'>$user->user_email</a>";
+	}
+}
Index: trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/js/rosetta-roles.js
===================================================================
--- trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/js/rosetta-roles.js	(revision 0)
+++ trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/js/rosetta-roles.js	(working copy)
@@ -0,0 +1,44 @@
+( function( $ ) {
+
+	$(function() {
+		var $projects = $( 'input.project' );
+
+		if ( $projects.length ) {
+			var $allProjects = $( '#project-all' ),
+				checked = [];
+
+			// Uncheck "All" if a project is checked.
+			$projects.on( 'change', function() {
+				$allProjects.prop( 'checked', false );
+				checked = [];
+			} );
+
+			// (Un)check projects if "All" is (un)checked.
+			$allProjects.on( 'change', function() {
+				if ( this.checked ) {
+					$projects.each( function( index, checkbox ) {
+						var $cb = $( checkbox );
+						if ( $cb.prop( 'checked' ) ) {
+							checked.push( $cb.attr( 'id' ) );
+							$cb.prop( 'checked', false );
+						}
+					} );
+				} else {
+					for ( i = 0; i < checked.length; i++ ) {
+						$( '#' +  checked[ i ] ).prop( 'checked', true );
+					}
+					checked = [];
+				}
+			} );
+
+			// Uncheck all checkboxes.
+			$( '#clear-all' ).on( 'click', function( event ) {
+				event.preventDefault();
+
+				checked = [];
+				$allProjects.prop( 'checked', false );
+				$projects.prop( 'checked', false );
+			} );
+		}
+	} );
+} )( jQuery );
Index: trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/rosetta-roles.php
===================================================================
--- trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/rosetta-roles.php	(revision 1403)
+++ trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/rosetta-roles.php	(working copy)
@@ -1,44 +1,473 @@
 <?php
+/**
+ * Plugin Name: Rosetta Roles
+ * Plugin URI: https://wordpress.org/
+ * Description: WordPress interface for managing roles.
+ * Author: Dominik Schilling
+ * Version: 1.0
+ */
 
-add_filter( 'gettext_with_context', 'ros_rename_user_roles', 10, 4 );
-function ros_rename_user_roles( $translated, $text, $context, $domain ) {
-	if ( $domain !== 'default' || $context !== 'User role' ) {
-		return $translated;
+class Rosetta_Roles {
+
+	/**
+	 * Holds the role of a Translation Editor.
+	 *
+	 * @var string
+	 */
+	public $translation_editor_role = 'translation_editor';
+
+	/**
+	 * Attaches hooks once plugins are loaded.
+	 */
+	public function plugins_loaded() {
+		add_filter( 'editable_roles', array( $this, 'editable_roles' ) );
+		add_filter( 'manage_users_columns',  array( $this, 'add_roles_column' ) );
+		add_filter( 'manage_users_custom_column',  array( $this, 'display_user_roles' ), 10, 3 );
+		add_action( 'admin_init', array( $this, 'role_modifications' ) );
+		add_action( 'set_user_role', array( $this, 'restore_translation_editor_role' ), 10, 3 );
+		add_filter( 'gettext_with_context', array( $this, 'rename_user_roles' ), 10, 4 );
+		add_action( 'user_row_actions', array( $this, 'user_row_action_role_editor' ), 10, 2 );
+		add_action( 'admin_menu',  array( $this, 'register_translation_editors_page' ) );
 	}
-	if ( 'Validator' === $text ) {
-		return __( 'Validator', 'rosetta' );
+
+	/**
+	 * Registers "Translation Editor" role and modifies editor role.
+	 */
+	public function role_modifications() {
+		if ( ! get_role( $this->translation_editor_role ) ) {
+			add_role( $this->translation_editor_role, __( 'Translation Editor', 'rosetta' ), array( 'read' => true, 'level_0' => true ) );
+		}
+
+		$editor_role = get_role( 'editor' );
+		if ( $editor_role && ! $editor_role->has_cap( 'remove_users' ) ) {
+			$editor_role->add_cap( 'edit_theme_options' );
+			$editor_role->add_cap( 'list_users' );
+			$editor_role->add_cap( 'promote_users' );
+			$editor_role->add_cap( 'remove_users' );
+		}
+
+		// Remove deprecated validator role.
+		/*$validator_role = get_role( 'validator' );
+		if ( $validator_role ) {
+			remove_role( 'validator' );
+		}*/
 	}
-	return $translated;
-}
 
-add_action( 'admin_menu', 'ros_remove_widgets_menu' );
-function ros_remove_widgets_menu() {
-	remove_submenu_page( 'themes.php', 'themes.php' );
-	remove_submenu_page( 'themes.php', 'widgets.php' );
-}
+	/**
+	 * Restores the "Translation Editor" role if an user is promoted.
+	 *
+	 * @param int    $user_id   The user ID.
+	 * @param string $role      The new role.
+	 * @param array  $old_roles An array of the user's previous roles.
+	 */
+	public function restore_translation_editor_role( $user_id, $role, $old_roles ) {
+		if ( ! in_array( $this->translation_editor_role, $old_roles ) ) {
+			return;
+		}
 
-add_filter( 'editable_roles', 'ros_editable_roles' );
-function ros_editable_roles( $roles ) {
-	$subscriber = $roles['subscriber'];
-	unset( $roles['subscriber'] );
-	reset( $roles );
-	$roles['subscriber'] = $subscriber;
-	if ( ! is_super_admin() && ! is_main_site() ) {
-		unset( $roles['administrator'] );
+		$user = new WP_User( $user_id );
+		$user->add_role( $this->translation_editor_role );
 	}
-	return $roles;
-}
 
-add_filter( 'admin_init', 'ros_role_modifications' );
-function ros_role_modifications() {
-	if ( ! get_role( 'validator' ) ) {
-		add_role( 'validator', __( 'Validator', 'rosetta' ), array( 'read' => true, 'level_0' => true ) );
+	/**
+	 * Removes "Translation Editor" role and "Administrator" role from
+	 * the list of editable roles.
+	 *
+	 * The list used in wp_dropdown_roles() on users list table.
+	 *
+	 * @param array $all_roles List of roles.
+	 * @return array Filtered list of editable roles.
+	 */
+	public function editable_roles( $roles ) {
+		unset( $roles[ $this->translation_editor_role ] );
+
+		if ( ! is_super_admin() && ! is_main_site() ) {
+			unset( $roles['administrator'] );
+		}
+
+		return $roles;
 	}
-	$editor_role = get_role( 'editor' );
-	if ( $editor_role && ! $editor_role->has_cap( 'remove_users' ) ) {
-		$editor_role->add_cap( 'edit_theme_options' );
-		$editor_role->add_cap( 'list_users' );
-		$editor_role->add_cap( 'promote_users' );
-		$editor_role->add_cap( 'remove_users' );
+
+	/**
+	 * Translates the "Translation Editor" role.
+	 *
+	 * @param string $translation Translated text.
+	 * @param string $text        Text to translate.
+	 * @param string $context     Context information for the translators.
+	 * @param string $domain      Text domain.
+	 * @return string Translated user role.
+	 */
+	public function rename_user_roles( $translation, $text, $context, $domain ) {
+		if ( $domain !== 'default' || $context !== 'User role' ) {
+			return $translation;
+		}
+
+		if ( 'Translation Editor' === $text ) {
+			return __( 'Translation Editor', 'rosetta' );
+		}
+
+		return $translation;
 	}
+
+	/**
+	 * Replaces the "Role" column with a "Roles" column.
+	 *
+	 * @param array $columns An array of column headers.
+	 * @return array An array of column headers.
+	 */
+	public function add_roles_column( $columns ) {
+		$posts = $columns['posts'];
+		unset( $columns['role'], $columns['posts'] );
+		reset( $columns );
+		$columns['roles'] = __( 'Roles', 'rosetta' );
+		$columns['posts'] = $posts;
+
+		return $columns;
+	}
+
+	/**
+	 * Displays a comma separated list of user's roles.
+	 *
+	 * @param string $output      Custom column output.
+	 * @param string $column_name Column name.
+	 * @param int    $user_id     ID of the currently-listed user.
+	 * @return string Comma separated list of user's roles.
+	 */
+	public function display_user_roles( $output, $column_name, $user_id ) {
+		global $wp_roles;
+
+		if ( 'roles' == $column_name ) {
+			$user_roles = array();
+			$user = new WP_User( $user_id );
+			foreach ( $user->roles as $role ) {
+				$role_name = $wp_roles->role_names[ $role ];
+				$role_name = translate_user_role( $role_name );
+				$user_roles[] = $role_name;
+			}
+
+			return implode( ', ', $user_roles );
+		}
+
+		return $output;
+	}
+
+	/**
+	 * Registers page for managing translation editors.
+	 */
+	public function register_translation_editors_page() {
+		$this->translation_editors_page = add_users_page(
+			__( 'Translation Editors', 'rosetta' ),
+			__( 'Translation Editors', 'rosetta' ),
+			'list_users',
+			'translation-editors',
+			array( $this, 'render_translation_editors_page' )
+		);
+
+		add_action( 'load-' . $this->translation_editors_page, array( $this, 'load_translation_editors_page' ) );
+		add_action( 'admin_print_scripts-' . $this->translation_editors_page, array( $this, 'enqueue_scripts' ) );
+	}
+
+	/**
+	 * Enqueues scripts.
+	 */
+	public function enqueue_scripts() {
+		wp_enqueue_script( 'rosetta-roles', plugins_url( '/js/rosetta-roles.js', __FILE__ ), array( 'jquery' ), '1', true );
+	}
+
+	/**
+	 * Loads either the overview or the edit handler.
+	 */
+	public function load_translation_editors_page() {
+		if ( ! empty( $_REQUEST['user_id'] ) ) {
+			$this->load_edit_translation_editor( $_REQUEST['user_id'] );
+		} else {
+			$this->load_translation_editors();
+		}
+	}
+
+	/**
+	 * Renders either the overview or the edit view.
+	 */
+	public function render_translation_editors_page() {
+		if ( ! empty( $_REQUEST['user_id'] ) ) {
+			$this->render_edit_translation_editor( $_REQUEST['user_id'] );
+		} else {
+			$this->render_translation_editors();
+		}
+	}
+
+	/**
+	 * Handler for overview page.
+	 */
+	private function load_translation_editors() {
+		global $wpdb;
+
+		$list_table = $this->get_translation_editors_list_table();
+		$action = $list_table->current_action();
+		$redirect = menu_page_url( 'translation-editors', false );
+
+		if ( $action ) {
+			switch ( $action ) {
+				case 'add-translation-editor':
+					check_admin_referer( 'add-translation-editor', '_nonce_add-translation-editor' );
+
+					if ( ! current_user_can( 'promote_users' ) ) {
+						wp_redirect( $redirect );
+						exit;
+					}
+
+					$user_details = null;
+					$user = wp_unslash( $_REQUEST['user'] );
+					if ( false !== strpos( $user_email, '@' ) ) {
+						$user_details = get_user_by( 'email', $user );
+					} else {
+						$user_details = get_user_by( 'login', $user );
+					}
+
+					if ( ! $user_details ) {
+						wp_redirect( add_query_arg( array( 'error' => 'no-user-found' ), $redirect ) );
+						exit;
+					}
+
+					if ( ! is_user_member_of_blog( $user_details->ID ) ) {
+						wp_redirect( add_query_arg( array( 'error' => 'not-a-member' ), $redirect ) );
+						exit;
+					}
+
+					if ( user_can( $user_details, $this->translation_editor_role ) ) {
+						wp_redirect( add_query_arg( array( 'error' => 'user-exists' ), $redirect ) );
+						exit;
+					}
+
+					$user_details->add_role( $this->translation_editor_role );
+
+					wp_redirect( add_query_arg( array( 'update' => 'user-added' ), $redirect ) );
+					exit;
+				case 'remove-translation-editors':
+					check_admin_referer( 'bulk-translation-editors' );
+
+					if ( ! current_user_can( 'promote_users' ) ) {
+						wp_redirect( $redirect );
+						exit;
+					}
+
+					if ( empty( $_REQUEST['translation-editors'] ) ) {
+						wp_redirect( $redirect );
+						exit;
+					}
+
+					$count = 0;
+					$meta_key = $wpdb->get_blog_prefix() . 'allowed_translate_projects';
+					$user_ids = array_map( 'intval', (array) $_REQUEST['translation-editors'] );
+					foreach ( $user_ids as $user_id ) {
+						$user = get_user_by( 'id', $user_id );
+						$user->remove_role( $this->translation_editor_role );
+						delete_user_meta( $user_id, $meta_key );
+						$count++;
+					}
+
+					wp_redirect( add_query_arg( array( 'update' => 'user-removed', 'count' => $count ), $redirect ) );
+					exit;
+				case 'remove-translation-editor':
+					check_admin_referer( 'remove-translation-editor' );
+
+					if ( ! current_user_can( 'promote_users' ) ) {
+						wp_redirect( $redirect );
+						exit;
+					}
+
+					if ( empty( $_REQUEST['translation-editor'] ) ) {
+						wp_redirect( $redirect );
+						exit;
+					}
+
+					$user_id = (int) $_REQUEST['translation-editor'];
+					$user = get_user_by( 'id', $user_id );
+					$user->remove_role( $this->translation_editor_role );
+					$meta_key = $wpdb->get_blog_prefix() . 'allowed_translate_projects';
+					delete_user_meta( $user_id, $meta_key );
+
+					wp_redirect( add_query_arg( array( 'update' => 'user-removed' ), $redirect ) );
+					exit;
+			}
+		}
+	}
+
+	/**
+	 * Handler for editing a translation editor.
+	 *
+	 * @param  int $user_id User ID of a translation editor.
+	 */
+	private function load_edit_translation_editor( $user_id ) {
+		global $wpdb;
+
+		$redirect = menu_page_url( 'translation-editors', false );
+		$user_details = get_user_by( 'id', $user_id );
+
+		if ( ! $user_details ) {
+			wp_redirect( add_query_arg( array( 'error' => 'no-user-found' ), $redirect ) );
+			exit;
+		}
+
+		if ( ! is_user_member_of_blog( $user_details->ID ) ) {
+			wp_redirect( add_query_arg( array( 'error' => 'not-a-member' ), $redirect ) );
+			exit;
+		}
+
+		if ( ! user_can( $user_details, $this->translation_editor_role ) ) {
+			wp_redirect( add_query_arg( array( 'error' => 'user-cannot' ), $redirect ) );
+			exit;
+		}
+
+		$action = $_REQUEST['action'];
+		switch ( $action ) {
+			case 'update-translation-editor':
+				check_admin_referer( 'update-translation-editor_' . $user_details->ID );
+
+				$redirect = add_query_arg( 'user_id', $user_details->ID, $redirect );
+
+				$projects = $this->get_translate_top_level_projects();
+				$projects = wp_list_pluck( $projects, 'id' );
+				$projects = array_map( 'intval', $projects );
+
+				$allowed_projects = (array) $_REQUEST['projects'];
+				$allow_all_projects = in_array( 'all', $allowed_projects );
+
+				if ( $allow_all_projects ) {
+					$allowed_projects = array( 'all' );
+				} else {
+					$allowed_projects = array_map( 'intval', $allowed_projects );
+					$allowed_projects = array_values( array_intersect( $projects, $allowed_projects ) );
+				}
+
+				$meta_key = $wpdb->get_blog_prefix() . 'allowed_translate_projects';
+				update_user_meta( $user_details->ID, $meta_key, $allowed_projects );
+
+				wp_redirect( add_query_arg( array( 'update' => 'user-updated' ), $redirect ) );
+				exit;
+		}
+	}
+
+	/**
+	 * Renders the overview page.
+	 */
+	private function render_translation_editors() {
+		$list_table = $this->get_translation_editors_list_table();
+		$list_table->prepare_items();
+
+		$feedback_message = $this->get_feedback_message();
+
+		require __DIR__ . '/views/translation-editors.php';
+	}
+
+	/**
+	 * Renders the edit page.
+	 */
+	private function render_edit_translation_editor( $user_id ) {
+		global $wpdb;
+
+		$projects = $this->get_translate_top_level_projects();
+
+		$meta_key = $wpdb->get_blog_prefix() . 'allowed_translate_projects';
+		$allowed_projects = get_user_meta( $user_id, $meta_key, true );
+		if ( ! $allowed_projects ) {
+			$allowed_projects = array();
+		}
+
+		$feedback_message = $this->get_feedback_message();
+
+		require __DIR__ . '/views/edit-translation-editor.php';
+	}
+
+	/**
+	 * Returns a feedback message based on the current request.
+	 *
+	 * @return string HTML formatted message.
+	 */
+	private function get_feedback_message() {
+		$message = '';
+		if ( ! empty( $_REQUEST['update'] ) && ! empty( $_REQUEST['error'] ) ) {
+			return $message;
+		}
+
+		$count = empty( $_REQUEST['count'] ) ? 1 : (int) $_REQUEST['count'];
+
+		$messages = array(
+			'update' => array(
+				'user-updated' => __( 'Translation Editor updated.', 'rosetta' ),
+				'user-added'   => __( 'New Translation Editor added.', 'rosetta' ),
+				'user-removed' => sprintf( _n( '%s Translation Editor removed.', '%s Translation Editors removed.', $count, 'rosetta' ), number_format_i18n( $count ) ),
+			),
+
+			'error' => array(
+				'no-user-found' => __( 'The user couldn&#8217;t be found.', 'rosetta' ),
+				'not-a-member'  => __( 'The user is not a member of this site.', 'rosetta' ),
+				'user-cannot'   => __( 'The user is not a Translation Editor.', 'rosetta' ),
+				'user-exists'   => __( 'The user is already a Translation Editor.', 'rosetta' ),
+			),
+		);
+
+		if ( isset( $_REQUEST['error'], $messages['error'][ $_REQUEST['error'] ] ) ) {
+			$message = sprintf(
+				'<div class="notice notice-error"><p>%s</p></div>',
+				$messages['error'][ $_REQUEST['error'] ]
+			);
+		} elseif( isset( $_REQUEST['update'], $messages['update'][ $_REQUEST['update'] ] ) ) {
+			$message = sprintf(
+				'<div class="notice notice-success"><p>%s</p></div>',
+				$messages['update'][ $_REQUEST['update'] ]
+			);
+		}
+
+		return $message;
+	}
+
+	/**
+	 * Wrapper for the custom list table which lists translation editors.
+	 *
+	 * @return Rosetta_Translation_Editors_List_Table The list table.
+	 */
+	private function get_translation_editors_list_table() {
+		static $list_table;
+
+		require_once __DIR__ . '/class-translation-editors-list-table.php';
+
+		if ( null !== $list_table ) {
+			return $list_table;
+		}
+
+		$args = array(
+			'role' => $this->translation_editor_role,
+		);
+		$list_table = new Rosetta_Translation_Editors_List_Table( $args );
+
+		return $list_table;
+	}
+
+	/**
+	 * Fetches all top level projects from translate.wordpress.org.
+	 *
+	 * @return array List of projects.
+	 */
+	private function get_translate_top_level_projects() {
+		global $wpdb;
+
+		$cache = get_site_transient( 'translate-top-level-projects' );
+		if ( false !== $cache ) {
+			return $cache;
+		}
+
+		$projects = $wpdb->get_results( "
+			SELECT id, name
+			FROM translate_projects
+			WHERE parent_project_id IS NULL
+			ORDER BY name ASC
+		" );
+
+		set_site_transient( 'translate-top-level-projects', $projects, DAY_IN_SECONDS );
+
+		return $projects;
+	}
 }
+
+$GLOBALS['rosetta_roles'] = new Rosetta_Roles();
Index: trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/views/edit-translation-editor.php
===================================================================
--- trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/views/edit-translation-editor.php	(revision 0)
+++ trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/views/edit-translation-editor.php	(working copy)
@@ -0,0 +1,47 @@
+<div class="wrap">
+	<h2><?php _e( 'Edit Translation Editor', 'rosetta' ); ?></h2>
+
+	<?php echo $feedback_message; ?>
+
+	<form method="post">
+		<table class="form-table">
+			<tbody>
+				<tr>
+					<th scope="row">
+						<?php _e( 'Allowed Projects', 'rosetta' ); ?><br>
+						<small style="font-weight:normal"><a href="#clear-all" id="clear-all"><?php _ex( 'Clear All', 'projects', 'rosetta' ); ?></a></small>
+					</th>
+					<td>
+						<fieldset>
+							<legend class="screen-reader-text"><span><?php _e( 'Allowed Projects', 'rosetta' ); ?></span></legend>
+							<p>
+								<label for="project-all">
+									<input name="projects[]" id="project-all" value="all" type="checkbox"<?php checked( in_array( 'all', $allowed_projects ) ); ?>> <?php _ex( 'All', 'projects', 'rosetta' ); ?>
+								</label>
+							</p>
+							<?php
+							foreach ( $projects as $project ) {
+								printf(
+									'<p><label for="project-%d"><input name="projects[]" id="project-%d" class="project" value="%d" type="checkbox"%s> %s</label></p>',
+									$project->id,
+									$project->id,
+									$project->id,
+									checked( in_array( $project->id, $allowed_projects ), true, false ),
+									$project->name
+								);
+							}
+							?>
+						</fieldset>
+					</td>
+				</tr>
+			</tbody>
+		</table>
+
+		<input type="hidden" name="action" value="update-translation-editor">
+		<input type="hidden" name="user_id" value="<?php echo esc_attr( $user_id ); ?>">
+		<?php
+		wp_nonce_field( 'update-translation-editor_' . $user_id );
+		submit_button( _x( 'Update', 'user', 'rosetta' ) );
+		?>
+	</form>
+</div>
Index: trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/views/translation-editors.php
===================================================================
--- trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/views/translation-editors.php	(revision 0)
+++ trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/views/translation-editors.php	(working copy)
@@ -0,0 +1,38 @@
+<div class="wrap">
+	<h2>
+		<?php
+		_e( 'Translation Editors', 'rosetta' );
+
+		if ( ! empty( $_REQUEST['s'] ) ) {
+			echo '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;', 'rosetta' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' ) ) . '</span>';
+		}
+		?>
+	</h2>
+
+	<?php echo $feedback_message; ?>
+
+	<form method="get">
+		<input type="hidden" name="page" value="translation-editors">
+		<?php $list_table->search_box( __( 'Search Translation Editors', 'rosetta' ), 'rosetta' ); ?>
+	</form>
+
+	<form method="post">
+		<?php $list_table->display(); ?>
+	</form>
+
+	<?php if ( current_user_can( 'promote_users' ) ) : ?>
+	<h3><?php _e( 'Add Translation Editor', 'rosetta' ); ?></h3>
+	<p><?php _e( 'Enter the email address or username of an existing user on this site.' ); ?></p>
+	<form action="" method="post">
+		<input type="hidden" name="action" value="add-translation-editor">
+		<table class="form-table">
+			<tr>
+				<th scope="row"><label for="user"><?php _e( 'E-mail or Username', 'rosetta' ); ?></label></th>
+				<td><input type="text" class="regular-text" name="user" id="user"></td>
+			</tr>
+		</table>
+		<?php wp_nonce_field( 'add-translation-editor', '_nonce_add-translation-editor' ) ?>
+		<?php submit_button( __( 'Add Translation Editor', 'rosetta' ) ); ?>
+	</form>
+	<?php endif; ?>
+</div>
