Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Some Note about Phrases System from 4.5.0

...

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:

Code Block
languagephpactionscript3
themeMidnight
titlephrase.json
linenumberstrue
php

{ 
     "PhraseVar textName" : "", 
     "var_name" : "PhraseMessage textText",

     "Phrase text" : { 
                                   "en" : "", 
                                   "es" : "Spanish Phrase text", 
                                   "ot" : "Other language phrase text" 
                              }, 
      
   "var_name" :}

There are 2 ways to define translation:

The easiest way

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

Example:

Code Block
php
php
{ 
                                   "en""Manage Video" : "Phrase text", 
                                   "es" : "Spanish Phrase text", 
                                   "ot" : "Other language phrase text" 

                              }, 
} 

We have 4 ways to define a phrase:

...

}

Use:

Code Block
php
php

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

// print Manage Video

var_name define:

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

Example:

Code Block
languagephpactionscript3
titleEasiest define
linenumberstrue
php

{ 
     "Manage Videomanage_video" : "Manage Video" 
}

...

Usage

Code Block
languagephp
php
titleEasiest define - Using
linenumberstrue

<?php
echo _p("manage_video");

// print Manage Video"); 

It will show: Manage Video

  • Var name define: Put var_name on key, put phrase on value (of json).

Example:

Code Block
languageactionscript3
titleEasiest define
linenumberstrue

Code Block
php
php

<?php
_p('var_name', $attr);

Within phpFox template .html.php file:

Code Block
php
php

{_p var="var_name" $attr}

Within phpFox template *.html file:

Code Block
php
php

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

Within JavaScript file

Code Block
php
php

oTranslations['var_name', context]

Translate a phrase with context variables

Code Block
php
php

{
      "manage_videototal_people_liked_this_blog" : "Manage Video" 
{total} people liked this blog
}

...

Usage

Code Block
languagephp
php
titleEasiest define - Using
linenumberstrue

<?php
echo _p("manage_video"); 

It will show: Manage Video

total_people_liked_this_blog", ["total" => 5]);

Result: 5 people liked this blog

Info

Use single sign { and } for variable.