Reckless9200 / html5security

Automatically exported from code.google.com/p/html5security
0 stars 0 forks source link

Translations #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 :)

Original issue reported on code.google.com by Mario.He...@googlemail.com on 27 Apr 2010 at 12:33

GoogleCodeExporter commented 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

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
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