I noticed that typing of common properties in GVL and translations differ.
Here's an example:
GVL url: https://vendorlist.consensu.org/v2/vendor-list.json
Translations url: https://vendorlist.consensu.org/v2/purposes-fr.json
If you compare types of objects in purposes
, specialPurposes
, features
, specialFeatures
and stacks
you can see that in GVL those properties are maps while in translation files they are provided as arrays.
GVL purposes:
"purposes": {
"1": {
"id": 1,
"name": "Store and/or access information on a device",
"description": "Cookies, device identifiers, or other information can be stored or accessed on your device for the purposes presented to you.",
"descriptionLegal": "Vendors can:\n* Store and access information on the device such as cookies and device identifiers presented to a user."
},
...
}
Translated purposes:
"purposes": [
{
"1": {
"id": 1,
"name": "Stocker et/ou accéder à des informations stockées sur un terminal",
"description": "Les cookies, identifiants de votre terminal ou autres informations peuvent être stockés ou consultés sur votre terminal pour les finalités qui vous sont présentées.",
"descriptionLegal": "Les partenaires peuvent :\n* Stocker des informations et accéder à des informations stockées sur le terminal, comme les cookies et les identifiants du terminal présentés à un utilisateur.\n"
}
},
...
]
I'm writing this because API becomes inconsistent if you're changing the language.
So if you're using default language GVL, you have purposes as maps while if you change lanugage with changeLanguage
, purposes become arrays.
I would recommend to unify this format (and always use IntMap), otherwise it's inconsistent and can provide you with wrong information (e.g.: fetching with [id] returns the results both for maps and array but the result differs).
Here's a sample of runnable code exposing this issue:
import { GVL } from '@iabtcf/core';
GVL.baseUrl = "http://cmp.mysupercoolcmp.com/";
let gvl = new GVL();
gvl.readyPromise.then(() =>{
console.log("Purpose one from default GVL: ", gvl.purposes[1]);
gvl.changeLanguage("fr").then(() => {
console.log("Purpose one from translations: ", gvl.purposes[1]) ;
});
});
P.S.: I would also mention that provided link in documentation is pointing to translations of TCF v1.1 framework and not to translations for v2.0 (For the full list of iab provided language translations click here.
section of documentation).