What is $L

Post Reply
User avatar
cobber
Master Bludit
Posts: 78
Joined: Sun Feb 28, 2016 10:15 am
Location: Scotland
Has thanked: 21 times
Been thanked: 5 times

Hi there, Am looking at several of the themes available and have been looking at the php.

There a few that reference $L

Not 100% sure what is refers to. Any help understanding would be really appreciated

Thanks
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

For example

Code: Select all

<?php echo $L->get('Home'); ?>
gets the translation for Home.

I you use it for plugins you have to set

Code: Select all

global $L;
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
cobber
Master Bludit
Posts: 78
Joined: Sun Feb 28, 2016 10:15 am
Location: Scotland
Has thanked: 21 times
Been thanked: 5 times

Thanks Edi, much appreciated.

So I only need to use this when dealing with translations then.

I wasn't planning to use translation, but will dig further

thank you


Ok, messed around and changed the language to Spanish and the following:

Code: Select all

<a href="<?php echo $page->permalink(); ?>"><?php echo $L->get('Read more'); ?></a>
Then the Read more was translated into Spanish. Nice
Post Reply