src/Modules/Translate.php
public function can_load( $product ) {
		if ( $this->is_from_partner( $product ) ) {
			return false;
		}
		if ( ! $product->is_wordpress_available() ) {
			return false;
		}

		$lang = $this->get_user_locale();

		if ( 'en_US' === $lang ) {
			return false;
		}

		$languages = $this->get_translations( $product );

		if ( ! is_array( $languages ) ) {
			return false;
		}

		if ( ! isset( $languages['translations'] ) ) {
			return false;
		}

		$languages = $languages['translations'];

		$available = wp_list_pluck( $languages, 'language' );

		if ( in_array( $lang, $available ) ) {
			return false;
		}

		if ( ! isset( self::$locales[ $lang ] ) ) {
			return false;
		}

		return apply_filters( $product->get_slug() . '_sdk_enable_translate', true );
	}
public function can_load( $product ) {
		if ( $this->is_from_partner( $product ) ) {
			return false;
		}
		if ( ! $product->is_wordpress_available() ) {
			return false;
		}

		$lang = $this->get_user_locale();

		if ( 'en_US' === $lang ) {
			return false;
		}

		$languages = $this->get_translations( $product );

		if ( ! is_array( $languages ) ) {
			return false;
		}

		if ( ! isset( $languages['translations'] ) ) {
			return false;
		}

		$languages = $languages['translations'];

		$available = wp_list_pluck( $languages, 'language' );

		if ( in_array( $lang, $available ) ) {
			return false;
		}

		if ( ! isset( self::$locales[ $lang ] ) ) {
			return false;
		}

		return apply_filters( $product->get_slug() . '_sdk_enable_translate', true );
	}
public function can_load ( $ product ) { if ( $ this -> is_from_partner ( $ product ) ) { return false ; } if ( ! $ product -> is_wordpress_available ( ) ) { return false ; } $ lang = $ this -> get_user_locale ( ) ; if ( 'en_US' === $ lang ) { return false ; } $ languages = $ this -> get_translations ( $ product ) ; if ( ! is_array ( $ languages ) ) { return false ; } if ( ! isset ( $ languages [ 'translations' ] ) ) { return false ; } $ languages = $ languages [ 'translations' ] ; $ available = wp_list_pluck ( $ languages , 'language' ) ; if ( in_array ( $ lang , $ available ) ) { return false ; } if ( ! isset ( self :: $ locales [ $ lang ] ) ) { return false ; } return apply_filters ( $ product -> get_slug ( ) . '_sdk_enable_translate' , true ) ; }
Check if we should load module for this.

@param Product $product Product to check.

@return bool Should load ?
Check if we should load module for this .