ZenMagick 0.9.10


org.zenmagick.core.utils\ZMlocaleUtils
core\utils\ZMLocaleUtils.php at line 29

Class ZMlocaleUtils

ZMlocaleUtils

public class ZMlocaleUtils

Locale utils.

Author:
DerManoMann

Constant Summary
final static str

LOCALE_PATTERNS

Locale patterns.

Method Summary
static array

buildL10nMap(string baseDir, string ext)

Build a language map for all found l10n strings in the given directory tree.

static string

dateLong(Date date)

Format a date as long.

static string

dateShort(Date date)

Format a date as short.

static string

map2po(array map, boolean pot)

Create a po(t) file from a l10n map.

static string

map2yaml(array map)

Create a yaml file from a l10n map.

static string

resolvePath(string path, string locale)

Resolve a locale path.

Constant Detail

core\utils\ZMLocaleUtils.php at line 31

LOCALE_PATTERNS

public final static str LOCALE_PATTERNS = 'zm_l10n_get,zm_l10n,_zmn,_zm,_vzm'

Locale patterns.


Method Detail

core\utils\ZMLocaleUtils.php at line 62

buildL10nMap

public static array buildL10nMap(string baseDir, string ext)

Build a language map for all found l10n strings in the given directory tree.

Parameters:
baseDir - The base folder of the directory tree to scan.
ext - File extension to look for; default is .php.
Returns:
A map of l10n strings for each file.

core\utils\ZMLocaleUtils.php at line 293

dateLong

public static string dateLong(Date date)

Format a date as long.

Parameters:
date - A date.
Returns:
A long version.

core\utils\ZMLocaleUtils.php at line 282

dateShort

public static string dateShort(Date date)

Format a date as short.

Parameters:
date - A date.
Returns:
A short version.

core\utils\ZMLocaleUtils.php at line 167

map2po

public static string map2po(array map, boolean pot)

Create a po(t) file from a l10n map.

This method operates only on the untranslated string. Translation itself happens further down the tool chain.

Parameters:
map - The map.
pot - Optional flag to indicate pot format (empty translations); default is false.
Returns:
The formatted po(t) content.

core\utils\ZMLocaleUtils.php at line 120

map2yaml

public static string map2yaml(array map)

Create a yaml file from a l10n map.

The created YAML will include comments with the filename and warnings about duplicate mappings, etc.

Parameters:
map - The map.
Returns:
The formatted YAML.

core\utils\ZMLocaleUtils.php at line 257

resolvePath

public static string resolvePath(string path, string locale)

Resolve a locale path.

The path given is assumed to contain the full locale as specified in the $locale parameter.

The function will validate the path and if not valid will default to using just the language.

Parameters:
path - The full path.
locale - The locale.
Returns:
A valid path or null. /

ZenMagick 0.9.10