Skip to content

Commit f90a746

Browse files
committed
Use correct naming convention language files for Czech, Swedish and Danish
1 parent e7d4957 commit f90a746

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed
File renamed without changes.
File renamed without changes.

src/main/deprecated.js

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@
1616
return this.isValid(language, conf, true);
1717
};
1818

19-
$(window).on('validatorsLoaded formValidationSetup', function(evt, $form, config) {
20-
if( !$form ) {
21-
$form = $('form');
22-
}
23-
24-
addSupportForCustomErrorMessageCallback(config);
25-
addSupportForElementReferenceInPositionParam(config);
26-
addSupportForValidationDependingOnCheckedInput($form);
27-
});
19+
$(window)
20+
.on('formValidationPluginInit', function(evt, config) {
21+
convertDeprecatedLangCodeToISO6391(config);
22+
addSupportForCustomErrorMessageCallback(config);
23+
addSupportForElementReferenceInPositionParam(config);
24+
})
25+
.on('validatorsLoaded formValidationSetup', function(evt, $form) {
26+
if( !$form ) {
27+
$form = $('form');
28+
}
29+
addSupportForValidationDependingOnCheckedInput($form);
30+
});
2831

2932

3033
function addSupportForCustomErrorMessageCallback(config) {
@@ -88,4 +91,20 @@
8891
});
8992
}
9093

94+
function convertDeprecatedLangCodeToISO6391(config) {
95+
var deprecatedLangCodes = {
96+
se: 'sv',
97+
cz: 'cs',
98+
dk: 'da'
99+
};
100+
101+
if (config.lang in deprecatedLangCodes) {
102+
var newLangCode = deprecatedLangCodes[config.lang];
103+
$.formUtils.warn(
104+
'Deprecated use of lang code "'+config.lang+'" use "'+newLangCode+'" instead'
105+
);
106+
config.lang = newLangCode;
107+
}
108+
}
109+
91110
})(jQuery);

src/main/setup.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070

7171
conf = $.extend(defaultConf, conf || {});
7272

73+
$(window).trigger('formValidationPluginInit', [conf]);
74+
7375
if( conf.lang && conf.lang !== 'en' ) {
7476
var langModule = 'lang/'+conf.lang+'.js';
7577
conf.modules += conf.modules.length ? ','+langModule : langModule;

0 commit comments

Comments
 (0)