Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

All phrases that used on your apps should be defined before using. The below instructions will help you:
How to to define?

Add a phrase.json file on under your app directory, this file contains all phrase in your app.

Example:

{ 
     "Var Name" : "", 
     "var_name" : "Message Text"
}

There are 2 ways to define translation:

The easiest way

Put phrase on key, put blank on value (of json).

Example:

{ 
     "Manage Video" : "" 
}

Use:

<?php
echo _p("Manage Video");

// print Manage Video

var_name define:

Put var_name on key, put phrase on value (of json).

Example:

{ 
     "manage_video" : "Manage Video" 
}

Usage

<?php
echo _p("manage_video");

// print Manage Video
<?php
_p('var_name', $attr);

Within phpFox template .html.php file:

{_p var="var_name" $attr}

Within phpFox template *.html file:

{{ _p("var_name", $arrt) }}

Within JavaScript file

oTranslations['var_name', context]

Translate a phrase with context variables

{
    "total_people_liked_this_blog" : "{total} people liked this blog
}

Usage

<?php
echo _p("total_people_liked_this_blog", ["total" => 5]);

Result: 5 people liked this blog

Use single sign

Unknown macro: { and }

for variable.

  • No labels