Export to GitHub

html5security - issue #2

Translations


Posted on Apr 27, 2010 by Massive Lion

Regarding translations for the items/categories - do you have special suggestions or the file format? I would suggest to use a folder called lang/languages and add JSON files called japanese.json, german.json, russian.json etc etc.

The HTML version as well as other versions can then load those JSON files and match the translations to the given item descriptions, names etc via id.

A proposal for the JSON structure would be:

{ translations: { items: [{id:1, description: '...', ...}, {id:2, ...}, ...]} { categories: [{utf7: '...', xss: '...', ...}]} }

Please tell me what you think! Thanks :)

Comment #1

Posted on Apr 28, 2010 by Quick Ox

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?

Comment #2

Posted on May 1, 2010 by Massive Lion

Hm - this is nice - actually better than my first approach with separate language files. I will implement it soon. Thanks!

Comment #3

Posted on May 1, 2010 by Massive Lion

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

Comment #4

Posted on May 1, 2010 by Massive Lion

Same for categories - please have a look if it works your you. Thanks!

Status: Accepted

Labels:
Type-Defect Priority-Medium