Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

Commit

Permalink
Default locale to en if translations are missing
Browse files Browse the repository at this point in the history
Fixes #24
  • Loading branch information
volmer committed Mar 7, 2015
1 parent bd90e62 commit 268e272
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/bootsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//= require bootsy/wysihtml5
//= require bootsy/bootstrap-wysihtml5
//= require bootsy/bootsy
//= require bootsy/bootstrap.file-input.js
//= require bootsy/bootstrap.file-input
//= require bootsy/init
//= require bootsy/editor_options
//= require bootsy/translations
5 changes: 4 additions & 1 deletion app/assets/javascripts/bootsy/bootsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ window.Bootsy = window.Bootsy || {};
Bootsy.Area = function($el) {
this.$el = $el;
this.modal = $el.siblings('.bootsy-modal');
this.locale = $el.data('bootsy-locale') || $('html').attr('lang') || 'en';
this.unsavedChanges = false;
this.locale = $el.data('bootsy-locale') || $('html').attr('lang');
if (!Bootsy.translations[this.locale]) {
this.locale = 'en';
}

this.options = {
locale: this.locale,
Expand Down
12 changes: 7 additions & 5 deletions app/assets/javascripts/bootsy/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ Bootsy.init = function() {

/* Initialize Bootsy on document load */
$(function() {
Bootsy.init();
$(window).load(function() {
Bootsy.init();

/* Reload Bootsy on page load when using Turbolinks. */
if (window.Turbolinks) {
$(document).on('page:load', Bootsy.init);
}
/* Reload Bootsy on page load when using Turbolinks. */
if (window.Turbolinks) {
$(document).on('page:load', Bootsy.init);
}
});
});

0 comments on commit 268e272

Please sign in to comment.