Skip to content

Commit

Permalink
Adjusted WPML string compatibility to allow empty string translations…
Browse files Browse the repository at this point in the history
…. Fixed TS bugs. Improved TS badge displaying.

Improved GZD theme template locating.
  • Loading branch information
dennisnissle committed Dec 10, 2018
1 parent 128c191 commit cc900dd
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 193 deletions.
Binary file modified i18n/languages/woocommerce-germanized-de_DE.mo
Binary file not shown.
160 changes: 82 additions & 78 deletions i18n/languages/woocommerce-germanized-de_DE.po

Large diffs are not rendered by default.

Binary file modified i18n/languages/woocommerce-germanized-de_DE_formal.mo
Binary file not shown.
160 changes: 82 additions & 78 deletions i18n/languages/woocommerce-germanized-de_DE_formal.po

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion includes/class-wc-gzd-payment-gateways.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function init_fee() {
public function set_fee( $gateway ) {

$is_taxable = ( ( 'no' === $gateway->get_option( 'fee_is_taxable', 'no' ) || get_option( 'woocommerce_calc_taxes' ) !== 'yes' ) ? false : true );
$fee = $gateway->get_option( 'fee' );
$fee = $gateway->get_option( 'fee' );

if ( $is_taxable ) {
$tax_rates = WC_Tax::get_rates();
Expand Down
8 changes: 5 additions & 3 deletions includes/compatibility/class-wc-gzd-compatibility-wpml.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,11 @@ protected function translate_option( $org_value, $option, $context = '' ) {
$string_id = $this->register_string( $option, $org_value, $context );
}

if ( $translation = $this->get_string_translation( $string_id, $language ) ) {
return $translation;
}
$translation = $this->get_string_translation( $string_id, $language );

if ( false !== $translation ) {
$org_value = $translation;
}

return $org_value;
}
Expand Down
4 changes: 2 additions & 2 deletions includes/trusted-shops/admin/views/html-wpml-notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<h3><?php echo _x( 'WPML Support', 'trusted-shops', 'woocommerce-germanized' ); ?></h3>
<p>
<?php if ( $is_default_language ) : ?>
<?php echo _x( 'These settings serve as default settings for all your languages. To adjust the settings for a certain language, please switch your admin language and adjust the corresponding settings.', 'trusted-shops', 'woocommerce-germanized' ); ?>
<?php echo _x( 'These settings serve as default settings for all your languages. To adjust the settings for a certain language, please switch your admin language through the WPML language switcher and adjust the corresponding settings.', 'trusted-shops', 'woocommerce-germanized' ); ?>
<?php else : ?>
<?php echo sprintf( _x( 'These settings apply for your %s shop. To adjust settings for another language, please switch your admin language.', 'trusted-shops', 'woocommerce-germanized' ), '<strong>' . $current_language . '</strong>' ); ?>
<?php echo sprintf( _x( 'These settings apply for your %s shop. To adjust settings for another language, please switch your admin language through the WPML language switcher.', 'trusted-shops', 'woocommerce-germanized' ), '<strong>' . $current_language . '</strong>' ); ?>
<?php endif; ?>
</p>
</div>
12 changes: 2 additions & 10 deletions includes/trusted-shops/class-wc-gzd-trusted-shops-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,15 +600,6 @@ protected function get_settings_array( $defaults = array() ) {
'default' => '#ts_product_widget',
),

array(
'title' => _x( 'Google', 'trusted-shops', 'woocommerce-germanized' ),
'desc' => _x( 'Configure Product Reviews for Google Shopping.', 'trusted-shops', 'woocommerce-germanized' ),
'desc_tip' => _x( 'Activate this option, to give Google the opportunity to display your Product Reviews in Google Shopping and paid Google ads.', 'trusted-shops', 'woocommerce-germanized' ),
'id' => 'woocommerce_' . $this->base->option_prefix . 'trusted_shops_google_shopping_enable',
'type' => 'checkbox',
'default' => 'no'
),

array(
'title' => _x( 'Brand attribute', 'trusted-shops', 'woocommerce-germanized' ),
'desc' => sprintf( _x( 'Create brand attribute %s', 'trusted-shops', 'woocommerce-germanized' ), '<a href="' . admin_url( 'edit.php?post_type=product&page=product_attributes' ) . '" target="_blank">' . _x( 'here', 'trusted-shops', 'woocommerce-germanized' ) . '</a>' ),
Expand All @@ -617,7 +608,8 @@ protected function get_settings_array( $defaults = array() ) {
'css' => 'min-width:250px;',
'default' => 'brand',
'type' => 'select',
'class' => 'chosen_select',
'class' => 'chosen_select_nostd',
'custom_attributes' => array( 'data-placeholder' => _x( 'None', 'trusted-shops', 'woocommerce-germanized' ) ),
),

array( 'type' => 'sectionend', 'id' => 'trusted_shops_reviews_options' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ private function __construct( $base ) {
public function init() {
if ( $this->base->is_enabled() ) {
add_action( 'woocommerce_thankyou', array( $this, 'template_thankyou' ), 10, 1 );

if ( $this->base->is_trustbadge_enabled() ) {
add_action( 'wp_footer', array( $this, 'template_trustbadge' ), 250 );
}
add_action( 'wp_footer', array( $this, 'template_trustbadge' ), 250 );
}

if ( $this->base->is_product_reviews_enabled() ) {
Expand Down
6 changes: 1 addition & 5 deletions includes/trusted-shops/class-wc-gzd-trusted-shops.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,6 @@ public function is_product_widget_enabled() {
return ( $this->is_product_reviews_enabled() && $this->product_widget_enable === 'yes' ? true : false );
}

public function is_google_shopping_enabled() {
return ( $this->is_product_reviews_enabled() && $this->google_shopping_enable === 'yes' ? true : false );
}

public function supports( $type ) {
return ( in_array( $type, $this->supports ) ? true : false );
}
Expand Down Expand Up @@ -563,7 +559,7 @@ public function get_trustbadge_code( $replace = true, $args = array() ) {
$args = wp_parse_args( $args, array(
'offset' => $this->trustbadge_y,
'variant' => $this->trustbadge_variant === 'standard' ? 'reviews' : 'default',
'disable' => $this->trustbadge_variant === 'disable' ? 'true' : 'false',
'disable' => $this->is_trustbadge_enabled() ? 'true' : 'false',
) );
}

Expand Down
8 changes: 3 additions & 5 deletions templates/trusted-shops/thankyou.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@
<span class="tsCheckoutProductImageUrl"><?php echo $plugin->get_product_image( $org_product ); ?></span>
<span class="tsCheckoutProductName"><?php echo get_the_title( wc_ts_get_crud_data( $parent_product, 'id' ) ); ?></span>
<span class="tsCheckoutProductSKU"><?php echo ( $parent_product->get_sku() ? $parent_product->get_sku() : wc_ts_get_crud_data( $parent_product, 'id' ) ); ?></span>
<?php if ( $plugins->is_google_shopping_enabled() ) : ?>
<span class="tsCheckoutProductGTIN"><?php echo apply_filters( 'woocommerce_gzd_trusted_shops_product_gtin', $plugin->get_product_gtin( $org_product ), $org_product ); ?></span>
<span class="tsCheckoutProductBrand"><?php echo apply_filters( 'woocommerce_gzd_trusted_shops_product_brand', $plugin->get_product_brand( $parent_product ), $parent_product ); ?></span>
<span class="tsCheckoutProductMPN"><?php echo apply_filters( 'woocommerce_gzd_trusted_shops_product_mpn', $plugin->get_product_mpn( $org_product ), $org_product ); ?></span>
<?php endif; ?>
<span class="tsCheckoutProductGTIN"><?php echo apply_filters( 'woocommerce_gzd_trusted_shops_product_gtin', $plugin->get_product_gtin( $org_product ), $org_product ); ?></span>
<span class="tsCheckoutProductBrand"><?php echo apply_filters( 'woocommerce_gzd_trusted_shops_product_brand', $plugin->get_product_brand( $parent_product ), $parent_product ); ?></span>
<span class="tsCheckoutProductMPN"><?php echo apply_filters( 'woocommerce_gzd_trusted_shops_product_mpn', $plugin->get_product_mpn( $org_product ), $org_product ); ?></span>
</span>
<?php endforeach; ?>
<?php endif; ?>
Expand Down
11 changes: 4 additions & 7 deletions woocommerce-germanized.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,10 @@ public function filter_templates( $template, $template_name, $template_path ) {

$GLOBALS['wc_gzd_template_name'][] = $template_name;

// Check Theme
$theme_template = locate_template(
array(
trailingslashit( $template_path ) . $template_name,
$template_name,
)
);
// Check for Theme overrides
$theme_template = locate_template( array(
trailingslashit( $template_path ) . $template_name,
) );

$template_name = apply_filters( 'woocommerce_gzd_template_name', $template_name );

Expand Down

0 comments on commit cc900dd

Please sign in to comment.