Home Forums Porto Template Language changing in countdown

This topic contains 7 replies, has 3 voices, and was last updated by  Support2 5 months ago. This post has been viewed 195 times

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #10028632

    Murgi
    Participant

    Hi Rodrigo

    Can you please tell me where I can changing the language in the countdown.

    Thank you
    Murgi



    Template Version: 7.1.0
    #10028644

    Support
    Keymaster

    Hello, you can put the values in the options, for example:

    <div class="countdown countdown-primary" data-plugin-countdown data-plugin-options="{'date': '2020/06/10 12:00:00', 'textDay': 'DAY1', 'textHour': 'HRS1', 'textMin': 'MIN1', 'textSec': 'SEC1', 'numberClass': 'font-weight-normal'}"></div>

    Please try that and let me know if you need further assistance.

    Kind Regards,

    Jonas


    #10028660

    Murgi
    Participant

    Hello Jonas,

    Yes it works, thank you.

    However, I noticed a minor error:
    A “S” is inserted after the “NAP” word which should not be there.
    How can I fix it?

    Thanks
    Murgi


    #10028665

    Support2
    Keymaster

    Hello Murgi,

    You can remove the pluralization adding the code below in (js/custom.js):

    $.extend( theme.PluginCountdown.prototype, {
    	build: function() {
    		if (!($.isFunction($.fn.countTo))) {
    			return this;
    		}
    
    		var self = this,
    			$el = this.options.wrapper,
    			numberClass = ( self.options.numberClass ) ? ' ' + self.options.numberClass : '',
    			wrapperClass = ( self.options.wrapperClass ) ? ' ' + self.options.wrapperClass : '';
    
    		if( self.options.uppercase ) {
    			$el.countdown(self.options.date).on('update.countdown', function(event) {
    				var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
    					+ '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay + ' '
    					+ '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> '
    					+ '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
    					+ '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
    					+ self.options.insertHTMLafter
    				));
    			});
    		} else {
    			$el.countdown(self.options.date).on('update.countdown', function(event) {
    				var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
    					+ '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'</span> '
    					+ '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> '
    					+ '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
    					+ '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
    					+ self.options.insertHTMLafter
    				));
    			});
    		}
    
    		return this;
    	}
    } );

    Kind Regards,

    Rodrigo.


    #10028667

    Murgi
    Participant

    Hello Rodrigo,

    Thank you your help. Unfortunately, the problem is not resolved.
    nap-naps

    I would like “NAP”
    without “S”

    Kind Regards,
    Murgi


    #10028680

    Support2
    Keymaster

    Hello Murgi,

    The problem is the JS error below:

    This error is breaking the execution of countdown code. Fix this error and the countdown code will works.

    Please, try that and let us know if you need further assistance.

    Kind Regards,

    Rodrigo.


    #10028708

    Murgi
    Participant

    Hello Rodrigo,

    I removed the code between 191-207 because I don’t use it anymore but now the look has changed:


    #10028709

    Support2
    Keymaster

    Hello Murgi,

    Sorry was missing close the first </span> on the countdown JS code. Please replace with this new code:

    // pluralization removing nyelvi hiba javitasa
    $.extend( theme.PluginCountdown.prototype, {
    	build: function() {
    		if (!($.isFunction($.fn.countTo))) {
    			return this;
    		}
    
    		var self = this,
    			$el = this.options.wrapper,
    			numberClass = ( self.options.numberClass ) ? ' ' + self.options.numberClass : '',
    			wrapperClass = ( self.options.wrapperClass ) ? ' ' + self.options.wrapperClass : '';
    
    		if( self.options.uppercase ) {
    			$el.countdown(self.options.date).on('update.countdown', function(event) {
    				var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
    					+ '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay + '</span> '
    					+ '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> '
    					+ '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
    					+ '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
    					+ self.options.insertHTMLafter
    				));
    			});
    		} else {
    			$el.countdown(self.options.date).on('update.countdown', function(event) {
    				var $this = $(this).html(event.strftime(self.options.insertHTMLbefore
    					+ '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'</span> '
    					+ '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> '
    					+ '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> '
    					+ '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> '
    					+ self.options.insertHTMLafter
    				));
    			});
    		}
    
    		return this;
    	}
    } );

    Kind Regards,

    Rodrigo.


Viewing 8 posts - 1 through 8 (of 8 total)