empreinte-digitale/orejime

Text replacements not made

JuZED opened this issue · 4 comments

JuZED commented

Hi,

In pages of my websites containing Gravity Forms (WP plugin), text replacements are not made.
Where {purposes} should be replaced by Essential, Functional, I can still see {purposes} after loading.
Same thing for {privacyPolicy}.

I use webpack and the main script is the same on each pages of the website.
Gravity Forms add a script after the main one, when the page contains a form.

Do you have any idea of how I could fix this issue?

Regards,

Julien

Hi,

This is quite strange, I don't see how Gravity form's script could end up messing with orejime :o
Is there any orejime-related js in the DOM? (Not inside a .js file but in a <script /> tag, like configuration or something else?)

JuZED commented

Hi !
Thanks for your answer !

If you mean how I call orejime, here is what I have :

import Orejime from 'orejime/dist/orejime';

( ( $ ) => {

    $( () => {

        const orejimeConfig = {
            // Optional. You can customize the ID of the <div> that Orejime will create when starting up.
            // The generated <div> will be inserted at the beginning of the <body>.
            // If there is already a DOM element with this id, Orejime will use it instead of creating a new element.
            // defaults to "orejime".
            elementID: "orejime",
        
            // Optional. For accessibility's sake, the Orejime modal must know what is the element
            // containing your app or website. Orejime should *not* be in this element.
            // The idea is your DOM could look like this after Orejime is initialized:
            // <body>
            //      <div id="orejime">...</div>
            //      <div id="app">your actual website</div>
            // </body>
            //
            // It is highly recommended to set this option, even though it's not required.
            // defaults to undefined.
            appElement: "#site-content",
        
            // Optional. You can customize the name of the cookie that Orejime uses for storing
            // user consent decisions.
            // defaults to "orejime".
            cookieName: "orejime",
        
            // Optional. You can set a custom expiration time for the Orejime cookie, in days.
            // defaults to 365.
            cookieExpiresAfterDays: 365,
        
            // Optional. You can provide a custom function to serialize the cookie contents.
            stringifyCookie: (contents) => JSON.stringify(contents),
        
            // Optional. You can provide a custom function to unserialize the cookie contents.
            parseCookie: (cookie) => JSON.parse(cookie),
        
            // You must provide a link to your privacy policy page
            privacyPolicy: mdsSettings.orejime.privacyPolicyURL,
        
            // Optional. Applications configured below will be ON by default if default=true.
            // defaults to true
            default: mdsSettings.orejime.default,
        
            // Optional. If "mustConsent" is set to true, Orejime will directly display the consent
            // manager modal and not allow the user to close it before having actively
            // consented or declined the use of third-party apps.
            // defaults to false
            mustConsent: mdsSettings.orejime.mustConsent,
        
            // Optional. If "mustNotice" is set to true, Orejime will display the consent
            // notice and not allow the user to close it before having actively
            // consented or declined the use of third-party apps.
            // Has no effect if mustConsent is set to true.
            // defaults to false
            mustNotice: mdsSettings.orejime.mustNotice,
        
            // Optional. If "implicitConsent" is set to true, Orejime will automatically accept
            // cookies if the user continues his navigation on the website after the
            // first page. If you enable this, you must warn the user
            // of this behavior in the notice window. You can do that easily by overriding
            // translation strings (see below).
            // defaults to false
            implicitConsent: mdsSettings.orejime.implicitConsent,
        
            // Optional. You can define the UI language directly here. If undefined, Orejime will
            // use the value given in the global "lang" variable, or fallback to the value
            // in the <html> lang attribute, or fallback to "en".
            lang: mdsSettings.orejime.lang,
        
            // Optional. You can pass an image url to show in the notice.
            // If the image is not exclusively decorative, you can pass an object
            // with the image src and alt attributes: `logo: {src: '...', alt: '...'}`
            // defaults to false
            logo: false,
        
            // Optional. Set Orejime in debug mode to have a few stuff
            // logged in the console, like warning about missing translations.
            // defaults to false
            debug: false,
        
            // You can overwrite existing translations and add translations for your
            // app descriptions and purposes. See `src/translations.yml` for a full
            // list of translations that can be overwritten
            translations: mdsSettings.orejime.i18n,
        
            // The list of third-party apps that Orejime will manage for you.
            // The apps will appear in the modal in the same order as defined here.
            apps: mdsSettings.orejime.apps,
            // apps: [
            //     {
            //         // The name of the app, used internally by Orejime.
            //         // Each name should match a name of a <script> tag defined in the
            //         // "Changing your existing third-party scripts" documentation step.
            //         name: "wordpress",
        
            //         // The title of you app as listed in the consent modal.
            //         title: "Wordpress",
        
            //         // A list of regex expressions, strings, or arrays, giving the names of
            //         // cookies set by this app. If the user withdraws consent for a
            //         // given app, Orejime will then automatically delete all matching
            //         // cookies.
            //         //
            //         // See a different example below with the inline-tracker app
            //         // to see how to define cookies set on different path or domains.
            //         cookies: [
            //             "wordpress_test_cookie"
            //         ],
        
            //         // Optional. The purpose(s) of this app. Will be listed on the consent notice.
            //         // Do not forget to add translations for all purposes you list here.
            //         purposes: ["security"],
        
            //         // Optional. A callback function that will be called each time
            //         // the consent state for the app changes. Passes
            //         // the `app` config as the second parameter as well.
            //         callback: function(consent, app){
            //             // This is an example callback function.
            //             console.log("User consent for app " + app.name + ": consent=" + consent)
            //         },
        
            //         // Optional. If "required" is set to true, Orejime will not allow this app to
            //         // be disabled by the user.
            //         // default to false
            //         required: false,
        
            //         // Optional. If "optOut" is set to true, Orejime will load this app even before
            //         // the user gave explicit consent.We recommend always leaving this "false".
            //         // defaults to false
            //         optOut: false,
        
            //         // Optional. If "default" is set to true, the app will be enabled by default
            //         // Overwrites the global "default" setting.
            //         // defaults to the value of the gobal "default" setting
            //         default: true,
        
            //         // Optional. If "onlyOnce" is set to true, the app will only be executed
            //         // once regardless how often the user toggles it on and off.
            //         // defaults to false
            //         onlyOnce: true,
            //     },
            //     {
            //         // The name of the app, used internally by Orejime.
            //         // Each name should match a name of a <script> tag defined in the
            //         // "Changing your existing third-party scripts" documentation step.
            //         name: "google-tag-manager",
        
            //         // The title of you app as listed in the consent modal.
            //         title: "Google Tag Manager",
        
            //         // A list of regex expressions, strings, or arrays, giving the names of
            //         // cookies set by this app. If the user withdraws consent for a
            //         // given app, Orejime will then automatically delete all matching
            //         // cookies.
            //         //
            //         // See a different example below with the inline-tracker app
            //         // to see how to define cookies set on different path or domains.
            //         cookies: [
            //             "_ga",
            //             "_gat",
            //             "_gid",
            //             "__utma",
            //             "__utmb",
            //             "__utmc",
            //             "__utmt",
            //             "__utmz",
            //             "_gat_gtag_" + GTM_UA,
            //             "_gat_" + GTM_UA
            //         ],
        
            //         // Optional. The purpose(s) of this app. Will be listed on the consent notice.
            //         // Do not forget to add translations for all purposes you list here.
            //         purposes: ["analytics"],
        
            //         // Optional. A callback function that will be called each time
            //         // the consent state for the app changes. Passes
            //         // the `app` config as the second parameter as well.
            //         callback: function(consent, app){
            //             // This is an example callback function.
            //             console.log("User consent for app " + app.name + ": consent=" + consent)
            //         },
        
            //         // Optional. If "required" is set to true, Orejime will not allow this app to
            //         // be disabled by the user.
            //         // default to false
            //         required: false,
        
            //         // Optional. If "optOut" is set to true, Orejime will load this app even before
            //         // the user gave explicit consent.We recommend always leaving this "false".
            //         // defaults to false
            //         optOut: false,
        
            //         // Optional. If "default" is set to true, the app will be enabled by default
            //         // Overwrites the global "default" setting.
            //         // defaults to the value of the gobal "default" setting
            //         default: true,
        
            //         // Optional. If "onlyOnce" is set to true, the app will only be executed
            //         // once regardless how often the user toggles it on and off.
            //         // defaults to false
            //         onlyOnce: true,
            //     },
            //     {
            //         name: "inline-tracker",
            //         title: "Inline Tracker",
            //         purposes: ["analytics"],
            //         cookies: [
            //             "inline-tracker"
            //             // When deleting a cookie, Orejime will try to delete a cookie with the given name,
            //             // the "/" path, and multiple domains (the current domain and `"." + current domain`).
            //             // If an app sets a cookie on a different path or domain than that, Orejime won't be
            //             // able to delete it by itself without more info.
            //             // In this case, you can explicitely define a cookie, a path and domain:
            //             ["cookieName", "/blog", "." + location.hostname],
            //             ["cookieName", "/", "test.mydomain.com"],
            //         ]
            //     },
            //     {
            //         name: "external-tracker",
            //         title: "External Tracker",
            //         purposes: ["analytics", "security"],
            //         cookies: ["external-tracker"],
            //         required: true
            //     }
            // ],
        }
        
        Orejime.init(orejimeConfig);
    
    } );

} )( jQuery );

Where mdsSettings.orejime is an object injected before.

JuZED commented

By the way...

This is the script inserted before :

<script id="mds-js-extra">
var mdsSettings = {"fancybox":{"lang":"fr","i18n":{"fr":{"CLOSE":"Fermer","NEXT":"Slide suivante","PREV":"Slide pr\u00e9c\u00e9dente","ERROR":"La requ\u00eate ne peut \u00eatre charg\u00e9e. <br \/>Merci d'essayer plus tard. ","PLAY_START":"D\u00e9marrer le carrousel ","PLAY_STOP":"Mettre en pause le carrousel","FULL_SCREEN":"Plein \u00e9cran","THUMBS":"Miniatures","DOWNLOAD":"T\u00e9l\u00e9charger","SHARE":"Partager","ZOOM":"Agrandir"}}},"orejime":{"lang":"fr","privacyPolicyURL":"http:\/\/www.mds.loc\/politique-de-confidentialite\/","default":true,"mustConsent":false,"mustNotice":false,"implicitConsent":false,"apps":[{"name":"wordpress","title":"Wordpress","purposes":["essential"],"required":false,"optOut":false,"default":true,"onlyOnce":true,"cookies":["wordpress_test_cookie"]},{"name":"polylang","title":"Polylang","purposes":["essential","functional"],"required":true,"optOut":false,"default":true,"onlyOnce":false,"cookies":["pll_language"]}],"i18n":{"fr":{"consentModal":{"title":"Information that we collect","description":"Here you can see and customize the information that we collect about you.","privacyPolicy":{"name":"privacy policy","text":"To learn more, please read our {privacyPolicy}."}},"consentNotice":{"changeDescription":"There were changes since your last visit, please update your consent.","description":"We collect and process your personal information for the following purposes: {purposes}.","learnMore":"Learn more"},"accept":"Accept","acceptTitle":"Accept cookies","acceptAll":"Accept all apps","save":"Save","saveData":"Save my configuration on collected information","decline":"Decline","declineAll":"Decline all apps","close":"Close","enabled":"Enabled","disabled":"Disabled","app":{"optOut":{"title":"(opt-out)","description":"This app is loaded by default (but you can opt out)"},"required":{"title":"(always required)","description":"This application is always required"},"purposes":"Purposes","purpose":"Purpose"},"poweredBy":"Powered by Orejime","newWindow":"new window","purposes":{"essential":"Essential","functional":"Functional","marketing":"Marketing","statistic":"Statistic","security":"Security"}}}}};
</script>

I'm closing the issue for now as it is probably unrelated to Orejime.