Pinout.xyz icon indicating copy to clipboard operation
Pinout.xyz copied to clipboard

Type allow-list breaks translations

Open Gadgetoid opened this issue 7 years ago • 1 comments

Overlays with translated types currently break, since they're not in the built-in allowed list of the sanitize_types function. EG:

Tutti
autre
moteur
com.
a/n
htr
lcd
cap.
e/s
hepsi

Should probably change the list of allowed types depending upon language, or include translated types in the master list.

https://github.com/Gadgetoid/Pinout.xyz/blob/14aa324b39986511f665e84c2e870d3a597b72f2/generate-html.py#L610-L625

Gadgetoid avatar May 23 '18 16:05 Gadgetoid

Looking at the code-snippet above, doesn't having 'iot': 'IOT' in allowed_types mean that the 'iot': 'radio' in remapped_types will never get used?

Also, you could combine two of the above lines to just t_handle = t.strip().lower() :slightly_smiling_face:

And I think the for-loop could be simplified to just:

if t_handle in remapped_types:
    return allowed_types[remapped_types[t_handle]]

Should probably change the list of allowed types depending upon language, or include translated types in the master list.

Personally, I'd always have the 'type' in English in the translated source-files, and then just translate it to the local language when outputting the HTML files.

lurch avatar May 24 '18 10:05 lurch