Jump to content

(Solved).Different languages for front and back offices?


Recommended Posts

Hi, I need to set up online shop with enabled Danish and Swedish languages in front office and English in back office. When english is enabled along with danish and swedish, U.S flag is visible in language selection block. Only danish and swedish shoud be languages to choose for visitors of the shop. English should use only admin. Disabling english for back office makes imposible tu use it in administration area. Are there some ways to make different languages for both offices?

Edited by darwin31 (see edit history)
Link to comment
Share on other sites

  • 8 months later...

Hi,

 

I have the same problem as you did. - I need my front office in German, while back office in English, as I can operate it in the English language only. Can you please let me know how to do it in details? Cannot find out where to add this {if $language.iso_code != "en"}  you mentioned.

 

Thank you in advanced.

Link to comment
Share on other sites

Hi,

 

I have the same problem as you did. - I need my front office in German, while back office in English, as I can operate it in the English language only. Can you please let me know how to do it in details? Cannot find out where to add this {if $language.iso_code != "en"}  you mentioned.

 

Thank you in advanced.

 

Hi dooofox,

 

make change in Prestashop_webRoot/themes/yourTheme/modules/blocklanguages/blocklanguages.tpl

add 

{if $language.iso_code != "en"}

just after foreach and english should be omitted from front office language selection

 

your code should look like:

{foreach from=$languages key=k item=language name="languages"}
{if $language.iso_code != "en"}	
<li {if $language.iso_code == $lang_iso}class="selected_language"{/if}>
{if $language.iso_code != $lang_iso}
{assign var=indice_lang value=$language.id_lang}
{if isset($lang_rewrite_urls.$indice_lang)}
<a href="{$lang_rewrite_urls.$indice_lang|escape:htmlall}" title="{$language.name}">
{else}
<a href="{$link->getLanguageLink($language.id_lang)|escape:htmlall}" title="{$language.name}">

{/if}
{/if}
<img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" />
{if $language.iso_code != $lang_iso}
</a>
{/if}
</li>
{/if}
{/foreach}

Good luck :)

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Hi, this is very useful, i have the same problem too.

The only problem is that I do not have a blocklanguages.tpl in mytheme/modules/blocklanguages/ folder, in that folder only a mylanguage.php translation file exists.

There is instead a blocklanguages.tpl file in folder root(PUBLIC_HTML)/modules/blocklanguages/

Does this mean that my install is corrupted? On the other hand, can I edit the mentioned and only blocklanguages.tpl and have the same effect? 

 

Also, my tpl file looks a bit different than the one above, it looks like this (presta version 1.5.6 i guess)

 

<!-- Block languages module -->
{if count($languages) > 1}
<div id="languages_block_top">
<div id="countries">
{* @todo fix display current languages, removing the first foreach loop *}
{foreach from=$languages key=k item=language name="languages"}
{if $language.iso_code == $lang_iso}
<p class="selected_language">
<img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" />
</p>
{/if}
{/foreach}
<ul id="first-languages" class="countries_ul">
{foreach from=$languages key=k item=language name="languages"}
<li {if $language.iso_code == $lang_iso}class="selected_language"{/if}>
{if $language.iso_code != $lang_iso}
{assign var=indice_lang value=$language.id_lang}
{if isset($lang_rewrite_urls.$indice_lang)}
<a href="{$lang_rewrite_urls.$indice_lang|escape:htmlall}" title="{$language.name}">
{else}
<a href="{$link->getLanguageLink($language.id_lang)|escape:htmlall}" title="{$language.name}">


{/if}
{/if}
<img src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" />
{if $language.iso_code != $lang_iso}
</a>
{/if}
</li>
{/foreach}
</ul>
</div>
</div>


<script type="text/javascript">
$(document).ready(function () {
$("#countries").mouseover(function(){
$(this).addClass("countries_hover");
$(".countries_ul").addClass("countries_ul_hover");
});
$("#countries").mouseout(function(){
$(this).removeClass("countries_hover");
$(".countries_ul").removeClass("countries_ul_hover");
});


});
</script>
{/if}
<!-- /Block languages module -->

PS: by the way, i use notepad++ to show language code for php when reading .tpl files, but i can see you use a diffferent language, is there a language for tpl too?

Edited by Salus (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...