orestbida / cookieconsent

:cookie: Simple cross-browser cookie-consent plugin written in vanilla js
https://playground.cookieconsent.orestbida.com/
MIT License
3.68k stars 387 forks source link

[Feat]: allow dynamic translation files fetch #638

Closed orestbida closed 4 months ago

orestbida commented 4 months ago

Description

As discussed in #637, it would be nice to have the option to use async callback functions to fetch a translation:

{
    translations: {
        en: async () => {
            const resp = await fetch('path-to-api-or-json-file');
            return await resp.json();
        }
    }
}

Proposed solution

No response

Additional details

No response