Open GoogleCodeExporter opened 8 years ago
My proposal is like as following.
var items =
[
{ /* ID 1 - XSS via formaction - requiring user interaction */
'id' : 1,
'category' : 'html5',
'name' : {
'en' : 'XSS via formaction - requiring user interaction',
'ja' : 'formaction \u3092\u901A\u3058\u305F XSS -
\u30E6\u30FC\u30B6...'},
'description': 'A vector displaying the HTML5 form ...',
...
In this example, 'name' property has English and Japanese content, and
'description'
property has only English content. No language name means English by default,
So all first commiter have to do is writing English text.
Language tags like as 'en' or 'ja' come from navigator.language property.
The code picking up to display is like as this:
---
if( typeof( items[ i ].name ) == 'string' ){
msg = items[ i ].name;
}else if( typeof( items[ i ].name ) == 'object'
&& items[ i ].name[ navigator.language ] !== undefined )
{
// get suitable text for user's environment
msg = items[ i ].name[ navigator.language ];
}
---
How do you think?
Original comment by yosuke.h...@gmail.com
on 28 Apr 2010 at 12:21
Hm - this is nice - actually better than my first approach with separate
language
files. I will implement it soon. Thanks!
Original comment by Mario.He...@googlemail.com
on 1 May 2010 at 1:29
Okay - I checked in a very first version - works fine for me locally and remote
on
the test instance. Very nice idea with navigator.language :D
Original comment by Mario.He...@googlemail.com
on 1 May 2010 at 2:07
Same for categories - please have a look if it works your you. Thanks!
Original comment by Mario.He...@googlemail.com
on 1 May 2010 at 2:19
Original issue reported on code.google.com by
Mario.He...@googlemail.com
on 27 Apr 2010 at 12:33