Skip to content

Instantly share code, notes, and snippets.

@josher19
josher19 / i18n-jqueryui-dialogtitle.js
Created November 30, 2012 10:11 — forked from jlgrall/i18n-jqueryui-dialogtitle.js
i18next: Adds support for data-i18n and data-i18n-options to jQuery UI Dialog's title
// Adds support for data-i18n and data-i18n-options to jQuery UI Dialog's title:
if( $.fn.dialog ) { // Checks the presence of the dialog component of jQuery UI
var rTitleKey = /\[title\]([^;]*);?/,
// Keep a reference to the original _create function:
dialog_create_orig = $.ui.dialog.prototype._create;
$.ui.dialog.prototype._create = function( ) {
var data_i18n,
i18n_options;
if(!this.options.title) { // Because as defined in Dialog, the options.title should override the title attribute
var old_data_i18n = this.element.attr( "data-i18n" );