first commit
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
class WPML_TM_Wizard_Translation_Editor_Step extends WPML_Twig_Template_Loader {
|
||||
|
||||
private $model = array(
|
||||
'editor_types' => array(
|
||||
'ate' => ICL_TM_TMETHOD_ATE,
|
||||
'classic' => ICL_TM_TMETHOD_EDITOR,
|
||||
'manual' => ICL_TM_TMETHOD_MANUAL,
|
||||
),
|
||||
);
|
||||
/**
|
||||
* @var WPML_TM_MCS_ATE
|
||||
*/
|
||||
private $mscs_ate;
|
||||
|
||||
public function __construct( WPML_TM_MCS_ATE $mcs_ate, $current_mode ) {
|
||||
$this->mscs_ate = $mcs_ate;
|
||||
$this->model['current_mode'] = $current_mode;
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
WPML_TM_PATH . '/templates/wizard',
|
||||
$mcs_ate->get_template_path(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$this->add_strings();
|
||||
|
||||
return $this->get_template()->show( $this->model, 'translation-editor-step.twig' );
|
||||
}
|
||||
|
||||
public function add_strings() {
|
||||
|
||||
$this->model['strings'] = array(
|
||||
'title' => __( 'What translation tool do you want to use?', 'wpml-translation-management' ),
|
||||
'options' => array(
|
||||
'classic' => array(
|
||||
'heading' => __( "WPML's Classic Translation Editor", 'wpml-translation-management' ),
|
||||
|
||||
),
|
||||
'ate' => array(
|
||||
'heading' => __( "WPML's Advanced Translation Editor", 'wpml-translation-management' ),
|
||||
'extra_template' => array(
|
||||
'template' => 'mcs-ate-controls.twig',
|
||||
'model' => $this->mscs_ate->get_model(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
'features' => array(
|
||||
array(
|
||||
'label' => __( 'Support for all content types', 'wpml-translation-management' ),
|
||||
'classic' => true,
|
||||
'ate' => true,
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Spell checker', 'wpml-translation-management' ),
|
||||
'classic' => false,
|
||||
'ate' => true,
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Translation Memory', 'wpml-translation-management' ),
|
||||
'classic' => false,
|
||||
'ate' => true,
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Machine Translation', 'wpml-translation-management' ),
|
||||
'classic' => false,
|
||||
'ate' => true,
|
||||
),
|
||||
array(
|
||||
'label' => __( 'Translator preview', 'wpml-translation-management' ),
|
||||
'classic' => false,
|
||||
'ate' => true,
|
||||
),
|
||||
),
|
||||
|
||||
'ate' => $this->mscs_ate->get_model( array( 'wizard' => true ) ),
|
||||
|
||||
'select' => __( 'Select', 'wpml-translation-management' ),
|
||||
'continue' => __( 'Continue', 'wpml-translation-management' ),
|
||||
'go_back' => __( 'Go back', 'wpml-translation-management' ),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,369 @@
|
||||
<?php
|
||||
|
||||
class WPML_TM_Wizard_Summary_Step extends WPML_Twig_Template_Loader {
|
||||
|
||||
private $model = array();
|
||||
|
||||
/** @var WPML_Translator_Records $translator_records */
|
||||
private $translator_records;
|
||||
|
||||
/** @var WPML_TP_Service $active_translation_service */
|
||||
private $active_translation_service;
|
||||
|
||||
/** @var array $who_will_translate_mode */
|
||||
private $who_will_translate_mode;
|
||||
|
||||
public function __construct(
|
||||
WPML_Translator_Records $translator_records,
|
||||
$who_will_translate_mode,
|
||||
WPML_TP_Service $active_translation_service = null
|
||||
) {
|
||||
parent::__construct(
|
||||
array(
|
||||
WPML_TM_PATH . '/templates/wizard',
|
||||
)
|
||||
);
|
||||
$this->translator_records = $translator_records;
|
||||
$this->active_translation_service = $active_translation_service;
|
||||
$this->who_will_translate_mode = is_array( $who_will_translate_mode ) ? $who_will_translate_mode : array();
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$this->add_strings();
|
||||
$this->add_translators();
|
||||
$this->add_translation_service();
|
||||
$this->add_mode();
|
||||
|
||||
return $this->get_template()->show( $this->model, 'summary-step.twig' );
|
||||
}
|
||||
|
||||
public function add_strings() {
|
||||
|
||||
$this->model['strings'] = array(
|
||||
'title' => __( 'Summary', 'wpml-translation-management' ),
|
||||
'translation_service' => __( 'Your translation service', 'wpml-translation-management' ),
|
||||
'local_translators' => __( 'Your translators', 'wpml-translation-management' ),
|
||||
'local_summary' => __( 'WPML created the accounts for your translators and sent them instructions.', 'wpml-translation-management' ),
|
||||
'instructions' => $this->get_instructions(),
|
||||
'go_back' => __( 'Go back', 'wpml-translation-management' ),
|
||||
'done' => __( 'Done!', 'wpml-translation-management' ),
|
||||
);
|
||||
}
|
||||
|
||||
public function add_translators() {
|
||||
$this->model['translators'] = $this->translator_records->get_users_with_capability();
|
||||
}
|
||||
|
||||
public function add_translation_service() {
|
||||
$this->model['translation_service'] = $this->active_translation_service;
|
||||
}
|
||||
|
||||
private function add_mode() {
|
||||
$this->model['mode'] = wp_json_encode( $this->who_will_translate_mode );
|
||||
$this->model['only_i'] = $this->is_only_i();
|
||||
}
|
||||
|
||||
private function is_only_i() {
|
||||
return isset( $this->who_will_translate_mode['onlyI'] )
|
||||
? 'true' === $this->who_will_translate_mode['onlyI'] : false;
|
||||
}
|
||||
|
||||
private function has_translators() {
|
||||
return isset( $this->who_will_translate_mode['user'] )
|
||||
? 'true' === $this->who_will_translate_mode['user'] : false;
|
||||
}
|
||||
|
||||
private function has_translation_service() {
|
||||
return isset( $this->who_will_translate_mode['translationService'] )
|
||||
? 'true' === $this->who_will_translate_mode['translationService'] : false;
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
private function get_instructions() {
|
||||
$capability = 'translation_manager';
|
||||
|
||||
$text = '';
|
||||
|
||||
if ( $this->is_only_i() ) {
|
||||
$capability = 'only_i';
|
||||
} elseif ( $this->has_translators() && ! $this->has_translation_service() ) {
|
||||
$capability = 'users_of_this_site_only';
|
||||
} elseif ( $this->has_translation_service() && ! $this->has_translators() ) {
|
||||
$capability = 'ts_only';
|
||||
} elseif ( $this->has_translators() && $this->has_translation_service() ) {
|
||||
$capability = 'users_and_ts';
|
||||
}
|
||||
|
||||
$text .= $this->get_top_instruction( $capability );
|
||||
$text .= $this->get_instruction_items( $capability );
|
||||
$text .= $this->get_bottom_instruction( $capability );
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
private function get_placeholder_value( $key ) {
|
||||
$strings_definitions = array(
|
||||
|
||||
'plus' => array(
|
||||
'open' => '<strong>',
|
||||
/* translators: The word "plus" will be used in other strings and wrapped with HTML tags to make it more prominent */
|
||||
'text' => esc_html__( 'plus', 'wpml-translation-management' ),
|
||||
'close' => '</strong>',
|
||||
),
|
||||
|
||||
'pencil' => array(
|
||||
'open' => '<strong>',
|
||||
/* translators: The word "pencil" will be used in other strings and wrapped with HTML tags to make it more prominent */
|
||||
'text' => esc_html__( 'pencil', 'wpml-translation-management' ),
|
||||
'close' => '</strong>',
|
||||
),
|
||||
|
||||
'language' => array(
|
||||
'open' => '<strong>',
|
||||
/* translators: The word "Language" will be used in other strings and wrapped with HTML tags to make it more prominent */
|
||||
'text' => esc_html__( 'Language', 'wpml-translation-management' ),
|
||||
'close' => '</strong>',
|
||||
),
|
||||
|
||||
'getting_started' => array(
|
||||
'open' => '<a href="https://wpml.org/documentation/getting-started-guide/#how-to-translate-different-kinds-of-content" target="_blank" rel="noopener">',
|
||||
/* translators: "Getting Started Guide" will be used in other strings and wrapped with HTML tags to make it a link to external documentation */
|
||||
'text' => esc_html__( 'Getting Started Guide', 'wpml-translation-management' ),
|
||||
'close' => '</a>',
|
||||
),
|
||||
|
||||
'wpml_tm_management' => array(
|
||||
'open' => '<strong>',
|
||||
/* translators: "WPML > Translation Management" will be used in other strings and wrapped with HTML tags to make it more prominent */
|
||||
'text' => esc_html__( 'WPML > Translation Management', 'wpml-translation-management' ),
|
||||
'close' => '</strong>',
|
||||
),
|
||||
|
||||
'translators' => array(
|
||||
'open' => '<strong>',
|
||||
/* translators: "Translators" will be used in other strings and wrapped with HTML tags to make it more prominent */
|
||||
'text' => esc_html__( 'Translators', 'wpml-translation-management' ),
|
||||
'close' => '</strong>',
|
||||
),
|
||||
|
||||
'translation_roles' => array(
|
||||
'open' => '<strong>',
|
||||
/* translators: "Translation Roles" will be used in other strings and wrapped with HTML tags to make it more prominent */
|
||||
'text' => esc_html__( 'Translation Roles', 'wpml-translation-management' ),
|
||||
'close' => '</strong>',
|
||||
),
|
||||
|
||||
'wpml_tm_translators' => array(
|
||||
'open' => '<strong>',
|
||||
/* translators: "WPML > Translations" will be used in other strings and wrapped with HTML tags to make it more prominent */
|
||||
'text' => esc_html__( 'WPML > Translations', 'wpml-translation-management' ),
|
||||
'close' => '</strong>',
|
||||
),
|
||||
|
||||
'translating_your_content' => array(
|
||||
'open' => '<a href="https://wpml.org/documentation/translating-your-contents/" target="_blank" rel="noopener">',
|
||||
/* translators: "Translation Management" will be used in other strings and wrapped with HTML tags to make it a link to external documentation */
|
||||
'text' => esc_html__( 'Translation Management', 'wpml-translation-management' ),
|
||||
'close' => '</a>',
|
||||
),
|
||||
|
||||
'check_status' => array(
|
||||
'open' => '<strong>',
|
||||
/* translators: "Check status and get translations" will be used in other strings and wrapped with HTML tags to make it more prominent */
|
||||
'text' => esc_html__( 'Check status and get translations', 'wpml-translation-management' ),
|
||||
'close' => '</strong>',
|
||||
),
|
||||
|
||||
'professional_translation_via_wpml' => array(
|
||||
'open' => '<a href="https://wpml.org/documentation/translating-your-contents/professional-translation-via-wpml/" target="_blank" rel="noopener">',
|
||||
/* translators: "successfully using translation services" will be used in other strings and wrapped with HTML tags to make it a link to external documentation */
|
||||
'text' => esc_html__( 'successfully using translation services', 'wpml-translation-management' ),
|
||||
'close' => '</a>',
|
||||
),
|
||||
|
||||
'translation_basket' => array(
|
||||
'open' => '<strong>',
|
||||
/* translators: "Translation Basket" will be used in other strings and wrapped with HTML tags to make it more prominent */
|
||||
'text' => esc_html__( 'Translation Basket', 'wpml-translation-management' ),
|
||||
'close' => '</strong>',
|
||||
),
|
||||
);
|
||||
|
||||
if ( array_key_exists( $key, $strings_definitions ) ) {
|
||||
$string_data = $strings_definitions [ $key ];
|
||||
|
||||
return $this->build_string( $string_data );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
private function get_top_instruction( $capability ) {
|
||||
$strings_definitions = array(
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf(
|
||||
esc_html__( 'You will be the only translator for this site and will be able to translate any page or post. Use the %1$s or a %2$s icon found on the post listing pages in the admin or in the %3$s box when editing content.', 'wpml-translation-management' ),
|
||||
$this->get_placeholder_value( 'plus' ),
|
||||
$this->get_placeholder_value( 'pencil' ),
|
||||
$this->get_placeholder_value( 'language' )
|
||||
),
|
||||
'capabilities' => array( 'only_i' ),
|
||||
),
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => esc_html__( 'You selected users of this site to be your translators. You need to:', 'wpml-translation-management' ),
|
||||
'capabilities' => array( 'users_of_this_site_only' ),
|
||||
),
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => esc_html__( 'You selected a translation service to translate your content. You need to:', 'wpml-translation-management' ),
|
||||
'capabilities' => array( 'ts_only' ),
|
||||
),
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => esc_html__( 'You selected both users of this site and a professional translation service. You need to:', 'wpml-translation-management' ),
|
||||
'capabilities' => array( 'users_and_ts' ),
|
||||
),
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => esc_html__( "You're all set. The user that you've selected as the site's Translation Manager will choose who translates, add translator users and send content for translation.", 'wpml-translation-management' ),
|
||||
'capabilities' => array( 'translation_manager' ),
|
||||
),
|
||||
);
|
||||
|
||||
$results = '';
|
||||
foreach ( $strings_definitions as $definition ) {
|
||||
$results .= $this->build_string( $definition, $capability );
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
||||
}
|
||||
|
||||
private function get_bottom_instruction( $capability ) {
|
||||
$strings_definitions = array(
|
||||
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'Read the %1$s to learn about translating images, menus, widgets and more.', 'wpml-translation-management' ), $this->get_placeholder_value( 'getting_started' ) ),
|
||||
'capabilities' => array( 'only_i', 'ts_only' ),
|
||||
),
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
// translators: %1$s and %2$s will be replaced with "Translation Management" and "Translation Roles" respectively.
|
||||
'text' => sprintf( esc_html__( 'To add more users of this site as translators, go to the %1$s page and click the %2$s tab.', 'wpml-translation-management' ), $this->get_placeholder_value( 'wpml_tm_management' ), $this->get_placeholder_value( 'translation_roles' ) ),
|
||||
'capabilities' => array( 'only_i' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'Visit our documentation to learn more about using %1$s to learn about translating images, menus, widgets and more.', 'wpml-translation-management' ), $this->get_placeholder_value( 'translating_your_content' ) ),
|
||||
'capabilities' => array( 'users_of_this_site_only', 'users_and_ts' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'Visit our documentation to learn more about %1$s.', 'wpml-translation-management' ), $this->get_placeholder_value( 'professional_translation_via_wpml' ) ),
|
||||
'capabilities' => array( 'ts_only' ),
|
||||
),
|
||||
);
|
||||
|
||||
$results = '';
|
||||
foreach ( $strings_definitions as $definition ) {
|
||||
$results .= $this->build_string( $definition, $capability );
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
||||
}
|
||||
|
||||
private function get_instruction_items( $capability ) {
|
||||
$items = array(
|
||||
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'Use the %1$s page to select content for translation and send it to your translators.', 'wpml-translation-management' ), $this->get_placeholder_value( 'wpml_tm_management' ) ),
|
||||
'capabilities' => array( 'users_of_this_site_only', 'users_and_ts' ),
|
||||
),
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'Translators will receive notifications and use the %1$s page to translate the content that you\'ve sent them.', 'wpml-translation-management' ), $this->get_placeholder_value( 'wpml_tm_translators' ) ),
|
||||
'capabilities' => array( 'users_of_this_site_only' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'Use the %1$s page to select content for translation and send it to the translation service.', 'wpml-translation-management' ), $this->get_placeholder_value( 'wpml_tm_management' ) ),
|
||||
'capabilities' => array( 'ts_only' ),
|
||||
),
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'Once the translation jobs are completed, you can get them into your site by using the %1$s button on the %2$s page.', 'wpml-translation-management' ), $this->get_placeholder_value( 'check_status' ), $this->get_placeholder_value( 'wpml_tm_management' ) ),
|
||||
'capabilities' => array( 'ts_only' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'In the %1$s page, choose who will translate.', 'wpml-translation-management' ), $this->get_placeholder_value( 'translation_basket' ) ),
|
||||
'capabilities' => array( 'users_and_ts' ),
|
||||
),
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'Your translators will receive notifications and use the %1$s page to translate the content that you\'ve sent them.', 'wpml-translation-management' ), $this->get_placeholder_value( 'wpml_tm_translators' ) ),
|
||||
'capabilities' => array( 'users_and_ts' ),
|
||||
),
|
||||
array(
|
||||
'open' => '<p>',
|
||||
'close' => '</p>',
|
||||
'text' => sprintf( esc_html__( 'To collect completed translations from the translation service, go to %1$s and click on the %2$s button', 'wpml-translation-management' ), $this->get_placeholder_value( 'wpml_tm_management' ), $this->get_placeholder_value( 'check_status' ) ),
|
||||
'capabilities' => array( 'users_and_ts' ),
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
$results = array();
|
||||
foreach ( $items as $item ) {
|
||||
$results[] = $this->build_string( $item, $capability );
|
||||
}
|
||||
$results = array_filter( $results );
|
||||
|
||||
if ( $results ) {
|
||||
return '<ol><li>' . implode( '</li><li>', $results ) . '</li></ol>';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
private function build_string( $string_data, $capability = null ) {
|
||||
$result = '';
|
||||
if ( ! $capability || ( array_key_exists( 'capabilities', $string_data ) && ( ! $string_data['capabilities'] || in_array( $capability, $string_data['capabilities'] ) ) ) ) {
|
||||
if ( array_key_exists( 'open', $string_data ) ) {
|
||||
$result .= $string_data['open'];
|
||||
}
|
||||
|
||||
$result .= $string_data['text'];
|
||||
|
||||
if ( array_key_exists( 'close', $string_data ) ) {
|
||||
$result .= $string_data['close'];
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
class WPML_TM_Wizard_Who_Will_Translate_Step extends WPML_Twig_Template_Loader {
|
||||
|
||||
private $model = array();
|
||||
|
||||
/** @var WP_User $user */
|
||||
private $user;
|
||||
|
||||
/** @var WPML_Translation_Manager_Settings $translation_manager_settings */
|
||||
private $translation_manager_settings;
|
||||
|
||||
/** @var WPML_TM_Wizard_Translators_Step $translator_settings */
|
||||
private $translator_settings;
|
||||
|
||||
/** @var \WPML\TM\Menu\TranslationServices\SectionFactory $translation_services_factory */
|
||||
private $translation_services_factory;
|
||||
|
||||
/** @var array $who_will_translate_mode */
|
||||
private $who_will_translate_mode;
|
||||
|
||||
public function __construct(
|
||||
WP_User $user,
|
||||
WPML_Translation_Manager_Settings $translation_manager_settings,
|
||||
WPML_Translator_Settings $translator_settings,
|
||||
\WPML\TM\Menu\TranslationServices\SectionFactory $translation_services_factory,
|
||||
$who_will_translate_mode
|
||||
) {
|
||||
parent::__construct(
|
||||
array(
|
||||
WPML_TM_PATH . '/templates/wizard',
|
||||
WPML_PLUGIN_PATH . '/templates/widgets',
|
||||
)
|
||||
);
|
||||
$this->user = $user;
|
||||
$this->translation_manager_settings = $translation_manager_settings;
|
||||
$this->translator_settings = $translator_settings;
|
||||
$this->translation_services_factory = $translation_services_factory;
|
||||
$this->who_will_translate_mode = is_array( $who_will_translate_mode ) ? $who_will_translate_mode : array();
|
||||
}
|
||||
|
||||
public function render() {
|
||||
global $wpdb;
|
||||
|
||||
$this->add_strings();
|
||||
$this->add_translation_manager_ui();
|
||||
$this->add_translators_ui();
|
||||
$this->add_translation_services_ui();
|
||||
$this->add_mode();
|
||||
$this->add_nonce();
|
||||
$this->add_user_capability();
|
||||
|
||||
return $this->get_template()->show( $this->model, 'who-will-translate-step.twig' );
|
||||
}
|
||||
|
||||
public function add_strings() {
|
||||
|
||||
$this->model['strings'] =
|
||||
array(
|
||||
/* translators: This is the title of the first screen of Translation Management wizard */
|
||||
'title' => __( 'Who will translate this site?', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - Move to the next step of the wizard */
|
||||
'button_text' => __( 'Continue', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - When asked who will translate this site, the user (%s) can chose to be the only translator */
|
||||
'only_i' => sprintf( __( 'Only myself (%s)', 'wpml-translation-management' ), $this->user->display_name ),
|
||||
/* translators: Translation Management wizard - When asked who will translate this site, the user can select or create a user to manage the translators */
|
||||
'leave_choice' => __( 'I want to set a "Translation Manager" who will choose the translators for this site', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - When asked who will translate this site, the user can select or create users as translators */
|
||||
'users' => __( 'Users of this site', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - When asked who will translate this site, */
|
||||
'translation_service' => __( 'A Translation Service', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - tooltip text shown near the "Only myself (%s)" option */
|
||||
'only_i_help' => __( 'You will be the sole translator for this site. You will be able to translate any document between any language pair. If you want to do some of the translations and allow others to translate as well, select the "Users of this site" option instead.', 'wpml-translation-management' ),
|
||||
'leave_choice_help' => array(
|
||||
/* translators: Translation Management wizard - tooltip text shown near the "I want to set a "Translation Manager" who ..." option */
|
||||
'text' => __( 'You will choose a user of this site and delegate the setup of translators to him/her. Choose this option when you are building a website for a client, who will set up translator users or choose a translation service.', 'wpml-translation-management' ),
|
||||
'link' => array(
|
||||
/* translators: Translation Management wizard - the tooltip text shown near the "I want to set a "Translation Manager" who ..." option, will also provide a link to an external 'Working with Translation Managers' page (%s) */
|
||||
'pattern' => __( 'Read more on %s', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - the tooltip text shown near the "I want to set a "Translation Manager" who ..." option, will also provide a link to an external 'Working with Translation Managers' page */
|
||||
'text' => __( 'Working with Translation Managers', 'wpml-translation-management' ),
|
||||
'url' => 'https://wpml.org/documentation/translating-your-contents/working-with-translation-managers/?utm_source=wpmlplugin&utm_campaign=tm-setup-wizard&utm_medium=translation-manager-tooltip&utm_term=translation-management',
|
||||
),
|
||||
),
|
||||
/* translators: Translation Management wizard - tooltip text shown near the "Users of this site" option */
|
||||
'users_help' => __( 'You will choose users of this WordPress site as the translators. You can also choose yourself. This allows you to set up a team of translators working in different language pairs.', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - tooltip text shown near the "A Translation Service" option */
|
||||
'translation_service_help' => __( 'WPML offers tight integration with over 70 translation services. You will choose the translation service that you prefer and enjoy a streamlined process for sending jobs and receiving completed translations.', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - when selecting the "A Translation Service" option, a button appears which allows selecting a translation service */
|
||||
'choose_translation_service' => __( 'Choose a Translation Service', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - a generic "Cancel" button shown when opening a dialog */
|
||||
'dialog_cancel' => __( 'Cancel', 'wpml-translation-management' ),
|
||||
);
|
||||
|
||||
$this->model['strings']['translation_service_dialog'] =
|
||||
array(
|
||||
/* translators: Translation Management wizard - The dialog title for selecting a translation service */
|
||||
'title' => __( 'Choose a Translation Service', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - A short explanation of the dialog's purpose */
|
||||
'into' => __( 'Here is the full list of translation services that are integrated with WPML. With any service that you choose, you enjoy a streamlined process.', 'wpml-translation-management' ),
|
||||
);
|
||||
|
||||
$this->model['strings']['activate_translation_service_dialog'] =
|
||||
array(
|
||||
/* translators: Translation Management wizard - Shown after selecting a translation service */
|
||||
'title' => __( 'Connect this site to your %s account', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - Shown after selecting a translation service. "%s" is replaced with the name of the selected translation service */
|
||||
'connect_desc' => __( 'Inside your %1$s account, you will find an "API token". This token allows WPML to connect to your account at %2$s to send and receive jobs.', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - Shown after selecting a translation service. "%s" is replaced with the name of the selected translation service */
|
||||
'connect_how_to_find' => __( 'How to find API token in %s', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - Shown after selecting a translation service. */
|
||||
'cancel' => __( 'Use a different Translation Service', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - Shown after selecting a translation service. */
|
||||
'ok' => __( 'Authenticate', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - Shown after selecting a translation service. "%s" is replaced with the name of the selected translation service */
|
||||
'no_account' => __( 'No account at %s?', 'wpml-translation-management' ),
|
||||
/* translators: Translation Management wizard - Shown after selecting a translation service. */
|
||||
'create_one' => __( 'Create an account in one minute', 'wpml-translation-management' ),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function add_translation_manager_ui() {
|
||||
$this->model['translation_manager_ui'] = $this->translation_manager_settings->render();
|
||||
}
|
||||
|
||||
public function add_translators_ui() {
|
||||
$this->model['translators_ui'] = $this->translator_settings->render( true );
|
||||
}
|
||||
|
||||
private function add_translation_services_ui() {
|
||||
$this->handle_translation_service_params();
|
||||
|
||||
$renderer = $this->translation_services_factory->create();
|
||||
|
||||
ob_start();
|
||||
$renderer->render();
|
||||
$this->model['translation_services_table'] = ob_get_clean();
|
||||
}
|
||||
|
||||
private function add_mode() {
|
||||
$this->model['mode'] = wp_json_encode( $this->who_will_translate_mode );
|
||||
}
|
||||
|
||||
private function add_nonce() {
|
||||
$this->model['nonce'] = wp_create_nonce( WPML_TM_Wizard_Steps::NONCE );
|
||||
}
|
||||
|
||||
private function add_user_capability() {
|
||||
$this->model['is_administrator'] = $this->user->has_cap( 'manage_options' );
|
||||
}
|
||||
|
||||
private function handle_translation_service_params() {
|
||||
|
||||
$query_args = array();
|
||||
foreach ( array( 'orderby', 'order', 'paged' ) as $param ) {
|
||||
if ( isset( $_POST[ $param ] ) ) {
|
||||
$query_args[ $param ] = $_POST[ $param ];
|
||||
$_GET[ $param ] = $_POST[ $param ];
|
||||
}
|
||||
}
|
||||
if ( ! empty( $query_args ) ) {
|
||||
$_SERVER['REQUEST_URI'] = add_query_arg( $query_args, $_SERVER['REQUEST_URI'] );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user