1

Topic: Hard Cover Tutorial #1: Making language dependent Terms of services

Starting with this topic I decided to share my own experience in customizing vldPersonals.
And as you already know the name of tutorials will be Hard Cover (don't ask me why : )

First tutorial is about customizing TOS pages considering different languages in your site. First of all I added new string to lang.core.php let's call it "lang":

"lang"  =>
"en" ,  //add to english language file

and

"lang"  =>
"ru" , //add to russian language file

and so on depending on your languages.

Those are very useful strings and we’ll use them often. Now let’s create terms of services using our CPanel. And naming them (label field) you need to use such approach: en_tos, ru_tos.

Now in footer.tpl in your templates folder instead of:

<a href="{virtual_path}{ifelse:system_enable_fancy_urls,"1","p/tos.html","index.php?m=pages&p=tos"}">Terms of service</a>

You have to use:

 <a href="{virtual_path}"index.php?m=pages&p={lang:"core" ,"lang"}_tos">Terms of service</a>

Thus clicking this link user will be surprised a little, watching terms of service in it's own language.

As the homework: do "Terms of service" (in link) translation yourself if you think you need it.

Sincerely yours,
Radioactive

Last edited by radioact (2007-06-21 23:41:35)

2

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

hey man
nice tut, but im waiting for the update to come.... to see if nothing has changed form the current ver ...

3

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

Cool.
Just my head is aching of descisions of how to split russian pages with english.
I suppose this can be very useful to make language dependent pages, not only TOS.
Hello to Astana  :-)

4

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

Hey, Yaniv! I think it's kinda decision that won't be affected by new release though there would be more efficient solutions in it.

Hi, Russia! : ) Yes it's just an approach and what we can do with it depends only on our imagination. For example we can link to language dependent *.js *.jpg *.css files in source code of our templates.

Last edited by radioact (2007-06-18 05:27:54)

5

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

Hello Radioactive,
very nice idea, thank you for developing it.

Pardon my question but I got lost following your simple instructions. I wonder if a change in versions is to blame or my own stupidity.  I am running v2.5.5 (Commercial edition)

My footer.tpl does not show the <a > tag you mention below. What I show is:



            <div id="footer">
                <!-- IF settings.enable_tellfriend OR settings.enable_openinviter -->
                    {anchor:url1="invitefriends/",url2="index.php?m=invitefriends",name="core|menu_invitefriends"} |
                <!-- ENDIF -->
                <!-- IF settings.enable_feedback -->
                    {anchor:url1="contactus/",url2="index.php?m=contactus",name="core|menu_contactus"} |
                <!-- ENDIF -->
                {pages:tag="footer",cache_time="10"}
                <!-- CREDIT LINE: UNAUTHORIZED REMOVAL WILL VOID LICENSE -->
                <!-- IF settings.enable_poweredby_link -->| {app_copyright}<!-- ENDIF -->
            </div>



In fact, the only place that the <a> tag seems to be located in this version is in the file account_register.tpl  and looks like this:



                                <!-- IF is_tos -->
                                    <dt><label for="field_tos">{lang:"register","accept_tos"} <a target="_blank" href="{virtual_path}{ifelse:settings.fancy_urls,"1","page/tos/","index.php?m=pages&p=tos"}">{lang:"register","tos"}</a></label></dt>
                                    <dd><select id="field_tos" class="select" name="tos">{dropdownlist:top.yesnobox,registration_tos}</select>{hint:key="tos"}</dd>
                                <!-- ENDIF -->



I have updated THAT file to test the scenario but then in the footer I get all translations I've done which at this stage are only three test languages: German, Spanish and English and it looks like this:


Invite friends | Contact us | Allgemeine Nutzungsbedingungen | Términos y Condiciones | Terms of service



Do you know if there is a way to hide the other languages and only show the language that is currently active?

Thanks!
Richard



PS: German and Spanish languages are enabled in CP, System language is English in CP, language override privileges are OK in CP for member groups and English is chosen language in profile settings for my test profile.

6

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

yes it is not the same on 2.5.3 and 2.5.5
I have same problems on my new site ...
if I translate lang.core it will not translate | Terms of service |
how can we make this working correctly ?
there can we find the lang string for the tos ?

7

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

Hey mates,
This tutorial was made long time ago, at that time we didn't have {session.language} variable which can be used instead of {lang:"core","lang"} and returns 'english' and we also didn't have nice {pages:} extension that displays page links with certain tag. All your TOSes has tag footer that's why all multi-lingual tos links displayed. What I suggest is to delete {pages:} extension call and replace it with:
<a href="{virtual_path}page/{session.language}_tos/">{lang:"custom","tos"}</a>
OR if you don't have pretty urls enabled
<a href="{virtual_path}index.php?m=pages&p={session.language}_tos">{lang:"custom","tos"}</a>

1. Make sure you have page labels like english_tos, french_tos etc (not old fashioned en_tos, fr_tos)
2. Add appropriate translation for "tos" key to your lang.custom.php

Regards,
Ramil

8

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

Hello Ramil,

makes sense. Thank you! I will try it but better tomorrow as it's already 01:10 here and I better get some sleep or NO code will make sense anymore LOL!

Will follow up with some results once I've tried it.

Cheers,
Richard

9

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

thanks ramil ... you did the trick for me wink

I´m "lazy" and will save little time so I did it this way instead smile

<a href="{virtual_path}page/{session.language}_tos/">{lang:"core","menu_tos"}</a>

I will explain little how it´s works: this is only an example for french languages:

the translation for terms of service is in /includes/languages/french/lang.core.php

"menu_tos" =>
"Conditions d'utilisation",

go to: ---> cp ---> content ---> manage page ---> general ---> add page

make a new page and set the label to french_tos
(it must be the same name you have on your languages file)

and only fill in:

name: Conditions d'utilisation
label: french_tos
page: vous écrire des termes du texte de service ici...

and submit so you save your work smile

wish you good luck ! hope the guide will help you !

and thanks ramil for your tutorials how to do it ...

Last edited by gugu (2010-01-05 07:00:51)

10

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

Worked all like a charm.

Excellent idea for customization which can also be used for other pages. Thanks again!

Richard

11

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

Welcome guys! And thanks for your words of appreciation.

12

Re: Hard Cover Tutorial #1: Making language dependent Terms of services

I use IF session language in footer.tpl to display custom pages who contains the TOS. Advantage SEO because TOS links contain keywords.