Changeset 2088118
- Timestamp:
- 05/15/2019 08:29:29 AM (7 years ago)
- Location:
- amazon-polly/trunk
- Files:
-
- 6 edited
-
README.md (modified) (2 diffs)
-
README.txt (modified) (2 diffs)
-
admin/AmazonAI-Common.php (modified) (2 diffs)
-
admin/AmazonAI-TranslateConfiguration.php (modified) (1 diff)
-
admin/AmazonAI-Translator.php (modified) (2 diffs)
-
amazonpolly.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
amazon-polly/trunk/README.md
r2072945 r2088118 7 7 | Requires PHP | 5.6 | 8 8 | Tested up to | 5.0 | 9 | Stable tag | 3.0. 5|9 | Stable tag | 3.0.6 | 10 10 | License | GPLv3 ONLY | 11 11 | License URI | https://www.gnu.org/licenses/gpl-3.0.html | … … 237 237 #### Changelog 238 238 239 = 3.0.6 = 240 * Added translate support for Hindi, Farsi, Malay, and Norwegian languages. 241 239 242 = 3.0.5 = 240 243 * Added support for Arabic Language -
amazon-polly/trunk/README.txt
r2072945 r2088118 5 5 Requires PHP: 5.6 6 6 Tested up to: 5.0 7 Stable tag: 3.0. 57 Stable tag: 3.0.6 8 8 License: GPLv3 ONLY 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 232 232 == Changelog == 233 233 234 = 3.0.6 = 235 * Added translate support for Hindi, Farsi, Malay, and Norwegian languages. 236 234 237 = 3.0.5 = 235 238 * Added support for Arabic Language -
amazon-polly/trunk/admin/AmazonAI-Common.php
r2072847 r2088118 23 23 ['code' => 'de', 'name' => 'German', 'transable' => '1', 'polly' => '1'], 24 24 ['code' => 'he', 'name' => 'Hebrew', 'transable' => '1', 'polly' => ''], 25 ['code' => 'hi', 'name' => 'Hindi', 'transable' => '1', 'polly' => ''], 25 26 ['code' => 'it', 'name' => 'Italian', 'transable' => '1', 'polly' => '1'], 26 27 ['code' => 'id', 'name' => 'Indonesian', 'transable' => '1', 'polly' => ''], 27 28 ['code' => 'ja', 'name' => 'Japanese', 'transable' => '1', 'polly' => '1'], 28 29 ['code' => 'ko', 'name' => 'Korean', 'transable' => '1', 'polly' => '1'], 29 ['code' => 'nb', 'name' => 'Norwegian', 'transable' => '', 'polly' => '1'], 30 ['code' => 'ms', 'name' => 'Malay', 'transable' => '1', 'polly' => ''], 31 ['code' => 'no', 'name' => 'Norwegian', 'transable' => '1', 'polly' => '1'], 32 ['code' => 'fa', 'name' => 'Persian', 'transable' => '1', 'polly' => ''], 30 33 ['code' => 'pl', 'name' => 'Polish', 'transable' => '1', 'polly' => '1'], 31 34 ['code' => 'pt', 'name' => 'Portuguese', 'transable' => '1', 'polly' => '1'], … … 320 323 } 321 324 325 public function startsWith ($string, $beginning) { 326 $len = strlen($beginning); 327 return (substr($string, 0, $len) === $beginning); 328 } 329 330 public function endsWith($string, $ending) { 331 $len = strlen($ending); 332 if ($len == 0) { 333 return true; 334 } 335 return (substr($string, -$len) === $ending); 336 } 322 337 323 338 -
amazon-polly/trunk/admin/AmazonAI-TranslateConfiguration.php
r2072847 r2088118 158 158 $display_values = [ 'Flag', 'Label', 'Flag + Label' ]; 159 159 160 //For some languages flags are not supported. 161 if ($lanuage == 'ar') { 162 $display_values = [ 'Label' ]; 160 161 $only_labels = array("ar", "fa", "hi", "ms"); 162 if ( in_array($lanuage, $only_labels) ) { 163 $display_values = [ 'Label' ]; 163 164 } 164 165 -
amazon-polly/trunk/admin/AmazonAI-Translator.php
r1996469 r2088118 74 74 if (empty($is_image_paragraph)) { 75 75 76 $is_strong_paragraph = ''; 77 preg_match("/^\s*<strong>.*?strong>\s*$/", $paragraph, $is_strong_paragraph); 78 79 $paragraph = $common->clean_paragraph($paragraph); 80 $translated_paragraph = $this->translate( $translate_client, $paragraph, $source_language, $target_language); 81 82 if (!empty($is_strong_paragraph)) { 83 $translated_paragraph = "<strong>" . $translated_paragraph . "</strong>"; 84 } 76 //$is_strong_paragraph = ''; 77 //preg_match("/^\s*<strong>.*?strong>\s*$/", $paragraph, $is_strong_paragraph); 78 79 $clean_paragraph = $common->clean_paragraph($paragraph); 80 $translated_paragraph = $this->translate( $translate_client, $clean_paragraph, $source_language, $target_language); 81 82 //if (!empty($is_strong_paragraph)) { 83 // $translated_paragraph = "<strong>" . $translated_paragraph . "</strong>"; 84 ///} 85 86 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<strong>', '</strong>'); 87 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<p><strong>', '</strong></p>'); 88 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<h1>', '</h1>'); 89 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<h2>', '</h2>'); 90 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<h3>', '</h3>'); 91 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<h4>', '</h4>'); 92 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<h5>', '</h5>'); 93 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<h6>', '</h6>'); 94 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<p><em>', '</p></em>'); 95 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<em>', '</em>'); 96 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<p class="has-small-font-size">', '</p>'); 97 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<p class="has-large-font-size">', '</p>'); 98 $translated_paragraph = $this->special_html_paragraph($common, $paragraph, $translated_paragraph, '<p class="has-huge-font-size">', '</p>'); 99 85 100 86 101 } else { … … 92 107 93 108 return $translated_text; 109 110 } 111 112 113 private function special_html_paragraph($common, $paragraph, $translated_paragraph, $tag_beggining, $tag_ending) { 114 115 if ( $common->startsWith($paragraph, $tag_beggining) and $common->endsWith($paragraph, $tag_ending) ) { 116 $translated_paragraph = $tag_beggining . $translated_paragraph . $tag_ending; 117 } 118 119 return $translated_paragraph; 94 120 95 121 } -
amazon-polly/trunk/amazonpolly.php
r2072945 r2088118 17 17 * Plugin URI: https://wordpress.org/plugins/amazon-polly/ 18 18 * Description: Create audio version of your posts, translate them into other languages and create podcasts! Amazon Polly is a service that turns text into lifelike speech. With dozens of voices across a variety of languages, you can select the ideal voice and build engaging speech-enabled applications that work in many different countries. The Amazon Polly plugin for WordPress is a sample application that shows how WordPress creators can easily add Text-to-Speech capabilities to written content with Amazon Polly. You can generate an audio feed for text-based content and insert it into an embedded player to increase the accessibility of your WordPress site. The sample code also enables you to publish podcasts directly from your site and make them available for listeners in the form of podcasts. In addition, the plugin allows to translate your text from one language to another using Amazon Translate– which is a neural machine translation service that delivers fast, high-quality, and affordable language translation. Amazon Translate allows you to localize content - such as websites and applications - for international users, and to easily translate large volumes of text efficiently. 19 * Version: 3.0. 519 * Version: 3.0.6 20 20 * Author: AWS Labs, WP Engine 21 21 * Author URI: https://aws.amazon.com/
Note: See TracChangeset
for help on using the changeset viewer.