in admin/AmazonAI-TranslateConfiguration.php [346:380]
public function translation_enabled_gui()
{
if ($this->is_language_supported()) {
if ($this->common->validate_amazon_polly_access()) {
if ($this->common->is_s3_enabled()) {
$start_value = $this->common->checked_validator('amazon_polly_trans_enabled');
$translate_accessible = $this->common->is_translation_enabled();
$supported_regions = array(
'us-east-1',
'us-east-2',
'us-west-2',
'eu-west-1'
);
$selected_region = $this->common->get_aws_region();
if (in_array($selected_region, $supported_regions)) {
echo '<input type="checkbox" name="amazon_polly_trans_enabled" id="amazon_polly_trans_enabled" ' . $this->common->checked_validator('amazon_polly_trans_enabled') . '> ';
if ('checked' == trim($start_value)) {
if (!$translate_accessible) {
echo '<p class="description"><b>Cannot access Amazon Translate. Check your IAM policy for the correct permissions.</b></p>';
}
}
} else {
echo '<p class="description">You need to use one of the following regions: US East (N. Virginia), US East (Ohio), US West (Oregon), or EU (Ireland)</p>';
update_option('amazon_polly_trans_enabled', '');
}
} else {
echo '<p class="description">Amazon S3 storage needs to be enabled</p>';
}
} else {
echo '<p>Verify that your AWS credentials are accurate</p>';
}
} else {
echo '<p>Translate functionality is not supported for this language</p>';
}
}