Page tree

Versions Compared

Key

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

Some

...

Notes about

...

Phrase System from 4.5.0

  • Deprecating  function: Phpfox::getPhrase. On version 4.5.0, you can use this function, but it will be removed completely from 4.6.0.
  • Have to define phrase before use.
  • Define and use:
  1. How to to define:

Add file phrase.json on root path of your apps.

...

Code Block
languageactionscript3
themeMidnight
titlephrase.json
linenumberstrue
{ 
     "Phrase text" : "", 
     "var_name" : "Phrase text", 
     "Phrase text" : { 
                                   	"en" : "", 
                                   "es" : "Spanish Phrase text", 
                                   "ot" : "Other language phrase text" 
                     }, 
      
},   	     
   "var_name" : { 
                                   "en" : "Phrase text", 
                                   "es" : "Spanish Phrase text", 
                                   "ot" : "Other language phrase text" 

                              }, 
} 

We have 4 ways to define a phrase:

  • Easies Easiest define: Put phrase on key, put blank on value (of json).

...

It will show: Manage Video

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

...

It will show: Manage Video

 

Info

With first and second way 1 and 2, we will use phrase "Manage Video" for all available language languages on your site.

 

  • Easy Multi-language define: Define multi language for your phrase

 

Example:

 

Code Block
languageactionscript3
titleMulti-language define
linenumberstrue
{ 
	"Phrase text" : { 
                     	"en" : "", 
                        "es" : "Spanish Phrase text", 
                        "ot" : "Other language phrase text" 
                    }, 
} 

 

Use:

 

Code Block
languagephp
titleMulti-language define - Using
linenumberstrue
<?php
echo _p("Phrase text"); 

 


"en": can be missed

Info

Clients' site have to installed language package with id "es", if not, es

...

 phrase will by pass. It's the same for other language package.

It will show: Phrase text (if default language of user is en)

It will show: Spanish Phrase text (If default language of users user is es)

...

 

  • Var name multi-language define:

Example:

 

Code Block
languageactionscript3
titleVar name multi-language define
linenumberstrue
{ 
	"phrase_text" : { 
                     	"en" : "Phrase text", 
                        "es" : "Spanish Phrase text", 
                        "ot" : "Other language phrase text" 
                    }, 
} 

 

Use:

 

Code Block
languagephp
titleVar name multi-language define - Using
linenumberstrue
<?php
echo _p("phrase_text"); 

...

"en": is required (can not be missed)

Info

Clients' site have to installed language package with id "es", if not, es phrase will by pass. It's the same for other language package.

It will show: Phrase text (if default language of user is en)

It will show: Spanish Phrase text (If default language of users is es)

....

2. How to use

DefaultGeneral:

Code Block
languagephp
titleuse _p
<?php
_p('var_name', $attr)

Smarty:

Code Block
languagexml
titlesmarty _p
{_p var="var_name" $attr}

...

Code Block
languagexml
titlesmarty _p
{_p var="var_name" $attr}
Twig
Code Block
languagexml
titleTwig
linenumberstrue
{{ _p("var_name", $arrt) }}

...

Code Block
languagejs
linenumberstrue
oTranslations['var_name', arrt]

With $arrt is array variables of variable on phrase.

3. Use Phrase with variable

The variable variables can be included in a phrase. Example:

...

Note: Use single sign and for variable.