Jamroom Logo Jamroom 5 Core
is now Open Source!
Follow Jamroom on Twitter!

{jr_lang_prepare} Index {jr_logged_in}

{jr_lang}


The {jr_lang} template function is used to access a Language String that has been included by the {jr_lang_prepare} template function.  This function allows you to offer multi language support from within the same skin or theme template file.

Note: The {jr_lang_prepare} template function must be processed (i.e. called) before calling this function or it will not work.

Parameters

Name Type Required Default Description
id string yes n/a The "id" parameter tells Jamroom which language string entry from within the loaded PHP language file to use.
default string yes n/a The "default" option tells Jamroom the string to use if it is not able to locate the proper string within the loaded language file.
assign string no n/a

If the "assign" parameter is given, the resulting language string (either from the loaded language file or from the defined default) will be loaded in to the given "assign" variable - i.e. assign="varname".  This created variable can then be access after the {jr_lang} call within the template - i.e. {$varname}

 Note: the "assign" parameter cannot be used in Profile Theme templates!

 

Example

Template with {jr_lang} used:

{* jr_lang_prepare MUST be called first, or the en-US.php (or selected language) file will not be loaded *}
{* and ALL your jr_lang calls will use the default instead *}

{jr_lang_prepare skin="Cobalt3" default="en-US.php"}

{* will display "visit our site" when viewed *}
{jr_lang id="34" default="visit our site"}

{* will NOT display when viewed - instead, "visit our site" is stored in $info_text variable *}
{jr_lang id="34" default="visit our site" assign="info_text"}

{* Since $info_text contains "visit our site" that will show here when viewed *}
{$info_text}

Contents of jamroom/skins/Test_Skin/lang/en-US.php file:

<?php

$lang[34] = 'visit our site';

?>

 

Advanced Usage

One of the powerful features of the {jr_lang} Template Function, is that with a little "imagination", it can be used as a general purpose "string replacer".  Some things to note:

  • There is no requirement that the "id" parameter be a number - it can be a string as well.
  • There is no requirement that the value assigned to the ID in the language file be just a "string" either - it can just as easily be a string of HTML (for example).

What this means is that you can use the {jr_lang} Template Function to display different items to different users based on their "language" choice.  Since a "language" in Jamroom is really just a collection of strings, you can create your own language files that contain text strings that you want replaced if someone is using that language file.


{jr_lang_prepare} page 130 of 171 {jr_logged_in}
Solutions Products Support Community Company
Social Media Platform
Social Networking Software
Musician Website Manager
Community Builder
Jamroom 5
Jamroom 5 Modules
Jamroom Marketplace
Support Forum
Documentation
Support Center
Contact Support
Community Forum
Member Sites
Developers
About Us
Contact Us
Privacy Policy
©2003 - 2024 The Jamroom Network