Ext.ns('ip2');
Ext.ns('ip2.locale');

Ext.define('ip2LocaleLanguageCountryDataModel', {
	extend: 'Ext.data.Model',
	fields: [
	{ name: 'languageCode', type: 'string' },{ name: 'language', type: 'string' },{ name: 'country', type: 'string' },{ name: 'flag', type: 'string' }
	]
});

// --------------------------------------------------------------------------------------------
// function: return country name by language code
// --------------------------------------------------------------------------------------------
ip2.locale.getLanguageByCode = function (languageCode) {
	ip2.locale.languageCountryStore.clearFilter(true);
	var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, true);
	if (!record) {
		var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, false);
	}
	if (record) {
		return record.data.language;
	}
	else {
		return languageCode;
	}
}

// --------------------------------------------------------------------------------------------
// function: return country name by language code as I18N
// --------------------------------------------------------------------------------------------
ip2.locale.getI18nLanguageByCode = function (s_code) {

	var i_store = ip2.locale.languageStoreI18N,
	i_record;

	i_store.clearFilter(true);

	var i_record = i_store.findRecord('code', s_code, 0, false, true, true);

	if (!i_record) {
		var i_record = i_store.findRecord('code', s_code, 0, false, true, false);
	}
	else if (i_record) {
		return i_record.get('language');
	}
	else {
		return s_code;
	}
};

// --------------------------------------------------------------------------------------------
// function: return language description by language code
// --------------------------------------------------------------------------------------------
ip2.locale.getLanguageTextByLanguageCode = function (languageCode) {
	ip2.locale.languageCountryStore.clearFilter(true);
	var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, true);
	if (!record) {
		var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, false);
	}
	if (record) {
		return (record.data.languageCode.indexOf('-') == -1) ? record.data.language : record.data.language + '/' + record.data.country;
	}
	else {
		return languageCode;
	}
}

// --------------------------------------------------------------------------------------------
// function: return country name by language code
// --------------------------------------------------------------------------------------------
ip2.locale.getCountryByLanguageCode = function (languageCode) {
	ip2.locale.languageCountryStore.clearFilter(true);
	var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, true);
	if (!record) {
		var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, false);
	}
	if (record) {
		return record.data.country;
	}
	else {
		return languageCode;
	}
};

// --------------------------------------------------------------------------------------------
// function: return country flag by language code
// --------------------------------------------------------------------------------------------
ip2.locale.getCountryFlagByLanguageCode = function (languageCode) {
	ip2.locale.languageCountryStore.clearFilter(true);
	var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, true);
	if (!record) {
		var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, false);
	}
	if (record) {
		if (record.data.flag) {
			return '/system/images/flags/16x16/flag_' + record.data.flag.toLowerCase() + '.png';
		}
		else {
			return '/system/images/flags/16x16/flag_' + record.data.country.toLowerCase().replace(/ /g, "_") + '.png';
		}
	}
	else {
		return languageCode;
	}
};

ip2.locale.languageCountryStore = Ext.create('Ext.data.Store', {
	model: 'ip2LocaleLanguageCountryDataModel',data: [
	{ country: "Afghanistan", language: "Dari", languageCode: "prs-AF" },{ country: "South Africa", language: "Afrikaans", languageCode: "af" },{ country: "Ethiopia", language: "Amharic", languageCode: "am" },{ country: "X", language: "Arabic", languageCode: "ar" },{ country: "U.A.E.", language: "Arabic", languageCode: "ar-AE" },{ country: "Bahrain", language: "Arabic", languageCode: "ar-BH" },{ country: "Algeria", language: "Arabic", languageCode: "ar-DZ" },{ country: "Egypt", language: "Arabic", languageCode: "ar-EG" },{ country: "Iraq", language: "Arabic", languageCode: "ar-IQ" },{ country: "Jordan", language: "Arabic", languageCode: "ar-JO" },{ country: "Kuwait", language: "Arabic", languageCode: "ar-KW" },{ country: "Lebanon", language: "Arabic", languageCode: "ar-LB" },{ country: "Libya", language: "Arabic", languageCode: "ar-LY" },{ country: "Morocco", language: "Arabic", languageCode: "ar-MA" },{ country: "Oman", language: "Arabic", languageCode: "ar-OM" },{ country: "Qatar", language: "Arabic", languageCode: "ar-QA" },{ country: "Saudi Arabia", language: "Arabic", languageCode: "ar-SA" },{ country: "Syria", language: "Arabic", languageCode: "ar-SY" },{ country: "Tunisia", language: "Arabic", languageCode: "ar-TN" },{ country: "Yemen", language: "Arabic", languageCode: "ar-YE" },{ country: "Chile", language: "Mapudungun", languageCode: "arn" },{ country: "India", language: "Assamese", languageCode: "as" },{ country: "Azerbaijan", language: "Azeri", languageCode: "az" },{ country: "Azerbaijan", language: "Azeri (Cyrillic)", languageCode: "az-AZ" },{ country: "Azerbaijan", language: "Azeri (Latin)", languageCode: "az-AZ" },{ country: "Russia", language: "Bashkir", languageCode: "ba" },{ country: "Belarus", language: "Belarusian", languageCode: "be" },{ country: "Bulgaria", language: "Bulgarian", languageCode: "bg" },{ country: "X", language: "Bengali", languageCode: "bn" },{ country: "Bangladesh", language: "Bengali", languageCode: "bn-BD" },{ country: "India", language: "Bengali", languageCode: "bn-IN" },{ country: "People's Republic of China", language: "Tibetan", languageCode: "bo" },{ country: "France", language: "Breton", languageCode: "br" },{ country: "Bosnia and Herzegovina", language: "Bosnian", languageCode: "bs" },{ country: "Bosnia and Herzegovina", language: "Bosnian (Cyrillic)", languageCode: "bs-BA" },{ country: "Bosnia and Herzegovina", language: "Bosnian (Latin)", languageCode: "bs-BA" },{ country: "Spain", language: "Catalan", languageCode: "ca" },{ country: "France", language: "Corsican", languageCode: "co" },{ country: "Czech Republic", language: "Czech", languageCode: "cs" },{ country: "United Kingdom", language: "Welsh", languageCode: "cy", flag: "wales" },{ country: "Denmark", language: "Danish", languageCode: "da" },{ country: "Germany", language: "German", languageCode: "de" },{ country: "Austria", language: "German", languageCode: "de-AT" },{ country: "Switzerland", language: "German", languageCode: "de-CH" },{ country: "Germany", language: "German", languageCode: "de-DE" },{ country: "Liechtenstein", language: "German", languageCode: "de-LI" },{ country: "Luxembourg", language: "German", languageCode: "de-LU" },{ country: "Germany", language: "Lower Sorbian", languageCode: "dsb" },{ country: "Maldives", language: "Divehi", languageCode: "dv" },{ country: "Greece", language: "Greek", languageCode: "el" },{ country: "Great Britain", language: "English", languageCode: "en", flag: "great_britain" },{ country: "Caribbean", language: "English", languageCode: "en-029" },{ country: "Australia", language: "English", languageCode: "en-AU" },{ country: "Belize", language: "English", languageCode: "en-BZ" },{ country: "Canada", language: "English", languageCode: "en-CA" },{ country: "United Kingdom", language: "English", languageCode: "en-GB", flag: "great_britain" },{ country: "Ireland", language: "English", languageCode: "en-IE" },{ country: "India", language: "English", languageCode: "en-IN" },{ country: "Jamaica", language: "English", languageCode: "en-JM" },{ country: "Malaysia", language: "English", languageCode: "en-MY" },{ country: "New Zealand", language: "English", languageCode: "en-NZ" },{ country: "Republic of the Philippines", language: "English", languageCode: "en-PH" },{ country: "Singapore", language: "English", languageCode: "en-SG" },{ country: "Trinidad and Tobago", language: "English", languageCode: "en-TT" },{ country: "United States", language: "English", languageCode: "en-US" },{ country: "South Africa", language: "English", languageCode: "en-ZA" },{ country: "Zimbabwe", language: "English", languageCode: "en-ZW " },{ country: "Spain", language: "Spanish", languageCode: "es", flag: "spain" },{ country: "Argentina", language: "Spanish", languageCode: "es-AR" },{ country: "Bolivia", language: "Spanish", languageCode: "es-BO" },{ country: "Chile", language: "Spanish", languageCode: "es-CL" },{ country: "Colombia", language: "Spanish", languageCode: "es-CO" },{ country: "Costa Rica", language: "Spanish", languageCode: "es-CR" },{ country: "Dominican Republic", language: "Spanish", languageCode: "es-DO" },{ country: "Ecuador", language: "Spanish", languageCode: "es-EC" },{ country: "Spain", language: "Spanish", languageCode: "es-ES" },{ country: "Guatemala", language: "Spanish", languageCode: "es-GT" },{ country: "Honduras", language: "Spanish", languageCode: "es-HN" },{ country: "Mexico", language: "Spanish", languageCode: "es-MX" },{ country: "Nicaragua", language: "Spanish", languageCode: "es-NI" },{ country: "Panama", language: "Spanish", languageCode: "es-PA" },{ country: "Peru", language: "Spanish", languageCode: "es-PE" },{ country: "Puerto Rico", language: "Spanish", languageCode: "es-PR" },{ country: "Paraguay", language: "Spanish", languageCode: "es-PY" },{ country: "El Salvador", language: "Spanish", languageCode: "es-SV" },{ country: "United States", language: "Spanish", languageCode: "es-US" },{ country: "Uruguay", language: "Spanish", languageCode: "es-UY" },{ country: "Bolivarian Republic of Venezuela", language: "Spanish", languageCode: "es-VE" },{ country: "Estonia", language: "Estonian", languageCode: "et" },{ country: "Spain", language: "Basque", languageCode: "eu" },{ country: "Iran", language: "Persian", languageCode: "fa" },{ country: "Finland", language: "Finnish", languageCode: "fi" },{ country: "Philippines", language: "Filipino", languageCode: "fil" },{ country: "Faroe Islands", language: "Faroese", languageCode: "fo" },{ country: "France", language: "French", languageCode: "fr", flag: "france" },{ country: "Belgium", language: "French", languageCode: "fr-BE" },{ country: "Canada", language: "French", languageCode: "fr-CA" },{ country: "Switzerland", language: "French", languageCode: "fr-CH" },{ country: "France", language: "French", languageCode: "fr-FR" },{ country: "Luxembourg", language: "French", languageCode: "fr-LU" },{ country: "Principality of Monaco", language: "French", languageCode: "fr-MC" },{ country: "Netherlands", language: "Frisian", languageCode: "fy" },{ country: "Ireland", language: "Irish", languageCode: "ga" },{ country: "United Kingdom", language: "Scottish Gaelic", languageCode: "gd", flag: "scotland" },{ country: "Spain", language: "Galician", languageCode: "gl" },{ country: "France", language: "Alsatian", languageCode: "gsw" },{ country: "India", language: "Gujarati", languageCode: "gu" },{ country: "Nigeria", language: "Hausa (Latin)", languageCode: "ha" },{ country: "Israel", language: "Hebrew", languageCode: "he" },{ country: "India", language: "Hindi", languageCode: "hi" },{ country: "X", language: "Croatian", languageCode: "hr" },{ country: "Bosnia and Herzegovina", language: "Croatian", languageCode: "hr-BA" },{ country: "Croatia", language: "Croatian", languageCode: "hr-HR" },{ country: "Germany", language: "Upper Sorbian", languageCode: "hsb" },{ country: "Hungary", language: "Hungarian", languageCode: "hu" },{ country: "Armenia", language: "Armenian", languageCode: "hy" },{ country: "Indonesia", language: "Indonesian", languageCode: "id" },{ country: "Nigeria", language: "Igbo", languageCode: "ig" },{ country: "People's Republic of China", language: "Yi", languageCode: "ii" },{ country: "Iceland", language: "Icelandic", languageCode: "is" },{ country: "X", language: "Italian", languageCode: "it" },{ country: "Switzerland", language: "Italian", languageCode: "it-CH" },{ country: "Italy", language: "Italian", languageCode: "it-IT" },{ country: "X", language: "Inuktitut", languageCode: "iu" },{ country: "Canada", language: "Inuktitut (Latin)", languageCode: "iu-CA" },{ country: "Canada", language: "Inuktitut (Syllabics)", languageCode: "iu-CA" },{ country: "Japan", language: "Japanese", languageCode: "ja" },{ country: "Georgia", language: "Georgian", languageCode: "ka" },{ country: "Kazakhstan", language: "Kazakh", languageCode: "kk" },{ country: "Greenland", language: "Greenlandic", languageCode: "kl" },{ country: "Cambodia", language: "Khmer", languageCode: "km" },{ country: "India", language: "Kannada", languageCode: "kn" },{ country: "India", language: "Konkani", languageCode: "kok" },{ country: "Korea", language: "Korean", languageCode: "ko" },{ country: "Kyrgyzstan", language: "Kyrgyz", languageCode: "ky" },{ country: "Luxembourg", language: "Luxembourgish", languageCode: "lb" },{ country: "Lao P.D.R.", language: "Lao", languageCode: "lo" },{ country: "Lithuania", language: "Lithuanian", languageCode: "lt" },{ country: "Latvia", language: "Latvian", languageCode: "lv" },{ country: "New Zealand", language: "Maori", languageCode: "mi" },{ country: "Macedonia (FYROM)", language: "Macedonian (FYROM)", languageCode: "mk" },{ country: "India", language: "Malayalam", languageCode: "ml" },{ country: "Mongolia ", language: "Mongolian", languageCode: "mn" },{ country: "People's Republic of China", language: "Mongolian (Traditional Mongolian)", languageCode: "mn-CN" },{ country: "Mongolia", language: "Mongolian (Cyrillic)", languageCode: "mn-MN" },{ country: "Canada", language: "Mohawk", languageCode: "moh" },{ country: "India", language: "Marathi", languageCode: "mr" },{ country: "Malaysia", language: "Malay", languageCode: "ms" },{ country: "Brunei Darussalam", language: "Malay", languageCode: "ms-BN" },{ country: "Malaysia", language: "Malay", languageCode: "ms-MY" },{ country: "Malta", language: "Maltese", languageCode: "mt" },{ country: "Norway", language: "Norwegian (Bokmal)", languageCode: "nb" },{ country: "Nepal", language: "Nepali", languageCode: "ne" },{ country: "Nederland", language: "Dutch", languageCode: "nl" },{ country: "Belgium", language: "Dutch", languageCode: "nl-BE" },{ country: "Netherlands", language: "Dutch", languageCode: "nl-NL" },{ country: "Norway", language: "Norwegian (Nynorsk)", languageCode: "nn" },{ country: "Norway", language: "Norwegian", languageCode: "no" },{ country: "South Africa", language: "Sesotho sa Leboa", languageCode: "nso" },{ country: "France", language: "Occitan", languageCode: "oc" },{ country: "India", language: "Oriya", languageCode: "or" },{ country: "India", language: "Punjabi", languageCode: "pa" },{ country: "Poland", language: "Polish", languageCode: "pl" },{ country: "Afghanistan", language: "Dari", languageCode: "prs" },{ country: "Afghanistan", language: "Pashto", languageCode: "ps" },{ country: "Portugal", language: "Portuguese", languageCode: "pt", flag: "portugal" },{ country: "Brazil", language: "Portuguese", languageCode: "pt-BR" },{ country: "Portugal", language: "Portuguese", languageCode: "pt-PT" },{ country: "Guatemala", language: "K'iche", languageCode: "qut" },{ country: "The central Andes of South America", language: "Quechua", languageCode: "quz" },{ country: "Bolivia", language: "Quechua", languageCode: "quz-BO" },{ country: "Ecuador", language: "Quechua", languageCode: "quz-EC" },{ country: "Peru", language: "Quechua", languageCode: "quz-PE" },{ country: "Switzerland", language: "Romansh", languageCode: "rm" },{ country: "Romania", language: "Romanian", languageCode: "ro" },{ country: "Russia", language: "Russian", languageCode: "ru" },{ country: "Rwanda", language: "Kinyarwanda", languageCode: "rw" },{ country: "Russia", language: "Yakut", languageCode: "sah" },{ country: "India", language: "Sanskrit", languageCode: "sa" },{ country: "Sami", language: "Sami (Northern)", languageCode: "se" },{ country: "Finland", language: "Sami (Northern)", languageCode: "se-FI" },{ country: "Norway", language: "Sami (Northern)", languageCode: "se-NO" },{ country: "Sweden", language: "Sami (Northern)", languageCode: "se-SE" },{ country: "Sri Lanka", language: "Sinhala", languageCode: "si" },{ country: "Slovakia", language: "Slovak", languageCode: "sk" },{ country: "Slovenia", language: "Slovenian", languageCode: "sl" },{ country: "X", language: "Sami (Southern)", languageCode: "sma" },{ country: "Norway", language: "Sami (Southern)", languageCode: "sma-NO" },{ country: "Sweden", language: "Sami (Southern)", languageCode: "sma-SE" },{ country: "X", language: "Sami (Lule)", languageCode: "smj" },{ country: "Norway", language: "Sami (Lule)", languageCode: "smj-NO" },{ country: "Sweden", language: "Sami (Lule)", languageCode: "smj-SE" },{ country: "Finland", language: "Sami (Inari)", languageCode: "smn" },{ country: "Finland", language: "Sami (Skolt)", languageCode: "sms" },{ country: "Albania", language: "Albanian", languageCode: "sq" },{ country: "X", language: "Serbian", languageCode: "sr" },{ country: "Bosnia and Herzegovina", language: "Serbian (Cyrillic)", languageCode: "sr-BA" },{ country: "Bosnia and Herzegovina", language: "Serbian (Latin)", languageCode: "sr-BA" },{ country: "Serbia and Montenegro (Former)", language: "Serbian (Cyrillic)", languageCode: "sr-CS" },{ country: "Serbia and Montenegro (Former)", language: "Serbian (Latin)", languageCode: "sr-CS" },{ country: "Montenegro", language: "Serbian (Cyrillic)", languageCode: "sr-ME" },{ country: "Montenegro", language: "Serbian (Latin)", languageCode: "sr-ME" },{ country: "Serbia", language: "Serbian (Cyrillic)", languageCode: "sr-RS" },{ country: "Serbia", language: "Serbian (Latin)", languageCode: "sr-RS" },{ country: "X", language: "Swedish", languageCode: "se", flag: "sweden" },{ country: "Finland", language: "Swedish", languageCode: "sv-FI" },{ country: "Sweden", language: "Swedish", languageCode: "sv-SE" },{ country: "Kenya", language: "Kiswahili", languageCode: "sw" },{ country: "Syria", language: "Syriac", languageCode: "syr" },{ country: "India", language: "Tamil", languageCode: "ta" },{ country: "India", language: "Telugu", languageCode: "te" },{ country: "Tajikistan", language: "Tajik (Cyrillic)", languageCode: "tg" },{ country: "Thailand", language: "Thai", languageCode: "th" },{ country: "Turkmenistan", language: "Turkmen", languageCode: "tk" },{ country: "South Africa", language: "Setswana", languageCode: "tn" },{ country: "Turkey", language: "Turkish", languageCode: "tr" },{ country: "Russia", language: "Tatar", languageCode: "tt" },{ country: "Algeria", language: "Tamazight (Latin)", languageCode: "tzm" },{ country: "People's Republic of China", language: "Uyghur", languageCode: "ug" },{ country: "Ukraine", language: "Ukrainian", languageCode: "uk" },{ country: "Islamic Republic of Pakistan", language: "Urdu", languageCode: "ur" },{ country: "Uzbekistan", language: "Uzbek", languageCode: "uz" },{ country: "Vietnam", language: "Vietnamese", languageCode: "vi" },{ country: "Senegal", language: "Wolof", languageCode: "wo" },{ country: "South Africa", language: "isiXhosa", languageCode: "xh" },{ country: "Nigeria", language: "Yoruba", languageCode: "yo" },{ country: "X", language: "Chinese", languageCode: "zh" },{ country: "People's Republic of China", language: "Chinese (Simplified) Legacy", languageCode: "zh-CN" },{ country: "Hong Kong S.A.R.", language: "Chinese (Traditional) Legacy", languageCode: "zh-HK" },{ country: "Macao S.A.R.", language: "Chinese (Traditional) Legacy", languageCode: "zh-MO" },{ country: "Singapore", language: "Chinese (Simplified) Legacy", languageCode: "zh-SG" },{ country: "Taiwan", language: "Chinese (Traditional) Legacy", languageCode: "zh-TW" },{ country: "South Africa", language: "isiZulu", languageCode: "zu" }
	]
});

ip2.locale.languageStoreI18N = Ext.create('Ext.data.Store', {
	fields: [
		{ name: 'code', type: 'string' },
		{ name: 'language', type: 'auto' },
		{ name: 'country', type: 'string' },
		{ name: 'flag', type: 'string' }
	],data: [
	{ country: "Afghanistan", language: { da: "Dari", en: "Dari" }, code: "prs-AF" },{ country: "South Africa", language: { da: "Afrikaans", en: "Afrikaans" }, code: "af" },{ country: "Ethiopia", language: { da: "Amharic", en: "Amharic" }, code: "am" },{ country: "X", language: { da: "Arabisk", en: "Arabic" }, code: "ar" },{ country: "U.A.E.", language: { da: "Arabisk", en: "Arabic" }, code: "ar-AE" },{ country: "Bahrain", language: { da: "Arabisk", en: "Arabic" }, code: "ar-BH" },{ country: "Algeria", language: { da: "Arabisk", en: "Arabic" }, code: "ar-DZ" },{ country: "Egypt", language: { da: "Arabisk", en: "Arabic" }, code: "ar-EG" },{ country: "Iraq", language: { da: "Arabisk", en: "Arabic" }, code: "ar-IQ" },{ country: "Jordan", language: { da: "Arabisk", en: "Arabic" }, code: "ar-JO" },{ country: "Kuwait", language: { da: "Arabisk", en: "Arabic" }, code: "ar-KW" },{ country: "Lebanon", language: { da: "Arabisk", en: "Arabic" }, code: "ar-LB" },{ country: "Libya", language: { da: "Arabisk", en: "Arabic" }, code: "ar-LY" },{ country: "Morocco", language: { da: "Arabisk", en: "Arabic" }, code: "ar-MA" },{ country: "Oman", language: { da: "Arabisk", en: "Arabic" }, code: "ar-OM" },{ country: "Qatar", language: { da: "Arabisk", en: "Arabic" }, code: "ar-QA" },{ country: "Saudi Arabia", language: { da: "Arabisk", en: "Arabic" }, code: "ar-SA" },{ country: "Syria", language: { da: "Arabisk", en: "Arabic" }, code: "ar-SY" },{ country: "Tunisia", language: { da: "Arabisk", en: "Arabic" }, code: "ar-TN" },{ country: "Yemen", language: { da: "Arabisk", en: "Arabic" }, code: "ar-YE" },{ country: "Chile", language: { da: "Mapudungun", en: "Mapudungun" }, code: "arn" },{ country: "India", language: { da: "Assamese", en: "Assamese" }, code: "as" },{ country: "Azerbaijan", language: { da: "Azeri", en: "Azeri" }, code: "az" },{ country: "Azerbaijan", language: { da: "Azeri (Cyrillic)", en: "Azeri (Cyrillic)" }, code: "az-AZ" },{ country: "Azerbaijan", language: { da: "Azeri (Latin)", en: "Azeri (Latin)" }, code: "az-AZ" },{ country: "Russia", language: { da: "Bashkir", en: "Bashkir" }, code: "ba" },{ country: "Belarus", language: { da: "Belarusian", en: "Belarusian" }, code: "be" },{ country: "Bulgaria", language: { da: "Bulgarisk", en: "Bulgarian" }, code: "bg" },{ country: "X", language: { da: "Bengali", en: "Bengali" }, code: "bn" },{ country: "Bangladesh", language: { da: "Bengali", en: "Bengali" }, code: "bn-BD" },{ country: "India", language: { da: "Bengali", en: "Bengali" }, code: "bn-IN" },{ country: "People's Republic of China", language: { da: "Tibetan", en: "Tibetan" }, code: "bo" },{ country: "France", language: { da: "Breton", en: "Breton" }, code: "br" },{ country: "Bosnia and Herzegovina", language: { da: "Bosnian", en: "Bosnian" }, code: "bs" },{ country: "Bosnia and Herzegovina", language: { da: "Bosnian (Cyrillic)", en: "Bosnian (Cyrillic)" }, code: "bs-BA" },{ country: "Bosnia and Herzegovina", language: { da: "Bosnian (Latin)", en: "Bosnian (Latin)" }, code: "bs-BA" },{ country: "Spain", language: { da: "Catalan", en: "Catalan" }, code: "ca" },{ country: "France", language: { da: "Corsican", en: "Corsican" }, code: "co" },{ country: "Czech Republic", language: { da: "Czech", en: "Czech" }, code: "cs" },{ country: "United Kingdom", language: { da: "Welsh", en: "Welsh" }, code: "cy", flag: "wales" },{ country: "Denmark", language: { da: "Dansk", en: "Danish" }, code: "da" },{ country: "Germany", language: { da: "Tysk", en: "German" }, code: "de" },{ country: "Austria", language: { da: "Tysk", en: "German" }, code: "de-AT" },{ country: "Switzerland", language: { da: "Tysk", en: "German" }, code: "de-CH" },{ country: "Germany", language: { da: "Tysk", en: "German" }, code: "de-DE" },{ country: "Liechtenstein", language: { da: "Tysk", en: "German" }, code: "de-LI" },{ country: "Luxembourg", language: { da: "Tysk", en: "German" }, code: "de-LU" },{ country: "Germany", language: { da: "Lower Sorbian", en: "Lower Sorbian" }, code: "dsb" },{ country: "Maldives", language: { da: "Divehi", en: "Divehi" }, code: "dv" },{ country: "Greece", language: { da: "Græsk", en: "Greek" }, code: "el" },{ country: "Great Britain", language: { da: "Engelsk", en: "English" }, code: "en", flag: "great_britain" },{ country: "Caribbean", language: { da: "Engelsk", en: "English" }, code: "en-029" },{ country: "Australia", language: { da: "Engelsk", en: "English" }, code: "en-AU" },{ country: "Belize", language: { da: "Engelsk", en: "English" }, code: "en-BZ" },{ country: "Canada", language: { da: "Engelsk", en: "English" }, code: "en-CA" },{ country: "United Kingdom", language: { da: "Engelsk", en: "English" }, code: "en-GB", flag: "great_britain" },{ country: "Ireland", language: { da: "Engelsk", en: "English" }, code: "en-IE" },{ country: "India", language: { da: "Engelsk", en: "English" }, code: "en-IN" },{ country: "Jamaica", language: { da: "Engelsk", en: "English" }, code: "en-JM" },{ country: "Malaysia", language: { da: "Engelsk", en: "English" }, code: "en-MY" },{ country: "New Zealand", language: { da: "Engelsk", en: "English" }, code: "en-NZ" },{ country: "Republic of the Philippines", language: { da: "Engelsk", en: "English" }, code: "en-PH" },{ country: "Singapore", language: { da: "Engelsk", en: "English" }, code: "en-SG" },{ country: "Trinidad and Tobago", language: { da: "Engelsk", en: "English" }, code: "en-TT" },{ country: "United States", language: { da: "Engelsk", en: "English" }, code: "en-US" },{ country: "South Africa", language: { da: "Engelsk", en: "English" }, code: "en-ZA" },{ country: "Zimbabwe", language: { da: "Engelsk", en: "English" }, code: "en-ZW " },{ country: "Spain", language: { da: "Spansk", en: "Spanish" }, code: "es", flag: "spain" },{ country: "Argentina", language: { da: "Spansk", en: "Spanish" }, code: "es-AR" },{ country: "Bolivia", language: { da: "Spansk", en: "Spanish" }, code: "es-BO" },{ country: "Chile", language: { da: "Spansk", en: "Spanish" }, code: "es-CL" },{ country: "Colombia", language: { da: "Spansk", en: "Spanish" }, code: "es-CO" },{ country: "Costa Rica", language: { da: "Spansk", en: "Spanish" }, code: "es-CR" },{ country: "Dominican Republic", language: { da: "Spansk", en: "Spanish" }, code: "es-DO" },{ country: "Ecuador", language: { da: "Spansk", en: "Spanish" }, code: "es-EC" },{ country: "Spain", language: { da: "Spansk", en: "Spanish" }, code: "es-ES" },{ country: "Guatemala", language: { da: "Spansk", en: "Spanish" }, code: "es-GT" },{ country: "Honduras", language: { da: "Spansk", en: "Spanish" }, code: "es-HN" },{ country: "Mexico", language: { da: "Spansk", en: "Spanish" }, code: "es-MX" },{ country: "Nicaragua", language: { da: "Spansk", en: "Spanish" }, code: "es-NI" },{ country: "Panama", language: { da: "Spansk", en: "Spanish" }, code: "es-PA" },{ country: "Peru", language: { da: "Spansk", en: "Spanish" }, code: "es-PE" },{ country: "Puerto Rico", language: { da: "Spansk", en: "Spanish" }, code: "es-PR" },{ country: "Paraguay", language: { da: "Spansk", en: "Spanish" }, code: "es-PY" },{ country: "El Salvador", language: { da: "Spansk", en: "Spanish" }, code: "es-SV" },{ country: "United States", language: { da: "Spansk", en: "Spanish" }, code: "es-US" },{ country: "Uruguay", language: { da: "Spansk", en: "Spanish" }, code: "es-UY" },{ country: "Bolivarian Republic of Venezuela", language: { da: "Spansk", en: "Spanish" }, code: "es-VE" },{ country: "Estonia", language: { da: "Estonian", en: "Estonian" }, code: "et" },{ country: "Spain", language: { da: "Basque", en: "Basque" }, code: "eu" },{ country: "Iran", language: { da: "Persian", en: "Persian" }, code: "fa" },{ country: "Finland", language: { da: "Finnish", en: "Finnish" }, code: "fi" },{ country: "Philippines", language: { da: "Filipino", en: "Filipino" }, code: "fil" },{ country: "Faroe Islands", language: { da: "Faroese", en: "Faroese" }, code: "fo" },{ country: "France", language: { da: "Fransk", en: "French" }, code: "fr", flag: "france" },{ country: "Belgium", language: { da: "Fransk", en: "French" }, code: "fr-BE" },{ country: "Canada", language: { da: "Fransk", en: "French" }, code: "fr-CA" },{ country: "Switzerland", language: { da: "Fransk", en: "French" }, code: "fr-CH" },{ country: "France", language: { da: "Fransk", en: "French" }, code: "fr-FR" },{ country: "Luxembourg", language: { da: "Fransk", en: "French" }, code: "fr-LU" },{ country: "Principality of Monaco", language: { da: "Fransk", en: "French" }, code: "fr-MC" },{ country: "Netherlands", language: { da: "Frisian", en: "Frisian" }, code: "fy" },{ country: "Ireland", language: { da: "Irish", en: "Irish" }, code: "ga" },{ country: "United Kingdom", language: { da: "Scottish Gaelic", en: "Scottish Gaelic" }, code: "gd", flag: "scotland" },{ country: "Spain", language: { da: "Galician", en: "Galician" }, code: "gl" },{ country: "France", language: { da: "Alsatian", en: "Alsatian" }, code: "gsw" },{ country: "India", language: { da: "Gujarati", en: "Gujarati" }, code: "gu" },{ country: "Nigeria", language: { da: "Hausa (Latin)", en: "Hausa (Latin)" }, code: "ha" },{ country: "Israel", language: { da: "Hebrew", en: "Hebrew" }, code: "he" },{ country: "India", language: { da: "Hindi", en: "Hindi" }, code: "hi" },{ country: "X", language: { da: "Croatian", en: "Croatian" }, code: "hr" },{ country: "Bosnia and Herzegovina", language: { da: "Croatian", en: "Croatian" }, code: "hr-BA" },{ country: "Croatia", language: { da: "Croatian", en: "Croatian" }, code: "hr-HR" },{ country: "Germany", language: { da: "Upper Sorbian", en: "Upper Sorbian" }, code: "hsb" },{ country: "Hungary", language: { da: "Hungarian", en: "Hungarian" }, code: "hu" },{ country: "Armenia", language: { da: "Armenian", en: "Armenian" }, code: "hy" },{ country: "Indonesia", language: { da: "Indonesian", en: "Indonesian" }, code: "id" },{ country: "Nigeria", language: { da: "Igbo", en: "Igbo" }, code: "ig" },{ country: "People's Republic of China", language: { da: "Yi", en: "Yi" }, code: "ii" },{ country: "Iceland", language: { da: "Icelandic", en: "Icelandic" }, code: "is" },{ country: "X", language: { da: "Italian", en: "Italian" }, code: "it" },{ country: "Switzerland", language: { da: "Italian", en: "Italian" }, code: "it-CH" },{ country: "Italy", language: { da: "Italian", en: "Italian" }, code: "it-IT" },{ country: "X", language: { da: "Inuktitut", en: "Inuktitut" }, code: "iu" },{ country: "Canada", language: { da: "Inuktitut (Latin)", en: "Inuktitut (Latin)" }, code: "iu-CA" },{ country: "Canada", language: { da: "Inuktitut (Syllabics)", en: "Inuktitut (Syllabics)" }, code: "iu-CA" },{ country: "Japan", language: { da: "Japanese", en: "Japanese" }, code: "ja" },{ country: "Georgia", language: { da: "Georgian", en: "Georgian" }, code: "ka" },{ country: "Kazakhstan", language: { da: "Kazakh", en: "Kazakh" }, code: "kk" },{ country: "Greenland", language: { da: "Greenlandic", en: "Greenlandic" }, code: "kl" },{ country: "Cambodia", language: { da: "Khmer", en: "Khmer" }, code: "km" },{ country: "India", language: { da: "Kannada", en: "Kannada" }, code: "kn" },{ country: "India", language: { da: "Konkani", en: "Konkani" }, code: "kok" },{ country: "Korea", language: { da: "Korean", en: "Korean" }, code: "ko" },{ country: "Kyrgyzstan", language: { da: "Kyrgyz", en: "Kyrgyz" }, code: "ky" },{ country: "Luxembourg", language: { da: "Luxembourgish", en: "Luxembourgish" }, code: "lb" },{ country: "Lao P.D.R.", language: { da: "Lao", en: "Lao" }, code: "lo" },{ country: "Lithuania", language: { da: "Lithuanian", en: "Lithuanian" }, code: "lt" },{ country: "Latvia", language: { da: "Latvian", en: "Latvian" }, code: "lv" },{ country: "New Zealand", language: { da: "Maori", en: "Maori" }, code: "mi" },{ country: "Macedonia (FYROM)", language: { da: "Macedonian (FYROM)", en: "Macedonian (FYROM)" }, code: "mk" },{ country: "India", language: { da: "Malayalam", en: "Malayalam" }, code: "ml" },{ country: "Mongolia ", language: { da: "Mongolian", en: "Mongolian" }, code: "mn" },{ country: "People's Republic of China", language: { da: "Mongolian (Traditional Mongolian)", en: "Mongolian (Traditional Mongolian)" }, code: "mn-CN" },{ country: "Mongolia", language: { da: "Mongolian (Cyrillic)", en: "Mongolian (Cyrillic)" }, code: "mn-MN" },{ country: "Canada", language: { da: "Mohawk", en: "Mohawk" }, code: "moh" },{ country: "India", language: { da: "Marathi", en: "Marathi" }, code: "mr" },{ country: "Malaysia", language: { da: "Malay", en: "Malay" }, code: "ms" },{ country: "Brunei Darussalam", language: { da: "Malay", en: "Malay" }, code: "ms-BN" },{ country: "Malaysia", language: { da: "Malay", en: "Malay" }, code: "ms-MY" },{ country: "Malta", language: { da: "Maltese", en: "Maltese" }, code: "mt" },{ country: "Norway", language: { da: "Norwegian (Bokmal)", en: "Norwegian (Bokmal)" }, code: "nb" },{ country: "Nepal", language: { da: "Nepali", en: "Nepali" }, code: "ne" },{ country: "Nederland", language: { da: "Hollandsk", en: "Dutch" }, code: "nl" },{ country: "Belgium", language: { da: "Hollandsk", en: "Dutch" }, code: "nl-BE" },{ country: "Netherlands", language: { da: "Hollandsk", en: "Dutch" }, code: "nl-NL" },{ country: "Norway", language: { da: "Nynorsk", en: "Norwegian (Nynorsk)" }, code: "nn" },{ country: "Norway", language: { da: "Norsk", en: "Norwegian" }, code: "no" },{ country: "South Africa", language: { da: "Sesotho sa Leboa", en: "Sesotho sa Leboa" }, code: "nso" },{ country: "France", language: { da: "Occitan", en: "Occitan" }, code: "oc" },{ country: "India", language: { da: "Oriya", en: "Oriya" }, code: "or" },{ country: "India", language: { da: "Punjabi", en: "Punjabi" }, code: "pa" },{ country: "Poland", language: { da: "Polsk", en: "Polish" }, code: "pl" },{ country: "Afghanistan", language: { da: "Dari", en: "Dari" }, code: "prs" },{ country: "Afghanistan", language: { da: "Pashto", en: "Pashto" }, code: "ps" },{ country: "Portugal", language: { da: "Portuguese", en: "Portuguese" }, code: "pt", flag: "portugal" },{ country: "Brazil", language: { da: "Portuguese", en: "Portuguese" }, code: "pt-BR" },{ country: "Portugal", language: { da: "Portuguese", en: "Portuguese" }, code: "pt-PT" },{ country: "Guatemala", language: { da: "K'iche", en: "K'iche" }, code: "qut" },{ country: "The central Andes of South America", language: { da: "Quechua", en: "Quechua" }, code: "quz" },{ country: "Bolivia", language: { da: "Quechua", en: "Quechua" }, code: "quz-BO" },{ country: "Ecuador", language: { da: "Quechua", en: "Quechua" }, code: "quz-EC" },{ country: "Peru", language: { da: "Quechua", en: "Quechua" }, code: "quz-PE" },{ country: "Switzerland", language: { da: "Romansh", en: "Romansh" }, code: "rm" },{ country: "Romania", language: { da: "Romanian", en: "Romanian" }, code: "ro" },{ country: "Russia", language: { da: "Russian", en: "Russian" }, code: "ru" },{ country: "Rwanda", language: { da: "Kinyarwanda", en: "Kinyarwanda" }, code: "rw" },{ country: "Russia", language: { da: "Yakut", en: "Yakut" }, code: "sah" },{ country: "India", language: { da: "Sanskrit", en: "Sanskrit" }, code: "sa" },{ country: "Sami", language: { da: "Sami (Northern)", en: "Sami (Northern)" }, code: "se" },{ country: "Finland", language: { da: "Sami (Northern)", en: "Sami (Northern)" }, code: "se-FI" },{ country: "Norway", language: { da: "Sami (Northern)", en: "Sami (Northern)" }, code: "se-NO" },{ country: "Sweden", language: { da: "Sami (Northern)", en: "Sami (Northern)" }, code: "se-SE" },{ country: "Sri Lanka", language: { da: "Sinhala", en: "Sinhala" }, code: "si" },{ country: "Slovakia", language: { da: "Slovak", en: "Slovak" }, code: "sk" },{ country: "Slovenia", language: { da: "Slovenian", en: "Slovenian" }, code: "sl" },{ country: "X", language: { da: "Sami (Southern)", en: "Sami (Southern)" }, code: "sma" },{ country: "Norway", language: { da: "Sami (Southern)", en: "Sami (Southern)" }, code: "sma-NO" },{ country: "Sweden", language: { da: "Sami (Southern)", en: "Sami (Southern)" }, code: "sma-SE" },{ country: "X", language: { da: "Sami (Lule)", en: "Sami (Lule)" }, code: "smj" },{ country: "Norway", language: { da: "Sami (Lule)", en: "Sami (Lule)" }, code: "smj-NO" },{ country: "Sweden", language: { da: "Sami (Lule)", en: "Sami (Lule)" }, code: "smj-SE" },{ country: "Finland", language: { da: "Sami (Inari)", en: "Sami (Inari)" }, code: "smn" },{ country: "Finland", language: { da: "Sami (Skolt)", en: "Sami (Skolt)" }, code: "sms" },{ country: "Albania", language: { da: "Albanian", en: "Albanian" }, code: "sq" },{ country: "X", language: { da: "Serbian", en: "Serbian" }, code: "sr" },{ country: "Bosnia and Herzegovina", language: { da: "Serbian (Cyrillic)", en: "Serbian (Cyrillic)" }, code: "sr-BA" },{ country: "Bosnia and Herzegovina", language: { da: "Serbian (Latin)", en: "Serbian (Latin)" }, code: "sr-BA" },{ country: "Serbia and Montenegro (Former)", language: { da: "Serbian (Cyrillic)", en: "Serbian (Cyrillic)" }, code: "sr-CS" },{ country: "Serbia and Montenegro (Former)", language: { da: "Serbian (Latin)", en: "Serbian (Latin)" }, code: "sr-CS" },{ country: "Montenegro", language: { da: "Serbian (Cyrillic)", en: "Serbian (Cyrillic)" }, code: "sr-ME" },{ country: "Montenegro", language: { da: "Serbian (Latin)", en: "Serbian (Latin)" }, code: "sr-ME" },{ country: "Serbia", language: { da: "Serbian (Cyrillic)", en: "Serbian (Cyrillic)" }, code: "sr-RS" },{ country: "Serbia", language: { da: "Serbian (Latin)", en: "Serbian (Latin)" }, code: "sr-RS" },{ country: "X", language: { da: "Svensk", en: "Swedish" }, code: "se", flag: "sweden" },{ country: "Finland", language: { da: "Svensk", en: "Swedish" }, code: "sv-FI" },{ country: "Sweden", language: { da: "Svensk", en: "Swedish" }, code: "sv-SE" },{ country: "Kenya", language: { da: "Kiswahili", en: "Kiswahili" }, code: "sw" },{ country: "Syria", language: { da: "Syriac", en: "Syriac" }, code: "syr" },{ country: "India", language: { da: "Tamil", en: "Tamil" }, code: "ta" },{ country: "India", language: { da: "Telugu", en: "Telugu" }, code: "te" },{ country: "Tajikistan", language: { da: "Tajik (Cyrillic)", en: "Tajik (Cyrillic)" }, code: "tg" },{ country: "Thailand", language: { da: "Thai", en: "Thai" }, code: "th" },{ country: "Turkmenistan", language: { da: "Turkmen", en: "Turkmen" }, code: "tk" },{ country: "South Africa", language: { da: "Setswana", en: "Setswana" }, code: "tn" },{ country: "Turkey", language: { da: "Turkish", en: "Turkish" }, code: "tr" },{ country: "Russia", language: { da: "Tatar", en: "Tatar" }, code: "tt" },{ country: "Algeria", language: { da: "Tamazight (Latin)", en: "Tamazight (Latin)" }, code: "tzm" },{ country: "People's Republic of China", language: { da: "Uyghur", en: "Uyghur" }, code: "ug" },{ country: "Ukraine", language: { da: "Ukrainian", en: "Ukrainian" }, code: "uk" },{ country: "Islamic Republic of Pakistan", language: { da: "Urdu", en: "Urdu" }, code: "ur" },{ country: "Uzbekistan", language: { da: "Uzbek", en: "Uzbek" }, code: "uz" },{ country: "Vietnam", language: { da: "Vietnamese", en: "Vietnamese" }, code: "vi" },{ country: "Senegal", language: { da: "Wolof", en: "Wolof" }, code: "wo" },{ country: "South Africa", language: { da: "isiXhosa", en: "isiXhosa" }, code: "xh" },{ country: "Nigeria", language: { da: "Yoruba", en: "Yoruba" }, code: "yo" },{ country: "X", language: { da: "Chinese", en: "Chinese" }, code: "zh" },{ country: "People's Republic of China", language: { da: "Chinese (Simplified) Legacy", en: "Chinese (Simplified) Legacy" }, code: "zh-CN" },{ country: "Hong Kong S.A.R.", language: { da: "Chinese (Traditional) Legacy", en: "Chinese (Traditional) Legacy" }, code: "zh-HK" },{ country: "Macao S.A.R.", language: { da: "Chinese (Traditional) Legacy", en: "Chinese (Traditional) Legacy" }, code: "zh-MO" },{ country: "Singapore", language: { da: "Chinese (Simplified) Legacy", en: "Chinese (Simplified) Legacy" }, code: "zh-SG" },{ country: "Taiwan", language: { da: "Chinese (Traditional) Legacy", en: "Chinese (Traditional) Legacy" }, code: "zh-TW" },{ country: "South Africa", language: { da: "isiZulu", en: "isiZulu" }, code: "zu" }
	]
});

// ------------------------------------------------------------------------------------------------------
// xtype: Combobox to select language
// ISJ - now just extends the Ext.ux.form.field.LocaleComboBox which uses Ext.ux.data.(model/store).Locale
// ------------------------------------------------------------------------------------------------------
Ext.define('ip2.locale.languageComboBox', {
	extend: 'Ext.ux.form.field.LocaleComboBox',
	alias: ['widget.ip2LocaleLanguageComboBox'],
	initComponent: function () {
		this.callParent(arguments);
		return this;
	}
});

/*
Ext.define('ip2.locale.languageComboBox', {
  extend: 'Ext.form.field.ComboBox'
  ,alias: ['widget.ip2LocaleLanguageComboBox']
  ,displayField:'language'
  ,valueField:'languageCode'
  ,matchFieldWidth:true
  ,queryMode:'local'
  ,typeAhead: true
  ,emptyText:ip2.i18n('selectLanguage')
  ,autoScroll:true
  ,initComponent: function() {
    var me = this;

    me.store = ip2.locale.languageCountryStore;
    me.store.sort([
      {
        property : 'language'
        ,direction: 'ASC'
      },
      {
        property : 'languageCode'
        ,direction: 'ASC'
      }
    ]);

    me.displayTpl = Ext.create('Ext.XTemplate', [
      '<tpl for=".">{languageCode}</tpl>'
    ]);

    me.tpl = Ext.create('Ext.XTemplate',
      '<ul><tpl for=".">',
        '<li role="option" class="x-boundlist-item">',
          '{language}',
          '<tpl if="this.isSubLanguage(languageCode)">',
            '/{country}',
          '</tpl>',
          ' [{languageCode}]',
        '</li>',
      '</tpl></ul>',
      {
        isSubLanguage:function(code) {
          return (code.indexOf('-') == -1) ? false: true;
        }
      }
    );

    me.callParent();
  }
});
*/

/*
// --------------------------------------------------------------------------------------------
// function: return country name by language code
// --------------------------------------------------------------------------------------------
ip2.locale.getLanguageByCode = function(languageCode) {
  ip2.locale.languageCountryStore.clearFilter(true);
  var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, true);
  if (!record) {
    var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, false);
  }
  if (record) {
    return record.data.language;
  } else {
    return languageCode;
  }
}

// --------------------------------------------------------------------------------------------
// function: return language description by language code
// --------------------------------------------------------------------------------------------
ip2.locale.getLanguageTextByLanguageCode = function(languageCode) {
  ip2.locale.languageCountryStore.clearFilter(true);
  var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, true);
  if (!record) {
    var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, false);
  }
  if (record) {
    return (record.data.languageCode.indexOf('-') == -1) ? record.data.language : record.data.language + '/' + record.data.country;
  } else {
    return languageCode;
  }
}

// --------------------------------------------------------------------------------------------
// function: return country name by language code
// --------------------------------------------------------------------------------------------
ip2.locale.getCountryByLanguageCode = function(languageCode) {
  ip2.locale.languageCountryStore.clearFilter(true);
  var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, true);
  if (!record) {
    var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, false);
  }
  if (record) {
    return record.data.country;
  } else {
    return languageCode;
  }
}

// --------------------------------------------------------------------------------------------
// function: return country flag by language code
// --------------------------------------------------------------------------------------------
ip2.locale.getCountryFlagByLanguageCode = function(languageCode) {
  ip2.locale.languageCountryStore.clearFilter(true);
  var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, true);
  if (!record) {
    var record = ip2.locale.languageCountryStore.findRecord('languageCode', languageCode, 0, false, true, false);
  }
  if (record) {
    if (record.data.flag) {
      return '/system/images/flags/16x16/flag_' + record.data.flag.toLowerCase() + '.png';
    } else {
      return '/system/images/flags/16x16/flag_' + record.data.country.toLowerCase().replace(/ /g,"_") + '.png';
    }
  } else {
    return languageCode;
  }
}
*/
