This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Lauren 3 months, 1 week ago.

Assigned support staff: Lauren.

Author Posts
June 13, 2019 at 3:01 pm

stephanieK-9

I try to translate the following text (see attachments)

hidden link

German text

but shows English

June 13, 2019 at 3:43 pm
June 13, 2019 at 4:09 pm #4015581

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I have escalated this ticket to the compatibility team. I will update here as soon as I have more information.

June 20, 2019 at 6:01 pm #4062167

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Our developers found a workaround. In wp-content/plugins/salon-booking-system/src/SLN/Settings.php:12 change from:

$this->load();

to:

add_action( 'init', array( $this, 'load' ) );

We also contacted the author and he said he will update the code in a future release. Please let me know if this resolves the issue for you.

July 5, 2019 at 1:14 pm #4151517

stephanieK-9

Awesome thank you for your great work.

I put this code as you said to the settings. but it did not help ... could you please have a look, thank you!

<?php

class SLN_Settings
{
    const KEY = 'salon_settings';
    private $settings;
    private $availabilityItems;
    private $holidayItems;

    public function __construct()
    {
       add_action( 'init', array( $this, 'load' ) );    }

    public function load()
    {
        $this->settings = get_option(self::KEY);
    }

    public function get($k)
    {
        $val = isset($this->settings[$k]) ? $this->settings[$k] : null;

        return apply_filters('sln.settings.get', $val, $k);
    }

    public function set($key, $val)
    {
        if (is_string($val)) {
            $val = trim($val);
        }
        if (empty($val)) {
            unset($this->settings[$key]);
        } else {
            $this->settings[$key] = $val;
        }
    }

    public function all()
    {
        return $this->settings;
    }

    public function save()
    {
        update_option(self::KEY, $this->settings);

        return $this;
    }

    public function clear()
    {
        delete_option(self::KEY, $this->settings);
    }

    public function getVersion()
    {
        return SLN_VERSION;
    }

    public function getDbVersion()
    {
        $val = $this->get('sln_db_version');

        return empty($val) ? '0.0.0' : $val;
    }

    public function setDbVersion($version = null)
    {
        $this->settings['sln_db_version'] = is_null($version) ? $this->getVersion() : $version;

        return $this;
    }

    public function getCurrency()
    {
        $val = $this->get('pay_currency');

        return empty($val) ? 'USD' : $val;
    }

    public function getCurrencySymbol()
    {
        return SLN_Currency::getSymbol($this->getCurrency());
    }

    public function getInterval()
    {
        $val = $this->get('interval');

        return isset($val) ? $val : SLN_Constants::DEFAULT_INTERVAL;
    }

    public function getNoticesDisabled()
    {
        $val = $this->get('notices_disabled');

        return isset($val) ? $val : false;
    }

    public function setNoticesDisabled($val)
    {
        $this->settings['notices_disabled'] = $val;

        return $this;
    }

    public function isPaypalTest()
    {
        return $this->get('pay_paypal_test') ? true : false;
    }

    public function getPaypalEmail()
    {
        return $this->get('pay_paypal_email');
    }

    public function getThankyouPageId()
    {
        return SLN_Func::get_translated_page_id($this->get('thankyou'));
    }

    public function getBookingmyaccountPageId()
    {
        return SLN_Func::get_translated_page_id($this->get('bookingmyaccount'));
    }

    public function getPayPageId()
    {
        return SLN_Func::get_translated_page_id($this->get('pay'));
    }

    public function isDisabled()
    {
        return $this->get('disabled') ? true : false;
    }

    public function getDisabledMessage()
    {
        return nl2br(htmlentities($this->get('disabled_message')));
    }

    public function isAjaxEnabled()
    {
        return $this->get('ajax_enabled') ? true : false;
    }

    public function getDateFormat()
    {
        return $this->get('date_format') ? $this->get('date_format') : SLN_Enum_DateFormat::_DEFAULT;
    }

    public function getTimeFormat()
    {
        return $this->get('time_format') ? $this->get('time_format') : SLN_Enum_TimeFormat::_DEFAULT;
    }

    public function getSalonName()
    {
        $ret = $this->get('gen_name');
        if (!$ret) {
            $ret = get_bloginfo('name');
        }

        return $ret;
    }

    public function getSalonEmail()
    {
        $ret = $this->get('gen_email');
        if (!$ret) {
            $ret = get_bloginfo('admin_email');
        }

        return $ret;

    }

    public function getHoursBeforeFrom()
    {
        $ret = $this->get('hours_before_from');

        return $ret ? $ret : SLN_Constants::HOURS_BEFORE_FROM_ALWAYS;
    }

    public function getHoursBeforeTo()
    {
        $ret = $this->get('hours_before_to');

        return $ret ? $ret : SLN_Constants::HOURS_BEFORE_TO_ALWAYS;
    }

    public function getAvailabilityMode()
    {
        $ret = $this->get('availability_mode');

        return $ret ? $ret : 'basic';
    }

    public function getPaymentMethod()
    {
        $val = $this->get('pay_method');

        return isset($val) ? $val : 'paypal';
    }

    public function getPaymentDepositAmount()
    {
        return $this->isPaymentDepositFixedAmount() ? $this->getPaymentDepositFixedValue() : $this->getPaymentDepositValue();
    }

    public function isPaymentDepositFixedAmount()
    {
        return ($this->getPaymentDepositValue() === SLN_Enum_PaymentDepositType::FIXED);
    }

    public function getPaymentDepositValue()
    {
        $val = $this->get('pay_deposit');

        return isset($val) ? $val : SLN_Enum_PaymentDepositType::_DEFAULT;
    }

    public function getPaymentDepositFixedValue()
    {
        $val = $this->get('pay_deposit_fixed_amount');

        return isset($val) ? $val : 0;
    }

    public function getStyleShortcode()
    {
        $val = $this->get('style_shortcode');

        return isset($val) ? $val : SLN_Enum_ShortcodeStyle::_DEFAULT;
    }

    public function isHidePrices()
    {
        return $this->get('hide_prices') == 1 ? true : false;
    }

    /**
     * @return bool
     */
    public function isAttendantsEnabled()
    {
        return $this->get('attendant_enabled') ? true : false;
    }

    public function isAttendantsEnabledOnlyBackend()
    {
        return $this->get('only_from_backend_attendant_enabled') ? true : false;
    }

    /**
     * @return bool
     */
    public function isMultipleAttendantsEnabled()
    {
        return $this->get('m_attendant_enabled') ? true : false;
    }

    /**
     * @return bool
     */
    public function isPayEnabled()
    {
        return defined("SLN_VERSION_PAY") && SLN_VERSION_PAY && $this->get('pay_enabled') ;
    }


    public function getCustomText($key)
    {
        $custom_texts = $this->get('custom_texts');
        if (isset($custom_texts[$key]) && !empty($custom_texts[$key])) {
            return $custom_texts[$key];
        }

        return $key;
    }

    public function setCustomText($key, $value)
    {
        $custom_texts       = $this->get('custom_texts');
        $custom_texts[$key] = $value;
        $this->set('custom_texts', $custom_texts);

        return true;
    }

    public function isFormStepsAltOrder()
    {
        return $this->get('form_steps_alt_order') ? true : false;
    }

    public function getDecimalSeparator()
    {
        return !is_null($this->get('pay_decimal_separator')) ? $this->get(
            'pay_decimal_separator'
        ) : $this->getDecimalSeparatorDefault();
    }

    public function getDecimalSeparatorDefault()
    {
        return '.';
    }

    public function getThousandSeparator()
    {
        return !is_null($this->get('pay_thousand_separator')) ? $this->get(
            'pay_thousand_separator'
        ) : $this->getThousandSeparatorDefault();
    }

    public function getThousandSeparatorDefault()
    {
        return ',';
    }

    /**
     * @return SLN_Helper_AvailabilityItems
     */
    public function getAvailabilityItems()
    {
        if (!isset($this->availabilityItems)) {
            $this->availabilityItems = new SLN_Helper_AvailabilityItems($this->get('availabilities'));
        }

        return apply_filters('sln.settings.availability_items', $this->availabilityItems);
    }

    /**
     * @return SLN_Helper_AvailabilityItems
     */
    public function getNewAvailabilityItems()
    {
        $ret = new SLN_Helper_AvailabilityItems($this->get('availabilities'));

        return apply_filters('sln.settings.availability_items', $ret);
    }

    public function getDailyHolidayItems(){
        $holidays = $this->get('holidays_daily') ?: array();
        
        $holidays = array_filter($holidays, function($h){
            foreach (['from_date',
'to_date',
'from_time',
'to_time',
'daily'] as $prop){
                if(empty($h[$prop])){
                    return false;
                }
            }
            return true;
        });
        
        return $holidays;
    }

    /**
     * @return SLN_Helper_HolidayItems
     */
    public function getHolidayItems()
    {
        if (!isset($this->holidayItems)) {
            $holidays =  $this->get('holidays') ?: array();
            $daily_holidays =  $this->getDailyHolidayItems();
            $this->holidayItems = new SLN_Helper_HolidayItems(array_merge($holidays,$daily_holidays));
        }

        return apply_filters('sln.settings.availability_holiday_items', $this->holidayItems);
    }

    /**
     * @return SLN_Helper_HolidayItems
     */
    public function getNewHolidayItems()
    {
        $ret = new SLN_Helper_HolidayItems($this->get('holidays'));

        return apply_filters('sln.settings.availability_holiday_items', $ret);
    }

    public function getLocale()
    {
        return function_exists('pll_current_language')
            ? pll_current_language()
            : ( defined('ICL_LANGUAGE_CODE')
                ? ICL_LANGUAGE_CODE
                : strtolower(substr(get_locale(), 0, 2))
            );
    }

    public function getDateLocale()
    {
        $is_polylang = function_exists('pll_current_language');
        $locale = $is_polylang
            ? pll_current_language()
            : ( defined('ICL_LANGUAGE_CODE')
                ? ICL_LANGUAGE_CODE
                : get_locale()
            );
        if( setlocale(LC_TIME,0) !== $locale  ){ setlocale(LC_TIME, $locale ); }

        if (defined('ICL_LANGUAGE_CODE') && !$is_polylang) {

	    $languages = icl_get_languages();

	    if ( isset( $languages[ICL_LANGUAGE_CODE] ) ) {
		return $languages[ICL_LANGUAGE_CODE]['default_locale'];
	    }
        }

        return $locale;
    }
}
July 8, 2019 at 1:17 pm #4162757

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

The credentials previously provided are no longer working for me. Please double check and update as needed so that I can log in and take a look. You might also try deleting the original string and then resaving the cancellation policy on the form and translate again.

I have marked the next reply as private so that you can update credentials. Thanks!

July 9, 2019 at 10:48 am
July 9, 2019 at 5:55 pm #4173599

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thanks for sending access. When I viewed the plugin settings.php, I could see that the line that needed to be changed had not been changed. Please see attached screenshot.

I edited the code as mentioned in my previous reply and now the translation is showing correctly (see other screenshot).