Package translate :: Package storage :: Module php

[hide private]
[frames] | no frames]

# Module php

source code

Classes that hold units of PHP localisation files phpunit or entire files phpfile. These files are used in translating many PHP based applications.

Only PHP files written with these conventions are supported:

      $lang['item'] = "vale";  # Array of values
      $some_entity = "value";  # Named variables
      $lang = array(
         'item1' => 'value1',
         'item2' => 'value2',
      );

Nested arrays are not supported:

      $lang = array(array('key' => 'value'));

The working of PHP strings and specifically the escaping conventions which differ between single quote (') and double quote (") characters are implemented as outlined in the PHP documentation for the String type

Classes | [hide private]

| phpunit a unit of a PHP file i.e.
| phpfile This class represents a PHP file, made up of phpunits

Functions | [hide private]

phpencode(text, quotechar=`'``\'``'`) convert Python string to PHP escaping | source code

phpdecode(text, quotechar=`'``\'``'`) convert PHP escaped string to a Python string | source code

Imports: re, base

Function Details | [hide private]

### phpencode(text, quotechar=`'``\'``'`)

source code

convert Python string to PHP escaping

The encoding is implemented for 'single quote' and "double quote" syntax.

heredoc and nowdoc are not implemented and it is not certain whether this would ever be needed for PHP localisation needs.