Page tree

Versions Compared

Key

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

...

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

....

2. How to use

Default

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

Smarty

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

Twig

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

Twig

Code Block
languagexml
titleTwig
linenumberstrue
{{ _p("var_name", $arrt) }}

Javascript

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

With $arrt is array of variable on phrase.

3. Use Phrase with variable

The variable can be included in a phrase. Example:

Code Block
languageactionscript3
linenumberstrue
{
	"total_people_liked_this_blog" : "{total} people liked this blog
}

Use:

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

It will show: 5 people liked this blog

Note: Use single sign { and for variable.