\Geekwright\PoPoInitAbstract

PoInitAbstract provides a structure for 'msginit' like logic which can take a source PHP file, recognize gettext like function tokens, and capture the translatable strings in a PoFile object.

Summary

Methods
Properties
Constants
getPoFile()
setPoFile()
getGettextTags()
setGettextTags()
addGettextTags()
getNgettextTags()
setNgettextTags()
addNgettextTags()
getPgettextTags()
setPgettextTags()
addPgettextTags()
msginitFile()
msginitString()
escapeForPo()
checkPhpFormatFlag()
No public properties found
No constants found
No protected methods found
$poFile
$gettextTags
$pgettextTags
$ngettextTags
N/A
No private methods found
No private properties found
N/A

Properties

$poFile

$poFile : \Geekwright\Po\PoFile

Type

PoFile — object to be used in msginit

$gettextTags

$gettextTags : string[]

Type

string[] — tags for gettext constructs, i.e. tag($msgid)

$pgettextTags

$pgettextTags : string[]

Type

string[] — tags for pgettext constructs, i.e. tag($msgctxt, $msgid)

$ngettextTags

$ngettextTags : string[]

Type

string[] — tags for ngettext constructs, i.e. tag($msgid, $msgid_plural)

Methods

getPoFile()

getPoFile() : \Geekwright\Po\PoFile

Get the PoFile object used in msginit process

Returns

\Geekwright\Po\PoFile —

setPoFile()

setPoFile(\Geekwright\Po\PoFile  $poFile) : void

Set the PoFile object to use in msginit process

Parameters

\Geekwright\Po\PoFile $poFile

a PoFile object

getGettextTags()

getGettextTags() : string[]

Get tags used for gettext like functions

Returns

string[] —

setGettextTags()

setGettextTags(string[]  $tags) : void

Set tags used for gettext like functions

Parameters

string[] $tags

array of tags to set

addGettextTags()

addGettextTags(string|string[]  $tags) : void

Add tags used for gettext like functions

Parameters

string|string[] $tags

tag, or array of tags to add

getNgettextTags()

getNgettextTags() : string[]

Get tags used for ngettext like functions

Returns

string[] —

setNgettextTags()

setNgettextTags(string[]  $tags) : void

setNgettextTags - set tags used for ngettext like functions

Parameters

string[] $tags

array of tags to set

addNgettextTags()

addNgettextTags(string|string[]  $tags) : void

Add tags used for ngettext like functions

Parameters

string|string[] $tags

tag, or array of tags to add

getPgettextTags()

getPgettextTags() : string[]

Get tags used for pgettext like functions

Returns

string[] —

setPgettextTags()

setPgettextTags(string[]  $tags) : void

Set tags used for pgettext like functions

Parameters

string[] $tags

array of tags to set

addPgettextTags()

addPgettextTags(string|string[]  $tags) : void

Add tags used for pgettext like functions

Parameters

string|string[] $tags

tag, or array of tags to add

msginitFile()

msginitFile(string  $filename) : \Geekwright\Po\PoFile

Inspect the supplied source file, capture gettext references as a PoFile object

Parameters

string $filename

name of source file

Throws

\Geekwright\Po\Exceptions\FileNotReadableException

Returns

\Geekwright\Po\PoFile —

msginitString()

msginitString(string  $source, string  $refname) : \Geekwright\Po\PoFile

Inspect the supplied source, capture gettext references as a PoFile object

Parameters

string $source

php source code

string $refname

source identification used for PO reference comments

Returns

\Geekwright\Po\PoFile —

escapeForPo()

escapeForPo(string  $string) : string

Prepare a string from tokenized output for use in a po file. Remove any surrounding quotes, escape control characters and double quotes.

Parameters

string $string

raw string (T_STRING) identified by php token_get_all

Returns

string —

checkPhpFormatFlag()

checkPhpFormatFlag(\Geekwright\Po\PoEntry  $entry) : void

Check the supplied entry for sprintf directives and set php-format flag if found

Parameters

\Geekwright\Po\PoEntry $entry

entry to check