How to translate google advertisement label?

Hello

I added google add on a french website.

Where to modify label, to translate it in french ?
Nothing in params…

Many thanks

Not sure where that comes from, @neil?

There are quite some pull requests pending for that plugin, this is one of them:

https://github.com/discourse/discourse-adplugin/pull/51/files

4 Likes

It’s hard coded in.
https://github.com/discourse/discourse-adplugin/blob/master/assets/javascripts/discourse/templates/components/google-adsense.hbs

I guess it would be easy enough to have that be translatable. However, AFAIK, the terms are fairly explicit about what can be used as label text when a label is used.

https://support.google.com/adsense/answer/4533986?hl=en

Publishers have two options for how to label AdSense ad units: You can either label the units with “Advertisements” or “Sponsored Links”. No other variations are allowed at this time.

3 Likes

CSS temporary hack:

.discourse-adplugin .google-adsense-label>h2 {
    font-size: 0;
}
.discourse-adplugin .google-adsense-label>h2:after {
    content: "Foo bar"; // <--- change to whatever word you want to use instead of ADVERTISEMENT
    font-size: 12px;
}

Before:

After:

Might not cover everything.

2 Likes

Great !
Easy with css.
Many thanks !

1 Like

It’s a bug that the string was hard-coded. I made a fix so it’s a translated string and will show in the site’s language (once translators have translated it). Also, you’ll be able to customize it in Admin like any string on the site.

6 Likes