<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to create a custom language switcher in HubL? in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/199453#M7214</link>
    <description>&lt;IFRAME src="https://fast.wistia.net/embed/iframe/gl3ulv88m4" title="Wistia video player" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen="" mozallowfullscreen="" webkitallowfullscreen="" oallowfullscreen="" msallowfullscreen="" width="600" height="338"&gt;&lt;/IFRAME&gt;</description>
    <pubDate>Fri, 27 Jul 2018 00:06:27 GMT</pubDate>
    <dc:creator>cstone</dc:creator>
    <dc:date>2018-07-27T00:06:27Z</dc:date>
    <item>
      <title>How to create a custom language switcher in HubL?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/199452#M7213</link>
      <description>&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;HubSpot hosted our first ever CMS Developer AMA on July 25th 2018. This question was submitted and the first reply is what the panelist and audience chat responded with. (&lt;A href="https://hubspot-52.wistia.com/medias/cfi8qie9yr" target="_self" rel="nofollow noopener noreferrer"&gt;view the full AMA here&lt;/A&gt;)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;--------------------------------------------&lt;/P&gt;
&lt;P&gt;How to create a custom language switcher in HubL?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 00:06:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/199452#M7213</guid>
      <dc:creator>cstone</dc:creator>
      <dc:date>2018-07-27T00:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a custom language switcher in HubL?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/199453#M7214</link>
      <description>&lt;IFRAME src="https://fast.wistia.net/embed/iframe/gl3ulv88m4" title="Wistia video player" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen="" mozallowfullscreen="" webkitallowfullscreen="" oallowfullscreen="" msallowfullscreen="" width="600" height="338"&gt;&lt;/IFRAME&gt;</description>
      <pubDate>Fri, 27 Jul 2018 00:06:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/199453#M7214</guid>
      <dc:creator>cstone</dc:creator>
      <dc:date>2018-07-27T00:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a custom language switcher in HubL?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/201420#M7492</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;thanks for the tip.&lt;/P&gt;&lt;P&gt;However, I did notice something strange while trying it out:&lt;/P&gt;&lt;P&gt;I&amp;nbsp;re-created the example from the video and unfortunately it doesn't work that easily (at least in our test portal).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the problem:&lt;/P&gt;&lt;P&gt;If the "Enable Language Specific Redirects" function is activated in the settings, the URL of the translated language version is linked correctly. However, the URL addition "?hsLang=de" ensures that a visitor cannot change the language, because he is always redirected to the current language.&lt;/P&gt;&lt;P&gt;If this function is deactivated, the output of the URL of the translated version works as text, but not as a link target.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if you give the link the class "lang_switcher_link" from the standard language switcher module, the correct target URL is linked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hover: Link to english version" style="width: 836px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/11062iF5963D9958096060/image-size/large?v=v2&amp;amp;px=999" role="button" title="hover-english-version.png" alt="Hover: Link to english version" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Hover: Link to english version&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hover: Link to french version" style="width: 847px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/11063iED96C269E7860D8B/image-size/large?v=v2&amp;amp;px=999" role="button" title="hover-french-version.png" alt="Hover: Link to french version" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Hover: Link to french version&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Or you simply&amp;nbsp;add the class "hs-skip-lang-url-rewrite" on a parent or child-element. Which deactivates the automatic Language Specific Redirects on your Language-Switcher-Links.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this class, the target url is linked correctly, too – no matter if the setting is activated or not.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hover_engl_2.png" style="width: 990px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/11086i835FF5E14AFA1E61/image-size/large?v=v2&amp;amp;px=999" role="button" title="hover_engl_2.png" alt="hover_engl_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2018 13:35:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/201420#M7492</guid>
      <dc:creator>ThomasReitz</dc:creator>
      <dc:date>2018-08-10T13:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a custom language switcher in HubL?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/208930#M8524</link>
      <description>&lt;P&gt;Hi. I struggled a bit with this but you can find below my current solution:&amp;lt;/p&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;div class="menu-dropdown"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!-- language select item here --&amp;gt;&lt;BR /&gt;&amp;lt;div class="language-select"&amp;gt;&lt;/P&gt;&lt;P&gt;{% if absolute_url is string_containing "/en/" %} English {% else %} Nederlands {% endif %}&lt;/P&gt;&lt;P&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;lt;!-- hidden dropdown --&amp;gt;&lt;BR /&gt;&amp;lt;div class=" menu-dropdown-content"&amp;gt;&lt;BR /&gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;lt;a href="/{{ content.translated_content['nl-nl'].slug || '' }}" target="_blank"&amp;gt;Nederlands&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;BR /&gt;&amp;lt;li&amp;gt;&amp;lt;a href="/{{ content.translated_content['en'].slug || 'en' }}" target="_blank"&amp;gt;English&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Let me know if this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 19:53:33 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/208930#M8524</guid>
      <dc:creator>andreistoica</dc:creator>
      <dc:date>2018-09-25T19:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a custom language switcher in HubL?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/275215#M12619</link>
      <description>&lt;P&gt;We have current page language english and created another page with spanish language.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;div class="menu-dropdown"&amp;gt;&lt;BR /&gt;&amp;lt;!-- language select item here --&amp;gt;&lt;BR /&gt;&amp;lt;div class="language-select"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!-- {% if absolute_url is string_containing "/en/" %} English {% endif %} --&amp;gt;&lt;BR /&gt;{% if absolute_url is string_containing "/es/" %} Spanish&lt;BR /&gt;{% else %} English {% endif %}&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!-- hidden dropdown --&amp;gt;&lt;BR /&gt;&amp;lt;div class=" menu-dropdown-content"&amp;gt;&lt;BR /&gt;&amp;lt;ul class="hs-skip-lang-url-rewrite"&amp;gt;&lt;BR /&gt;&amp;lt;li&amp;gt;&amp;lt;a href="/{{ content.slug }}" target="_blank"&amp;gt;{{ content.slug }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;BR /&gt;&amp;lt;li&amp;gt;&amp;lt;a href="/{{ content.translated_content['es'].slug || 'es' }}" target="_blank"&amp;gt;Spanish&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here first time means when user view default english version then linking works well but when user view spanish version then linking goes wrong .Here english&amp;nbsp; display link for spanish and spanish display link for default domain url&amp;nbsp; &amp;nbsp;with /es appended at the end&amp;nbsp;not whole page url&amp;nbsp; ..is anybody have any answer?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 06:39:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/275215#M12619</guid>
      <dc:creator>nutanhaspe</dc:creator>
      <dc:date>2019-06-14T06:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a custom language switcher in HubL?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/276990#M12737</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the problem is, that you would need an if-check on the links, too.&lt;/P&gt;&lt;P&gt;{{ content.slug }} is the url path of the current page. So the page links to it self (which isn't really necessary for the visitor).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So you would have to check first the language of the current page and set the links for each translation individually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An easy solution could look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2019-06-25 um 10.51.07.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/18022iE84B2E00C259DE66/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bildschirmfoto 2019-06-25 um 10.51.07.png" alt="Bildschirmfoto 2019-06-25 um 10.51.07.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This would create a link to the spanish version on the german page and a link to the german page on the spanish page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Spanish &amp;gt; German" style="width: 350px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/18024iC230D3760C3A06E3/image-dimensions/350x290?v=v2" width="350" height="290" role="button" title="Bildschirmfoto 2019-06-25 um 10.55.15.png" alt="Spanish &amp;gt; German" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Spanish &amp;gt; German&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="German &amp;gt; Spanish" style="width: 345px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/18025iF6056E58FBA7DA78/image-dimensions/345x288?v=v2" width="345" height="288" role="button" title="Bildschirmfoto 2019-06-25 um 10.54.52.png" alt="German &amp;gt; Spanish" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;German &amp;gt; Spanish&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps (and sorry for the late reply)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 09:03:09 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/276990#M12737</guid>
      <dc:creator>ThomasReitz</dc:creator>
      <dc:date>2019-06-25T09:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a custom language switcher in HubL?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/292909#M13697</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Is it possible to have a statement in my language switcher module so that only if there is a translated page in that language available to display that language option in the switcher, if not don't display that language option in the dropdown? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my code: &lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;div class="navbar"&amp;gt;
  &amp;lt;div class="dropdown"&amp;gt;
    &amp;lt;button class="dropbtn"&amp;gt;
     &amp;lt;i class="fa fa-globe"&amp;gt;&amp;lt;/i&amp;gt;
    &amp;lt;/button&amp;gt;
    &amp;lt;div class="language-dropdown-content"&amp;gt;
     {% if content.language.langauageTag == "en-us" %} &amp;lt;a href="/{{ content.translated_content['en-us'].slug || '' }}"&amp;gt;Americas&amp;lt;/a&amp;gt; {% endif %}
     &amp;lt;a href="/{{ content.translated_content['en-gb'].slug || 'en-gb' }}/{{ request.path|split('/', 2)|last }}"&amp;gt;EMEA&amp;lt;/a&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt; 
&amp;lt;/div&amp;gt;


&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;That if statement isn't working. It's just turning the switcher off on every page. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is the website: &lt;/SPAN&gt;&lt;A href="https://www.cogencyglobal.com/en-gb/" target="_blank" rel="noopener"&gt;https://www.cogencyglobal.com/en-gb&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 13:05:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/292909#M13697</guid>
      <dc:creator>DanBQ</dc:creator>
      <dc:date>2019-09-24T13:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a custom language switcher in HubL?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/342997#M16838</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/95683"&gt;@DanBQ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I came up with a language switcher that does that, you just add/remove languages in the "codes" arrays as necessary. It will only display the languages you put in that array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My original post is &lt;A href="https://community.hubspot.com/t5/CMS-Development/Custom-language-switcher-Language-switching/m-p/342981/highlight/true#M16837" target="_self"&gt;here&lt;/A&gt;, but for you it would look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*Edit: updated to cut out a line:&lt;/P&gt;&lt;PRE&gt;{% if content.translated_content|length %}
  {% set codes = {'Americas': 'en-us', 'EMEA': 'en-gb'} %}
  &amp;lt;div class="navbar"&amp;gt;
    &amp;lt;div class="dropdown"&amp;gt;
      &amp;lt;button class="dropbtn"&amp;gt;
       &amp;lt;i class="fa fa-globe"&amp;gt;&amp;lt;/i&amp;gt;
      &amp;lt;/button&amp;gt;
      &amp;lt;div class="language-dropdown-content"&amp;gt;
      {% for key, val in codes.items() %}
        {% set URL = "/"~content.translated_content[val].slug || val %}
        &amp;lt;a href="{{ URL }}"&amp;gt;{{key}}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
      {% endfor %}
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt; 
  &amp;lt;/div&amp;gt;
{% endif %}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 13:57:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-create-a-custom-language-switcher-in-HubL/m-p/342997#M16838</guid>
      <dc:creator>piersg</dc:creator>
      <dc:date>2020-05-30T13:57:19Z</dc:date>
    </item>
  </channel>
</rss>

