Language of ColorPicker

Hi,

I am using DHTMLX ColorPicker 3.6 and want to change the language of its buttons.
To achieve this, I am doing as follows:

Javascript code snippet:

	/* Form */
	form_clients = layout_clients.cells("b").attachForm();
	form_clients.loadStruct("./lib/xml/dhxFormMasterdataClients.xml?etc=" + new Date().getTime(), function() {
		window.dhtmlxColorPickerLangModules["de-de"] = {
			langname: "de-de", // name of the language
			labelHue : "Hue",  // label name of the hue input
			labelSat : "Sat",  // label name of the saturation input
			labelLum : "Lum",  // label name of the lightness input
			labelRed : "Rot",  // label name of the Red input
			labelGreen : "Grün", // label name of the Green input
			labelBlue : "Blau",   // label name of the Blue input
			btnAddColor : "Hinzu", // button "add a color to custom colors"
			btnSelect : "Auswahl", // button "select"
			btnCancel : "Abbruch"  // button "cancel"
		};
		var cp = dhtmlXColorPicker(["color"]);
		cp.loadUserLanguage("de-de");
	});

XML snippet, where the form comes from:

<item type="colorpicker" 
	name="color" 
	label="Farbe" 
	labelTop="310" 
	labelLeft="10" 
	inputTop="310" 
	inputLeft="145" 
	inputHeight="18" 
	inputWidth="150" 
	labelHeight="18" 
	labelWidth="150" 
	imagePath="../lib/dhtmlx/dhtmlxColorPicker/codebase/imgs/" />

Depending on the browser, I get a message similar to

undefined is not a function 

What is wrong with that code.

Thank you in advance.

Cheers,

Andreas

Hi

window.dhtmlxColorPickerLangModules created inside colorpicker first init, so you need to add extra check:

if (window.dhtmlxColorPickerLangModules == null) { window.dhtmlxColorPickerLangModules = {}; } window.dhtmlxColorPickerLangModules["de-de"] = { langname: "de-de", // name of the language labelHue : "Hue", // label name of the hue input labelSat : "Sat", // label name of the saturation input labelLum : "Lum", // label name of the lightness input labelRed : "Rot", // label name of the Red input labelGreen : "Gr&#252;n", // label name of the Green input labelBlue : "Blau", // label name of the Blue input btnAddColor : "Hinzu", // button "add a color to custom colors" btnSelect : "Auswahl", // button "select" btnCancel : "Abbruch" // button "cancel" }};

then apply language:

form_clients.loadStruct("./lib/xml/dhxFormMasterdataClients.xml?etc=" + new Date().getTime(), function() { var cp = form_clients.getColorPicker("color"); cp.loadUserLanguage("de-de"); });