Added amdBase
and amdLanguageBase
options
This should allow those using their own build systems to automatically load in translations. In the future, the `amdBase` option may be used to optionally load some components of Select2. As Select2 cannot know what the base directory is, it currently has to load in all of the optional components in the default build. By allowing users to set their own base, it will allow us to know the base to load files from, which makes it easier to use the `require` function to optionally load them. This fixes https://github.com/select2/select2/issues/2899.
This commit is contained in:
parent
584d3b48a2
commit
86b4a5d8e2
6
dist/js/select2.amd.full.js
vendored
6
dist/js/select2.amd.full.js
vendored
@ -3570,7 +3570,7 @@ define('select2/defaults',[
|
||||
language = Translation.loadPath(name);
|
||||
} catch (e) {
|
||||
// If we couldn't load it, check if it wasn't the full path
|
||||
name = 'select2/i18n/' + name;
|
||||
name = this.get('amdTranslationBase') + name;
|
||||
language = Translation.loadPath(name);
|
||||
}
|
||||
|
||||
@ -3641,6 +3641,8 @@ define('select2/defaults',[
|
||||
}
|
||||
|
||||
this.defaults = {
|
||||
amdBase: 'select2/',
|
||||
amdLanguageBase: 'select2/i18n/',
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
minimumInputLength: 0,
|
||||
@ -4538,7 +4540,7 @@ define('select2/dropdown/attachContainer',[
|
||||
|
||||
define('jquery.select2',[
|
||||
'jquery',
|
||||
'select2/core'
|
||||
'./select2/core'
|
||||
], function ($, Select2) {
|
||||
// Force jQuery.mousewheel to be loaded if it hasn't already
|
||||
try {
|
||||
|
6
dist/js/select2.amd.js
vendored
6
dist/js/select2.amd.js
vendored
@ -3570,7 +3570,7 @@ define('select2/defaults',[
|
||||
language = Translation.loadPath(name);
|
||||
} catch (e) {
|
||||
// If we couldn't load it, check if it wasn't the full path
|
||||
name = 'select2/i18n/' + name;
|
||||
name = this.get('amdTranslationBase') + name;
|
||||
language = Translation.loadPath(name);
|
||||
}
|
||||
|
||||
@ -3641,6 +3641,8 @@ define('select2/defaults',[
|
||||
}
|
||||
|
||||
this.defaults = {
|
||||
amdBase: 'select2/',
|
||||
amdLanguageBase: 'select2/i18n/',
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
minimumInputLength: 0,
|
||||
@ -4254,7 +4256,7 @@ define('select2/core',[
|
||||
|
||||
define('jquery.select2',[
|
||||
'jquery',
|
||||
'select2/core'
|
||||
'./select2/core'
|
||||
], function ($, Select2) {
|
||||
// Force jQuery.mousewheel to be loaded if it hasn't already
|
||||
try {
|
||||
|
6
dist/js/select2.full.js
vendored
6
dist/js/select2.full.js
vendored
@ -13105,7 +13105,7 @@ define('select2/defaults',[
|
||||
language = Translation.loadPath(name);
|
||||
} catch (e) {
|
||||
// If we couldn't load it, check if it wasn't the full path
|
||||
name = 'select2/i18n/' + name;
|
||||
name = this.get('amdTranslationBase') + name;
|
||||
language = Translation.loadPath(name);
|
||||
}
|
||||
|
||||
@ -13176,6 +13176,8 @@ define('select2/defaults',[
|
||||
}
|
||||
|
||||
this.defaults = {
|
||||
amdBase: 'select2/',
|
||||
amdLanguageBase: 'select2/i18n/',
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
minimumInputLength: 0,
|
||||
@ -14073,7 +14075,7 @@ define('select2/dropdown/attachContainer',[
|
||||
|
||||
define('jquery.select2',[
|
||||
'jquery',
|
||||
'select2/core'
|
||||
'./select2/core'
|
||||
], function ($, Select2) {
|
||||
// Force jQuery.mousewheel to be loaded if it hasn't already
|
||||
try {
|
||||
|
4
dist/js/select2.full.min.js
vendored
4
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
6
dist/js/select2.js
vendored
6
dist/js/select2.js
vendored
@ -3998,7 +3998,7 @@ define('select2/defaults',[
|
||||
language = Translation.loadPath(name);
|
||||
} catch (e) {
|
||||
// If we couldn't load it, check if it wasn't the full path
|
||||
name = 'select2/i18n/' + name;
|
||||
name = this.get('amdTranslationBase') + name;
|
||||
language = Translation.loadPath(name);
|
||||
}
|
||||
|
||||
@ -4069,6 +4069,8 @@ define('select2/defaults',[
|
||||
}
|
||||
|
||||
this.defaults = {
|
||||
amdBase: 'select2/',
|
||||
amdLanguageBase: 'select2/i18n/',
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
minimumInputLength: 0,
|
||||
@ -4682,7 +4684,7 @@ define('select2/core',[
|
||||
|
||||
define('jquery.select2',[
|
||||
'jquery',
|
||||
'select2/core'
|
||||
'./select2/core'
|
||||
], function ($, Select2) {
|
||||
// Force jQuery.mousewheel to be loaded if it hasn't already
|
||||
try {
|
||||
|
2
dist/js/select2.min.js
vendored
2
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
define([
|
||||
'jquery',
|
||||
'select2/core'
|
||||
'./select2/core'
|
||||
], function ($, Select2) {
|
||||
// Force jQuery.mousewheel to be loaded if it hasn't already
|
||||
try {
|
||||
|
4
src/js/select2/defaults.js
vendored
4
src/js/select2/defaults.js
vendored
@ -187,7 +187,7 @@ define([
|
||||
language = Translation.loadPath(name);
|
||||
} catch (e) {
|
||||
// If we couldn't load it, check if it wasn't the full path
|
||||
name = 'select2/i18n/' + name;
|
||||
name = this.get('amdTranslationBase') + name;
|
||||
language = Translation.loadPath(name);
|
||||
}
|
||||
|
||||
@ -258,6 +258,8 @@ define([
|
||||
}
|
||||
|
||||
this.defaults = {
|
||||
amdBase: 'select2/',
|
||||
amdLanguageBase: 'select2/i18n/',
|
||||
language: EnglishTranslation,
|
||||
matcher: matcher,
|
||||
minimumInputLength: 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user