Language Switch / Phrase ?

erich37

Well-known member
I do have a forum with 2 languages (english and german).

- when looking at the forum in english language, the language-switch-link at the bottom-left says "english".

- when looking at the forum in german language, the language-switch-link at the bottom-left says "german".

However this is rather confusing for a visitor, as when he is viewing the forum in german-language and sees a link at the bottom left which says "Deutsch", he will rather not understand what this means and that this is the link in order to change the language into english.

Is there a way to change the wording for the language-switch-link at the bottom-left ? Like changing the phrase for this link to "Change Language" ? The issue is that there is not a phrase existing for this language-switch-link, but the naming is coming from the installed language-file.

However the name of the language file needs to be remaining, as I still want to show the wording "english" and "german" within the pop-up-window.

Suggestion for XF-developers:
please add an additional phrase for the language-switch at the bottom-left.
 
@Dylan V

I have followed all of the instructions on your post but nothing appaers on my theme and nothing changed.

Can you please help me?

bet-clever.com

Thanks.

@joey_tbf

Already tried but I had a bug where sometimes it showed other words in other languages. :)
 
@Dylan V

I have followed all of the instructions on your post but nothing appaers on my theme and nothing changed.

Can you please help me?

bet-clever.com

Thanks.

@joey_tbf

Already tried but I had a bug where sometimes it showed other words in other languages. :)
You may not understand what I have wrote above or so, you do not have the knowledge to understand my tutorial. You must place the well location of your image, etc.

This tutorial works perfectly, but you must follow it correctly.
 
@Jake Bunce

I want to put country flags in front of the language chooser. Like flag_English.
So in front of the text "English" you can see the flag.
I don't mean the overlay, I mean the place you see on bottom left of the page.

I think I have to edit the language_chooser template and put this:
Code:
                    <a href="{xen:link 'misc/language', '', 'language_id=1', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}"><img src="path/to/flag1.jpg" border="0" /></a>
                    <a href="{xen:link 'misc/language', '', 'language_id=2', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}"><img src="path/to/flag2.jpg" border="0" /></a>

But I am not sure where to put it.

But this would show 2 flags. I want only to show the flag of the selected language in front of the language title.
 
Last edited:
@Jake Bunce

I want to put country flags in front of the language chooser. Like flag_English.
So in front of the text "English" you can see the flag.
I don't mean the overlay, I mean the place you see on bottom left of the page.

I think I have to edit the language_chooser template and put this:
Code:
                    <a href="{xen:link 'misc/language', '', 'language_id=1', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}"><img src="path/to/flag1.jpg" border="0" /></a>
                    <a href="{xen:link 'misc/language', '', 'language_id=2', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}"><img src="path/to/flag2.jpg" border="0" /></a>

But I am not sure where to put it.

But this would show 2 flags. I want only to show the flag of the selected language in front of the language title.

For example, you can use this condition to show output only when the user has language_id 2 selected:

Code:
<xen:if is="{$visitor.language_id} == 2">

</xen:if>
 
For example, you can use this condition to show output only when the user has language_id 2 selected:

Code:
<xen:if is="{$visitor.language_id} == 2">

</xen:if>
Yeah, it took me some time to find the propper template to use this and to use the if conditional, but I made it work. Thank you.

Can you tell me the url of the language selector? I want to put it via html code in the xenforo notice.

I tried using
Code:
  <a href="{xen:link 'misc/language', '', 'language_id=1', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}"><img src="path/to/flag1.jpg" border="0" /></a>
But I get a "Requested page could not found" error after clicking on it, which is displayed in my notice. (the normal language selector works though, I just want to link to it in my notice).
 
I am looking for something like this:

Does anybody know of how to create an additional "Header Dropdown" and put the language-switch into such a new "Header Dropdown" ?


The "Language-Switch"-button to be located at the left-hand-side.



language_switch_header.webp



language_new_header.webp





For logged-in members, there could be a Tab in the NavBar:


language_nav_logged_in.webp



Many thanks!


:)
 
Last edited:
I want to put country flags in front of the language chooser. Like flag_English.
So in front of the text "English" you can see the flag.
I don't mean the overlay, I mean the place you see on bottom left of the page.

could you please share the code for this ?


Many thanks!
 
Last edited:
could you please share the code for this ?


Many thanks!

Sure.

1)
Sites with multi-languages should put the language chooser where people can see it. When they first visit your site, they must see it directly, so they don't go away.
For this I recommend this:
https://xenforo.com/community/resources/language-chooser-position-by-waindigo.1904/
So it is seen. I placed the chooser on top right, next to alerts.

2)
Then there is this add-on, where you don't need to do anything, just go to your languages and upload the images. I would recommend the famfamfam flags.
https://xenforo.com/community/threads/language-flags-by-waindigo.54044/
But this add-on only adds the flags to the overlay (in front of the text in overlay), but not when it is displayed

3a)
Now if you use the language chooser position add-on, find the template waindigo_top_right_langchooserpos
It will have this code:
Code:
<li class="navTab PopupClosed"><a href="{xen:link 'misc/language', '', 'redirect={$requestPaths.requestUri}'}" class="navLink visitorTabItem OverlayTrigger" title="{xen:phrase language_chooser}" rel="nofollow">{$visitorLanguage.title}</a></li>
Replace this with:
Code:
<li class="navTab PopupClosed"><a href="{xen:link 'misc/language', '', 'redirect={$requestPaths.requestUri}'}" class="navLink visitorTabItem OverlayTrigger" title="{xen:phrase language_chooser}" rel="nofollow"><xen:if is="{$visitor.language_id} == 1"><img src="..." border="0" /> </xen:if><xen:if is="{$visitor.language_id} == 4"><img src="..." border="0" /> </xen:if>{$visitorLanguage.title}</a></li>
</xen:if>
My example uses for 2 languages! Adjust it to yourself! Use the language ID for your cases (for me it was ID 1 and ID 4) and put the right img sources. If you use more than 2 languages, just copy/paste the whole xen:if is part and add it at its end.

3b)
If you don't use the language chooser position add-on, just find in your footer template
Code:
<dd><a href="{xen:link 'misc/language', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xen:phrase language_chooser}" rel="nofollow">{$visitorLanguage.title}</a></dd>
and after "nofollow"> but before {$visitorLanguage.title} add
Code:
xen:if is="{$visitor.language_id} == 4"><img src="..." border="0" /> </xen:if>
part with your own ID and own image source and as many as you want.


Hope it will help you. I also added the flags to the login bar like Jake explained it here.
 
Last edited:

Many thanks for your kind help!
I do not want to use any Addons for this, rather just apply the code myself.



1)
Sites with multi-languages should put the language chooser where people can see it. When they first visit your site, they must see it directly, so they don't go away.

Absolutely agree.
The language-chooser at the bottom is fine, but there needs to be something similar at the very top as well.
I think a simple drop-down box in the header would work fine. This is seen at many other websites.
Example:
http://www.directindustry.com




Have you managed to put the Language-Links into a "Notice" ?
I think it should work by just applying the Language-ID to the Link ?

Code:
domain.com/misc/language?language_id=23
 
Last edited:
Admin CP -> Appearance -> Templates -> login_bar

Add the red code:

Rich (BB code):
<xen:require css="login_bar.css" />

<div id="loginBar">
    <div class="pageWidth">
        <div class="pageContent">   
            <h3 id="loginBarHandle">
                <label for="LoginControl"><a href="{xen:link login}" class="concealed noOutline">{xen:if $xenOptions.registrationSetup.enabled, {xen:phrase log_in_or_sign_up}, {xen:phrase log_in}}</a></label>
            </h3>
           
            <h3 id="loginBarHandle" style="margin-right: 150px;">
                <label>
                    <a href="{xen:link 'misc/language', '', 'language_id=1', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}"><img src="path/to/flag1.jpg" border="0" /></a>
                    <a href="{xen:link 'misc/language', '', 'language_id=2', '_xfToken={$visitor.csrf_token_page}', 'redirect={$redirect}'}"><img src="path/to/flag2.jpg" border="0" /></a>
                </label>
            </h3>

            <span class="helper"></span>

            <xen:edithint template="login_bar_form" />
        </div>
    </div>
</div>

Add more instances of the blue code to add more flags. You need to enter the languageids and paths to the flag images though. This only shows for guests because the loginbar only shows for guests.

The result:

View attachment 21567

how do I move this Language-Handle from "right-hand-side"-position towards "left-hand-side"-position ?
So that it is exactly the same as the "Log-in Handle", but just at the "left-hand-side".
And so that it will work on responsive as well ?


Many thanks!
 
I do not want to use any Addons for this, rather just apply the code myself.
Then just find the propper template and add it yourself.

Absolutely agree.
The language-chooser at the bottom is fine, but there needs to be something similar at the very top as well.
I think a simple drop-down box in the header would work fine. This is seen at many other websites.
That is why I placed my chooser next to alerts. It is a good place and an elegant way.

Have you managed to put the Language-Links into a "Notice" ?
I think it should work by just applying the Language-ID to the Link ?
I wanted to put in the notice the language overlay chooser. So when you click on it, that the overlay apears where you can choose the language. But the template syntax doesn't work. So I linked to domain.com/account/preferences page, where you can choose the language.
 
I've been playing with this customisation and the result is very great ;)
I was wondering if there are some way to put a flag in the language overlay chooser without the waindigo addon.
just editing the template directly. any idea?
 
I've been playing with this customisation and the result is very great ;)
I was wondering if there are some way to put a flag in the language overlay chooser without the waindigo addon.
just editing the template directly. any idea?
Hi,

You want to have the text with an icon just before it or just the icon?
 
For example, you can use this condition to show output only when the user has language_id 2 selected:
Code:
<xen:if is="{$visitor.language_id} == 2">
</xen:if>
Hello Jake! This is my favorite conditional.
I was wondering if with this conditional is possible hide certain forums / categories in forum_list.
That's possible? Many thanks!
 
Top Bottom