Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3281664
pht.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
pht.php
View Options
<?php
/**
* Translate a string. It uses a translator set by
* `PhutilTranslator::setInstance()` or translations specified by
* `PhutilTranslator::getInstance()->setTranslations()` and language rules set
* by `PhutilTranslator::getInstance()->setLocale()`.
*
* @param string Translation identifier with `sprintf()` placeholders.
* @param mixed Value to select the variant from (e.g. singular or plural).
* @param ... Next values referenced from $text.
* @return string Translated string with substituted values.
*/
function
pht
(
$text
,
$variant
=
null
/* , ... */
)
{
$args
=
func_get_args
(
)
;
$translator
=
PhutilTranslator
::
getInstance
(
)
;
return
call_user_func_array
(
array
(
$translator
,
'translate'
)
,
$args
)
;
}
/**
* Count all elements in an array, or something in an object.
*
* @param array|Countable A countable object.
* @return PhutilNumber Returns the number of elements in the input
* parameter.
*/
function
phutil_count
(
$countable
)
{
if
(
!
(
is_array
(
$countable
)
||
$countable
instanceof
Countable
)
)
{
throw
new
InvalidArgumentException
(
pht
(
'Argument should be countable.'
)
)
;
}
return
new
PhutilNumber
(
count
(
$countable
)
)
;
}
/**
* Provide a gendered argument to the translation engine.
*
* This function does nothing and only serves as a marker for the static
* extractor so it knows particular arguments may vary on gender.
*
* @param PhutilPerson Something implementing @{interface:PhutilPerson}.
* @return PhutilPerson The argument, unmodified.
*/
function
phutil_person
(
PhutilPerson
$person
)
{
return
$person
;
}
function
pht_list
(
array
$items
)
{
return
implode
(
', '
,
$items
)
;
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Mar 24, 00:33 (1 d, 4 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1113743
Default Alt Text
pht.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment