• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Disable language chooser

polle

Active member
#1
How can I set a language for the forum and disable all other languages for the users ?

I need to have english, spanish and spanish childs for addons, but I want the user to have Spanish and no option available to change the language.

Thanks.
 

Chris D

XenForo developer
Staff member
#2
In the Admin CP, go to Appearance > Templates and find the template called footer

Remove this code:

Code:
                <xen:if is="{$canChangeLanguage}">
                    <dt>{xen:phrase language}</dt>
                    <dd><a href="{xen:link 'misc/language', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xen:phrase language_chooser}" rel="nofollow">{$visitorLanguage.title}</a></dd>
                </xen:if>
That will remove the language chooser.
 

polle

Active member
#3
Hi Yorik.

And how about the user profile where the lang can be selected ?
Isn't there an option to just use one language and block all the others for users ?

I don't want to have to edit the templated all the time for updates, etc...

Thanks.
 

Jake Bunce

XenForo moderator
Staff member
#4
Admin CP -> Appearance -> Templates -> account_preferences

Add the red code:

Code:
	<xen:if is="{$canChangeLanguage} AND false">
		<dl class="ctrlUnit">
			<dt><label for="ctrl_language_id">{xen:phrase language}:</label></dt>
			<dd>
				<select name="language_id" class="textCtrl" id="ctrl_language_id">
					<xen:foreach loop="$languages" key="$languageId" value="$language">
						<option value="{$languageId}" {xen:selected '{$languageId} == {$visitor.effectiveLanguageId}'}>{$language.title}</option>
					</xen:foreach>
				</select>
				<p class="explain">{xen:phrase interface_of_site_can_be_displayed_using_any_languages}</p>
			</dd>
		</dl>
	<xen:else />
		<input type="hidden" name="language_id" value="{$visitor.effectiveLanguageId}" />
	</xen:if>
 
#5
Hi @Jake Bunce If I need to hide in account_preferences only one language for the list of languages, because I edit my languages like childs for not lost my own changes when the language is updated. It is posible? Thanks in advance.
 
#6
Admin CP -> Appearance -> Templates -> account_preferences

Add the red code:

Code:
    <xen:if is="{$canChangeLanguage} AND false">
        <dl class="ctrlUnit">
            <dt><label for="ctrl_language_id">{xen:phrase language}:</label></dt>
            <dd>
                <select name="language_id" class="textCtrl" id="ctrl_language_id">
                    <xen:foreach loop="$languages" key="$languageId" value="$language">
                        <option value="{$languageId}" {xen:selected '{$languageId} == {$visitor.effectiveLanguageId}'}>{$language.title}</option>
                    </xen:foreach>
                </select>
                <p class="explain">{xen:phrase interface_of_site_can_be_displayed_using_any_languages}</p>
            </dd>
        </dl>
    <xen:else />
        <input type="hidden" name="language_id" value="{$visitor.effectiveLanguageId}" />
    </xen:if>
This code (AND false), works perfectly for hide the language selector of preferences. Thanks!
 

imthebest

Formerly Super120
#7
If there is this conditional <xen:if is="{$canChangeLanguage}"> then why do we need to make template changes in order to achieve this? If there is that conditional then I guess that somewhere in the software there is an option to set whether people are allowed to change language or not?
 

Chris D

XenForo developer
Staff member
#8
No, it's nothing like that:

PHP:
'canChangeLanguage' => (count($languages) > 1),
You "can change language" if the number of languages on your board is greater than 1. There's nothing more complicated to it than that.
 

polle

Active member
#9
No, it's nothing like that:

PHP:
'canChangeLanguage' => (count($languages) > 1),
You "can change language" if the number of languages on your board is greater than 1. There's nothing more complicated to it than that.
And how to remove completely that option ?

1- I install Xenforo and it comes with english.
2- I install my language.
3- I don't want to have the option to choose a language at all, just use mine for everyone.

How ?

Thanks.
 

polle

Active member
#11
That means delete the language in the admin and have no english at all or use what Jake recommends above ?

There should be an option like in styles, "Let the user select" thing.

Thanks.
 

rafass

Well-known member
#12
Sorry for bump this thread.
I'm looking exactly the same, I want to have my ACP in English and the the front end in other different language.
but I don't want the users have the option to change the language. plus I don't want to edit the 2 templates all the time. XF should have the option to choose the language in ACP and Front end.
any clue? I'll really appreciate some help.
 

Brogan

XenForo moderator
Staff member
#13
There is no distinction between the ACP and front end - phrases are not separated like that.

As already stated, it is not possible to have a separate language for the ACP which isn't selectable by regular members.
 

rafass

Well-known member
#14
Thanks Brogan.
I'm re-translating all the sentences of the ACP to English.
Don't take a lot of time editing directly in the XML file.