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

Disable language chooser

Discussion in 'XenForo Questions and Support' started by polle, May 18, 2012.

  1. polle

    polle Active Member

    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.

  2. Chris D

    Chris D XenForo Developer Staff Member

    In the Admin CP, go to Appearance > Templates and find the template called footer

    Remove this 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>
    That will remove the language chooser.
  3. polle

    polle Active Member

    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...

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> account_preferences

    Add the red code:

    	<xen:if is="{$canChangeLanguage} AND false">
    		<dl class="ctrlUnit">
    			<dt><label for="ctrl_language_id">{xen:phrase language}:</label></dt>
    				<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>
    				<p class="explain">{xen:phrase interface_of_site_can_be_displayed_using_any_languages}</p>
    	<xen:else />
    		<input type="hidden" name="language_id" value="{$visitor.effectiveLanguageId}" />
    CarlosMST likes this.
  5. CarlosMST

    CarlosMST Member

    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. CarlosMST

    CarlosMST Member

    This code (AND false), works perfectly for hide the language selector of preferences. Thanks!
  7. imthebest

    imthebest Formerly Super120

    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?
  8. Chris D

    Chris D XenForo Developer Staff Member

    No, it's nothing like that:

    '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.
    imthebest likes this.
  9. polle

    polle Active Member

    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 ?

  10. Chris D

    Chris D XenForo Developer Staff Member

    Removing it from the template would be the easiest thing.
  11. polle

    polle Active Member

    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.

  12. rafass

    rafass Well-Known Member

    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.
  13. Brogan

    Brogan XenForo Moderator Staff Member

    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.
  14. rafass

    rafass Well-Known Member

    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.

Share This Page