Forum

Questions and discussions

Text translation on themes

Discuss template's customization

Text translation on themes

Postby Er_Maqui » Tue Sep 10, 2013 12:03 pm

Hi,

I'm working with a theme, translating the text. I know how to use the language conditional, but, ¿How can set an multi-condition or else?

I'm talking about this:

if english
-english text
elseif spanish
-spanish text
else
-some fallback text
endif


Thanks,
Er_Maqui
 
Posts: 20
Joined: Mon Aug 26, 2013 10:06 am

Re: Text translation on themes

Postby admin » Wed Sep 11, 2013 6:10 am

The syntax is impossible.

Only:
Code: Select all
{if english}
-english text
{/if}

{if spanish}
-spanish text
{/if}
admin
Site Admin
 
Posts: 1465
Joined: Sun Mar 07, 2010 5:55 pm

Re: Text translation on themes

Postby Er_Maqui » Wed Sep 11, 2013 1:17 pm

Well, ok, but with our syntax i have a problem:

Code: Select all
<div id="slide_box" class="hidden-phone hidden-tablet">
   {if noauth}
   <h1>{lang.register_head}</h1>

   <ul>
      {if english}
      <li>text</li>
      {/if}
      {if spanish}
      <li>text</li>
      {/if}
      {if french}
      <li>text</li>
      {/if}
   </ul>
   buttons
   {/if}
   {if auth}
   <h1>{lang.loggedin_head}</h1>

   <ul>
      {if english}
      <li>text</li>
      {/if}
      {if spanish}
      <li>text</li>
      {/if}
      {if french}
      <li>text</li>
      {/if}
   </ul>
   buttons
   {/if}
</div>


But, on spanish lang without logging in, i see this:

(nothing)
--noauth buttons
{/if}
--auth text
--auth buttons
{/if}

What's the problem here? When i've deleted all lang if's for testing, the page works correctly.


Thanks,
Er_Maqui
 
Posts: 20
Joined: Mon Aug 26, 2013 10:06 am

Re: Text translation on themes

Postby admin » Thu Sep 12, 2013 3:45 pm

You have to use the code:

Code: Select all
    <div id="slide_box" class="hidden-phone hidden-tablet">
       {if noauth}
       <h1>{lang.register_head}</h1>

       <ul>
          <li>{lang.the text}</li>
       </ul>
       buttons
       {/if}
       {if auth}
       <h1>{lang.loggedin_head}</h1>

       <ul>
          <li>{lang.the text}</li>
       </ul>
       buttons
       {/if}
    </div>


and add "thetext" array's element into the files:
/admin/languages/english.php
/admin/languages/french.php
/admin/languages/spanish.php
admin
Site Admin
 
Posts: 1465
Joined: Sun Mar 07, 2010 5:55 pm

Re: Text translation on themes

Postby Er_Maqui » Fri Sep 13, 2013 12:36 pm

Ok, thanks.

To set links, i'll need to cut the strings? Example:

This:
<li>{lang.register_text7}<a href='{SITE_ROOT}index.php?sphoto=1'>{lang.register_text8}</a>{lang.register_text9}</li>

Or this:
<li>{lang.register_text7}</li>
register_text7 = lala<a href='{SITE_ROOT}index.php?sphoto=1'>lala</a>lala


Regards,
Er_Maqui
 
Posts: 20
Joined: Mon Aug 26, 2013 10:06 am

Re: Text translation on themes

Postby admin » Thu Sep 19, 2013 7:02 pm

Both variants are not fine, but the first one is better.
admin
Site Admin
 
Posts: 1465
Joined: Sun Mar 07, 2010 5:55 pm


Return to Design & Templates

Who is online

Users browsing this forum: No registered users and 2 guests

cron
  Photo Store Script

Professional php photo stock script and WordPress plug-in for photographers and video producers.

  Support
  CMSaccount Inc.