Plugin Directory

Changeset 2088118


Ignore:
Timestamp:
05/15/2019 08:29:29 AM (7 years ago)
Author:
awslabs
Message:

3.0.6 trunk

Location:
amazon-polly/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • amazon-polly/trunk/README.md

    r2072945 r2088118  
    77| Requires PHP | 5.6 |
    88| Tested up to | 5.0 |
    9 | Stable tag | 3.0.5 |
     9| Stable tag | 3.0.6 |
    1010| License | GPLv3 ONLY |
    1111| License URI | https://www.gnu.org/licenses/gpl-3.0.html |
     
    237237#### Changelog
    238238
     239= 3.0.6 =
     240* Added translate support for Hindi, Farsi, Malay, and Norwegian languages.
     241
    239242= 3.0.5 =
    240243* Added support for Arabic Language
  • amazon-polly/trunk/README.txt

    r2072945 r2088118  
    55Requires PHP: 5.6
    66Tested up to: 5.0
    7 Stable tag: 3.0.5
     7Stable tag: 3.0.6
    88License: GPLv3 ONLY
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    232232== Changelog ==
    233233
     234= 3.0.6 =
     235* Added translate support for Hindi, Farsi, Malay, and Norwegian languages.
     236
    234237= 3.0.5 =
    235238* Added support for Arabic Language
  • amazon-polly/trunk/admin/AmazonAI-Common.php

    r2072847 r2088118  
    2323        ['code' => 'de', 'name' => 'German', 'transable' => '1', 'polly' => '1'],
    2424        ['code' => 'he', 'name' => 'Hebrew', 'transable' => '1', 'polly' => ''],
     25        ['code' => 'hi', 'name' => 'Hindi', 'transable' => '1', 'polly' => ''],
    2526        ['code' => 'it', 'name' => 'Italian', 'transable' => '1', 'polly' => '1'],
    2627        ['code' => 'id', 'name' => 'Indonesian', 'transable' => '1', 'polly' => ''],
    2728        ['code' => 'ja', 'name' => 'Japanese', 'transable' => '1', 'polly' => '1'],
    2829        ['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' => ''],
    3033        ['code' => 'pl', 'name' => 'Polish', 'transable' => '1', 'polly' => '1'],
    3134        ['code' => 'pt', 'name' => 'Portuguese', 'transable' => '1', 'polly' => '1'],
     
    320323    }
    321324
     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    }
    322337
    323338
  • amazon-polly/trunk/admin/AmazonAI-TranslateConfiguration.php

    r2072847 r2088118  
    158158        $display_values   = [ 'Flag', 'Label', 'Flag + Label' ];
    159159
    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' ];
    163164        }
    164165
  • amazon-polly/trunk/admin/AmazonAI-Translator.php

    r1996469 r2088118  
    7474            if (empty($is_image_paragraph)) {
    7575
    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
    85100
    86101            } else {
     
    92107
    93108        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;
    94120
    95121    }
  • amazon-polly/trunk/amazonpolly.php

    r2072945 r2088118  
    1717 * Plugin URI:        https://wordpress.org/plugins/amazon-polly/
    1818 * 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.5
     19 * Version:           3.0.6
    2020 * Author:            AWS Labs, WP Engine
    2121 * Author URI:        https://aws.amazon.com/
Note: See TracChangeset for help on using the changeset viewer.