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

Proper languages subtag support #271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/css/bootstrap-formhelpers.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* bootstrap-formhelpers.js v2.3.0 by @vincentlamanna
* Copyright 2013 Vincent Lamanna
* Copyright 2016 Vincent Lamanna
* http://www.apache.org/licenses/LICENSE-2.0
*/
.bfh-flag-AD,
Expand Down
2 changes: 1 addition & 1 deletion dist/css/bootstrap-formhelpers.min.css

Large diffs are not rendered by default.

47 changes: 24 additions & 23 deletions dist/js/bootstrap-formhelpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* bootstrap-formhelpers.js v2.3.0 by @vincentlamanna
* Copyright 2013 Vincent Lamanna
* Copyright 2016 Vincent Lamanna
* http://www.apache.org/licenses/LICENSE-2.0
*/
if (!jQuery) { throw new Error("Bootstrap Form Helpers requires jQuery"); }
Expand Down Expand Up @@ -7814,7 +7814,7 @@ var BFHLanguagesList = {
'mk': 'македонски јазик',
'mn': 'монгол',
'ce': 'нохчийн мотт',
'ru': 'русский язык',
'ru': 'Русский язык',
'sr': 'српски језик',
'tt': 'татар теле',
'tg': 'тоҷикӣ',
Expand Down Expand Up @@ -7989,7 +7989,7 @@ var BFHPhoneFormatList = {
'IQ': '+964 ddddddddd',
'IE': '+353 ddddddddd',
'IL': '+972 ddddddddd',
'IT': '+39 ddddddddd',
'IT': '+39 ddddddddddd',
'JM': '+1 (ddd) ddd-dddd',
'JP': '+81 ddddddddd',
'JO': '+962 ddddddddd',
Expand Down Expand Up @@ -8058,7 +8058,7 @@ var BFHPhoneFormatList = {
'QA': '+974 ddddddddd',
'RE': '+262 ddddddddd',
'RO': '+40 ddddddddd',
'RU': '+7 ddddddddd',
'RU': '+7 dddddddddd',
'RW': '+250 ddddddddd',
'ST': '+239 ddddddddd',
'SH': '+290 ddddddddd',
Expand Down Expand Up @@ -10669,21 +10669,21 @@ var BFHStatesList = {
'27' : {'code':'ZBA','name':'Zomba'}
},
'MY':{
'1' : {'code':'Johor','name':'Johor'},
'2' : {'code':'Kedah','name':'Kedah'},
'3' : {'code':'Kelantan','name':'Kelantan'},
'4' : {'code':'Labuan','name':'Labuan'},
'5' : {'code':'Melaka','name':'Melaka'},
'6' : {'code':'Negeri Sembilan','name':'Negeri Sembilan'},
'7' : {'code':'Pahang','name':'Pahang'},
'8' : {'code':'Perak','name':'Perak'},
'9' : {'code':'Perlis','name':'Perlis'},
'10' : {'code':'Pulau Pinang','name':'Pulau Pinang'},
'11' : {'code':'Sabah','name':'Sabah'},
'12' : {'code':'Sarawak','name':'Sarawak'},
'13' : {'code':'Selangor','name':'Selangor'},
'14' : {'code':'Terengganu','name':'Terengganu'},
'15' : {'code':'Kuala Lumpur','name':'Kuala Lumpur'}
'1' : {'code':'JHR','name':'Johor'},
'2' : {'code':'KDH','name':'Kedah'},
'3' : {'code':'KTN','name':'Kelantan'},
'4' : {'code':'LBN','name':'Labuan'},
'5' : {'code':'MLK','name':'Melaka'},
'6' : {'code':'NSN','name':'Negeri Sembilan'},
'7' : {'code':'PHG','name':'Pahang'},
'8' : {'code':'PRK','name':'Perak'},
'9' : {'code':'PLS','name':'Perlis'},
'10' : {'code':'PNG','name':'Pulau Pinang'},
'11' : {'code':'SBH','name':'Sabah'},
'12' : {'code':'SWK','name':'Sarawak'},
'13' : {'code':'SGR','name':'Selangor'},
'14' : {'code':'TRG','name':'Terengganu'},
'15' : {'code':'KUL','name':'Kuala Lumpur'}
},
'MV':{
'1' : {'code':'AAD','name':'Ari Atoll Dheknu'},
Expand Down Expand Up @@ -15702,6 +15702,7 @@ var BFHTimezonesList = {
* ==========================================================
* Copyright 2012 Vincent Lamanna
* Contribution 2013 Tomasz Kuter
* Copyright 2016 GPC.solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -15759,7 +15760,7 @@ var BFHTimezonesList = {
if (this.options.available.hasOwnProperty(language)) {
if (this.options.available[language].indexOf('_') !== -1) {
split = this.options.available[language].split('_');
languages[split[0]] = {name: BFHLanguagesList[split[0]], country: split[1]};
languages[this.options.available[language]] = {name: BFHLanguagesList[split[0]], country: split[1]};
} else {
languages[this.options.available[language]] = BFHLanguagesList[this.options.available[language]];
}
Expand Down Expand Up @@ -15790,7 +15791,7 @@ var BFHTimezonesList = {
for (language in languages) {
if (languages.hasOwnProperty(language)) {
if (languages[language].hasOwnProperty('name')) {
this.$element.append('<option value="' + language + '_' + languages[language].country + '">' + languages[language].name.toProperCase() + ' (' + BFHCountriesList[languages[language].country] + ')</option>');
this.$element.append('<option value="' + language + '">' + languages[language].name.toProperCase() + ' (' + BFHCountriesList[languages[language].country] + ')</option>');
} else {
this.$element.append('<option value="' + language + '">' + languages[language].toProperCase() + '</option>');
}
Expand Down Expand Up @@ -15825,9 +15826,9 @@ var BFHTimezonesList = {
if (languages.hasOwnProperty(language)) {
if (languages[language].hasOwnProperty('name')) {
if (this.options.flags === true) {
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '_' + languages[language].country + '"><i class="glyphicon bfh-flag-' + languages[language].country + '"></i>' + languages[language].name.toProperCase() + '</a></li>');
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '"><i class="glyphicon bfh-flag-' + languages[language].country + '"></i>' + languages[language].name.toProperCase() + '</a></li>');
} else {
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '_' + languages[language].country + '">' + languages[language].name.toProperCase() + ' (' + BFHCountriesList[languages[language].country] + ')</a></li>');
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '">' + languages[language].name.toProperCase() + ' (' + BFHCountriesList[languages[language].country] + ')</a></li>');
}
} else {
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '">' + languages[language] + '</a></li>');
Expand Down
15 changes: 11 additions & 4 deletions dist/js/bootstrap-formhelpers.min.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions js/bootstrap-formhelpers-languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* ==========================================================
* Copyright 2012 Vincent Lamanna
* Contribution 2013 Tomasz Kuter
* Copyright 2016 GPC.solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -61,7 +62,7 @@
if (this.options.available.hasOwnProperty(language)) {
if (this.options.available[language].indexOf('_') !== -1) {
split = this.options.available[language].split('_');
languages[split[0]] = {name: BFHLanguagesList[split[0]], country: split[1]};
languages[this.options.available[language]] = {name: BFHLanguagesList[split[0]], country: split[1]};
} else {
languages[this.options.available[language]] = BFHLanguagesList[this.options.available[language]];
}
Expand Down Expand Up @@ -92,7 +93,7 @@
for (language in languages) {
if (languages.hasOwnProperty(language)) {
if (languages[language].hasOwnProperty('name')) {
this.$element.append('<option value="' + language + '_' + languages[language].country + '">' + languages[language].name.toProperCase() + ' (' + BFHCountriesList[languages[language].country] + ')</option>');
this.$element.append('<option value="' + language + '">' + languages[language].name.toProperCase() + ' (' + BFHCountriesList[languages[language].country] + ')</option>');
} else {
this.$element.append('<option value="' + language + '">' + languages[language].toProperCase() + '</option>');
}
Expand Down Expand Up @@ -127,9 +128,9 @@
if (languages.hasOwnProperty(language)) {
if (languages[language].hasOwnProperty('name')) {
if (this.options.flags === true) {
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '_' + languages[language].country + '"><i class="glyphicon bfh-flag-' + languages[language].country + '"></i>' + languages[language].name.toProperCase() + '</a></li>');
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '"><i class="glyphicon bfh-flag-' + languages[language].country + '"></i>' + languages[language].name.toProperCase() + '</a></li>');
} else {
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '_' + languages[language].country + '">' + languages[language].name.toProperCase() + ' (' + BFHCountriesList[languages[language].country] + ')</a></li>');
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '">' + languages[language].name.toProperCase() + ' (' + BFHCountriesList[languages[language].country] + ')</a></li>');
}
} else {
$options.append('<li><a tabindex="-1" href="#" data-option="' + language + '">' + languages[language] + '</a></li>');
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
}
],
"devDependencies": {
"coveralls": "~2.5.0",
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.3.0",
Expand All @@ -30,12 +31,11 @@
"grunt-contrib-qunit": "~0.3.0",
"grunt-contrib-uglify": "~0.2.4",
"grunt-contrib-watch": "~0.5.3",
"grunt-recess": "~0.5.0",
"grunt-karma": "~0.6.2",
"karma": "~0.10.2",
"karma-qunit": "~0.1.1",
"grunt-karma-coveralls": "~2.0.2",
"grunt-recess": "~0.5.0",
"karma": "^0.10.10",
"karma-coverage": "~0.1.0",
"coveralls": "~2.5.0",
"grunt-karma-coveralls": "~2.0.2"
"karma-qunit": "~0.1.1"
}
}