mozilla/zamboni — pull request #2290 by ngokevin (2014-07-08 04:12:55+00:00)
Title: refactor iarc code

Here's how it is done now:

- We map the IARC strings to keys (e.g., 'conteudo sexual' -> 'sex_content').
- We modify those keys to look up a content descriptor object ('sex_content' -> 'CLASSIND_SEX_CONTENT').
- We also use the key to set appropriate flags on the database ('CLASSIND_SEX_CONTENT' -> 'has_classind_sex_content').
- We slugify the names of those flags in our API response ('has_classind_sex_content' -> 'sex-content').
- Then we map back to the original string on the frontend ('sex-content' -> 'Conteudo Sexual')

Here's how this patch changes it:

- We map IARC strings to keys to flag on the database (conteudo sexual -> has_classind_sex_content)
- Then we map back to original string using the same mapping (has_classind_sex_content -> conteudo sexual), send it down the wire without any l10n and display directly on the frontend

- Centralize and simplify IARC->Zamboni mappings related to content ratings
- Remove content descriptor + interactive element object constants since we don't need to l10n on the API side
- Serve content descriptor + interactive element flags directly to API rather than slugify