Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change language countdown #26

Closed
wpbean opened this issue May 11, 2015 · 4 comments
Closed

Change language countdown #26

wpbean opened this issue May 11, 2015 · 4 comments

Comments

@wpbean
Copy link

wpbean commented May 11, 2015

I want to change the language of the countdown (days, hours, minutes, seconds). How can I do that?
Thank you

@bigdropgr
Copy link

@wpbean Hi, you can edit the javascript code that you use for showing the countdown and add you preferred text. Just replace the words "days, hours, minutes, seconds" with the ones you want.

@marlenesco
Copy link

@bigdropgr maybe it should be set by option, cause I "gitignored" the whole bower_components.

@rendro
Copy link
Owner

rendro commented May 17, 2016

Just pass your custom render method into the options of the plugin and handle i18n there. The plugin is purely handling counting down to a certain time and should not include implementation details like i18n or l10n.

So in a way @marlenesco is right, you can set it as an option :)

// assuming you have a constant LOCALE containing your locale string
$('.yourCountdownContainer').countdown({
        date: "June 7, 1016 15:03:26",
        render: function(date) {
            if (LOCALE === 'de_DE') {
                this.el.innerHTML =
                    date.years + " Jahre, " +
                    date.days  + " Tage, " +
                    this.leadingZeros(date.hours) + " Stunden, " +
                    this.leadingZeros(date.min) + " Minuten und " +
                    this.leadingZeros(date.sec) + " Sekunden";
            } else {
                this.el.innerHTML =
                    date.years + " years, " +
                    date.days  + " days, " +
                    this.leadingZeros(date.hours) + " hours, " +
                    this.leadingZeros(date.min) + " min and " +
                    this.leadingZeros(date.sec) + " sec";
            }
        }
    });

@rendro rendro closed this as completed May 17, 2016
@marlenesco
Copy link

Thank you @rendro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants