Hi,

Are there any plans to introduce D8 version of this module?
I would like to help you with development of this version or to implement it from scratch.

Comments

shkiper’s picture

Status: Active » Needs review
StatusFileSize
new31.87 KB

I've made a Drupal 8 version of this module. Could someone please review my patch?

BarisW’s picture

Wow! Thanks so much for the hard work. The patch looks great (function-wise). Haven't tested it on a D8 site yet, will do that later.
I only found these two issues:

  1. +++ b/src/Plugin/Block/translateThisBlock.php
    @@ -0,0 +1,47 @@
    +	/**
    +	 * {@inheritdoc}
    +	 */
    +	public function build() {
    +    $url = Url::fromUri('http://translateth.is/', array(
    +      'attributes' => array(
    +        'class' => array(
    +          'translate-this-button',
    +        ),
    +      ),
    +    ));
    +    $content = '<div id="translate-this">' . \Drupal::l(t('Translate'), $url) . '</div>';
    +    $content .= '<script>TranslateThis({' . translate_this_js_options() . ');</script>';
    +
    +		return array(
    +      '#children' => $content,
    +      '#attached' => [
    +        'library' => [
    +          'translate_this/translate_this',
    +        ],
    +      ],
    +		);
    +	}
    

    Please use spaces instead of tabs.

  2. +++ b/translate_this.module
    @@ -22,110 +22,39 @@
    -    $content .= "scope : '" . $scope . "',\r";
    +    $content .= "className : '" . $scope . "',\r";
    

    Shouldn't this be scope?

shkiper’s picture

StatusFileSize
new31.82 KB

Hi Baris. Thank you for your review. I fixed these two issues. Could you please check new patch?

BarisW’s picture

Status: Needs review » Needs work

I think we are almost there. I tried some of the settings but not all seem to be used. For example; the 'Disable flag thumbnails' setting seems to be ignored. Can you please check if it works?

shkiper’s picture

Status: Needs work » Needs review

Have you tried to clear the cache?

BarisW’s picture

No I did not, but I wouldn't expect that to be needed. If this is the case, can we make it so that the cache is cleared when to configuration is saved? An end-user expects a setting to work when he changes it.

shkiper’s picture

StatusFileSize
new31.92 KB

Hi Baris. I fixed issue with cache

BarisW’s picture

Status: Needs review » Reviewed & tested by the community

Great work! Thanks so much.

  • BarisW committed 7fc76fc on 8.x-1.x authored by shkiper
    Issue #2380557 by shkiper, BarisW: TranslateThis Button Drupal 8
    
BarisW’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.