diff --git a/javascripts/discourse/initializers/discourse-custom-header-links.js b/javascripts/discourse/initializers/discourse-custom-header-links.js index f87889f..73e556a 100644 --- a/javascripts/discourse/initializers/discourse-custom-header-links.js +++ b/javascripts/discourse/initializers/discourse-custom-header-links.js @@ -24,7 +24,7 @@ export default { .split("|") .filter(Boolean) .map((customHeaderLinksArray) => { - const [linkText, linkTitle, linkHref, device, target, keepOnScroll] = + const [linkText, linkTitle, linkHref, device, target, keepOnScroll, locale] = customHeaderLinksArray .split(",") .filter(Boolean) @@ -37,6 +37,8 @@ export default { .toLowerCase() .replace(/\s/gi, "-")}-custom-header-links`; + const localeClass = locale == "" ? "" : `.${locale}`; + const anchorAttributes = { title: linkTitle, href: linkHref, @@ -47,7 +49,7 @@ export default { headerLinks.push( h( - `li.headerLink${deviceClass}${keepOnScrollClass}${linkClass}`, + `li.headerLink${deviceClass}${keepOnScrollClass}${localeClass}${linkClass}`, h("a", anchorAttributes, linkText) ) ); diff --git a/settings.yml b/settings.yml index 184f147..12b1b5b 100644 --- a/settings.yml +++ b/settings.yml @@ -1,9 +1,9 @@ Custom_header_links: type: list list_type: simple - default: "External link, this link will open in a new tab, https://meta.discourse.org, vdo, blank, remove|Most Liked, Posts with the most amount of likes, /latest/?order=op_likes, vdo, self, keep|Privacy, Our Privacy Policy, /privacy, vdm, self, keep" + default: "External link, this link will open in a new tab, https://meta.discourse.org, vdo, blank, remove, en|Most Liked, Posts with the most amount of likes, /latest/?order=op_likes, vdo, self, keep, en|Privacy, Our Privacy Policy, /privacy, vdm, self, keep, en" description: - en: "Comma delimited in this order: link text, link title, URL, view, target, hide on scroll
Link text: The text for the link
Link title: the text that shows when the link is hovered
URL: The path for the link (can be relative)
View: vdm = desktop and mobile, vdo = desktop only, vmo = mobile only
Target: blank = opens in a new tab, self = opens in the same tab
Hide on scroll: remove = hides the link when the title is expanded on topic pages keep = keeps the link visible even when the title is visible on topic pages" + en: "Comma delimited in this order: link text, link title, URL, view, target, hide on scroll
Link text: The text for the link
Link title: the text that shows when the link is hovered
URL: The path for the link (can be relative)
View: vdm = desktop and mobile, vdo = desktop only, vmo = mobile only
Target: blank = opens in a new tab, self = opens in the same tab
Hide on scroll: remove = hides the link when the title is expanded on topic pages keep = keeps the link visible even when the title is visible on topic pages
Language: blank = no locale assoaciated to the link, else insert a locale code (en, fr, de, ...)" links_position: default: right