Opened 10 years ago

Closed 9 years ago

#9213 closed enhancement (worksforme)

i18n for ColorPicker

Reported by: KuRoz Owned by: Adam Peller
Priority: high Milestone: 1.5
Component: DojoX Widgets Version: 1.3.0
Keywords: thai display ColorPicker Cc: natta@…, dante, Jared Jurkiewicz
Blocked By: Blocking:

Description (last modified by bill)

I've modified part of ColorPicker?.js to make it capable of Thai display. (You have to add dojo.require("dojo.cldr.supplemental"); to all of modified class)

var _2=function(_3){
return _3;
};
var rWord="r";
var gWord="g";
var bWord="b";
var hWord="h";
var sWord="s";
var vWord="v";
var hexWord="hex";
if(dojo.cldr.supplemental._region(this.lang)=="th"){
rWord="อาร์";
gWord="จี";
bWord="บี";
hWord="เอช";
sWord="เอส";
vWord="วี";
hexWord="เลขฐานสิบหก";}
dojo.declare("dojox.widget.ColorPicker",dijit.form._FormWidget,{showRgb:true,showHsv:true,showHex:true,webSafe:true,animatePoint:true,slideDuration:250,liveUpdate:false,PICKER_HUE_H:150,PICKER_SAT_VAL_H:150,PICKER_SAT_VAL_W:150,value:"#ffffff",_underlay:d.moduleUrl("dojox.widget","ColorPicker/images/underlay.png"),templateString:"
\n\t
\n\t\t

\n\t\t\n\t

\n\t
\n\t\t

\n\t\t

\n\t

\n\t

\n\t

\n\t
\n\t\t
\n\t\t\t\n\t\t\t"+rWord+"\n\t\t\t"+gWord+"\n\t\t\t"+bWord+"\n\t\t\t\n\t\t

\n\t\t
\n\t\t\t\n\t\t\t
    "+hWord+" °\n\t\t\t
    "+sWord+" %\n\t\t\t
    "+vWord+" %\n\t\t\t\n\t\t

\n\t\t
\t\n\t\t\t
"+hexWord+": \n\t\t

\n\t

\n

\n",postCreate:function(){
this.inherited(arguments);

And modified part of ColorPicker?.css to make it size suitable for Thai display.

.dojoxColorPicker {
padding:8px;
border:1px solid #a0a0a0;
background:#ededed;
width:400px;
height:150px;
-moz-border-radius:4pt;
-webkit-border-radius:5pt;
}

Change History (11)

comment:1 Changed 10 years ago by bill

Description: modified (diff)

Hi, thanks for the patch but a few things:

1) we can't look at the patch unless you've filed a CLA; I guess you are from IBM? They have a CLA already.

2) you should attach patches as .diff/.patch files showing the changes that you made to the file

3) You've modified the build version not the source version, hence it has weird stuff like _2 and _3 that won't let us merge; need to build a patch against the source version.

4) We have an NLS infrastructure in dojo to load language strings from NLS files, rather than hardcoding them in the JS

comment:2 Changed 10 years ago by Adam Peller

Without posting any source code, can you describe the problem? What's wrong with the ColorPicker? running in Thai as the code stands? (graphic attachments are ok) There are translations for each color in the palette at dojo/nls/th/colors.js, though for some reason they're only partially translated.

comment:3 Changed 10 years ago by Adam Peller

Oh, sorry, I didn't realize this was dojox.widget.ColorPicker? (was thinking of dijit.ColorPicker?, which should work ok in Thai) Yes, this widget, like most widgets in dojox.widget, need to be "globalized" using dojo.i18n and resource bundles. Is there any logic that is specific to Thai which must be considered?

comment:4 Changed 10 years ago by Adam Peller

(In [20002]) i18n for ColorPicker? Refs #9213 !strict

comment:5 Changed 10 years ago by Adam Peller

@dante, I moved the resources to strings. Can we change the layout to use relative positioning instead of absolute, or perhaps just a bigger table, to accommodate the different sized strings?

comment:6 Changed 10 years ago by Adam Peller

Summary: thai display ColorPickeri18n for ColorPicker

comment:7 Changed 10 years ago by dante

Cc: dante added
Milestone: tbdfuture
Owner: changed from dante to Adam Peller

@peller - we can. I recall it taking a bunch of effort to get everything "lined up" and the CSS is a bit messy, so If you have an alternate idea, I'd happily entertain it.

comment:8 Changed 10 years ago by Adam Peller

The alternative, without really knowing this code, is to use TABLES instead of CSS for layout. Could be a win, with or without i18n.

comment:9 Changed 9 years ago by Adam Peller

Cc: Jared Jurkiewicz added

I think Jared fixed this

comment:10 Changed 9 years ago by Adam Peller

Milestone: future1.5

comment:11 Changed 9 years ago by Adam Peller

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.