Punic APIs
  • Namespace
  • Class
  • Tree
  • Todo

Namespaces

  • Punic
    • Exception

Classes

  • Calendar
  • Comparer
  • Currency
  • Data
  • Language
  • Misc
  • Number
  • Phone
  • Plural
  • Territory
  • Unit

Exceptions

  • Exception

Class Data

Common data helper stuff.

Namespace: Punic
Located at Data.php

Methods summary

public static string
# getDefaultLocale( )

Return the current default locale.

Return the current default locale.

Returns

string
public static string
# getDefaultLanguage( )

Return the current default language.

Return the current default language.

Returns

string
public static
# setDefaultLocale( string $locale )

Set the current default locale and language.

Set the current default locale and language.

Parameters

$locale

Throws

Punic\Exception\InvalidLocale
Throws an exception if $locale is not a valid string
public static string
# getFallbackLocale( )

Return the current fallback locale (used if default locale is not found).

Return the current fallback locale (used if default locale is not found).

Returns

string
public static string
# getFallbackLanguage( )

Return the current fallback language (used if default locale is not found).

Return the current fallback language (used if default locale is not found).

Returns

string
public static
# setFallbackLocale( string $locale )

Set the current fallback locale and language.

Set the current fallback locale and language.

Parameters

$locale

Throws

Punic\Exception\InvalidLocale
Throws an exception if $locale is not a valid string
public static array
# getAvailableLocales( boolean $allowGroups = false )

Return a list of available locale identifiers.

Return a list of available locale identifiers.

Parameters

$allowGroups
Set to true if you want to retrieve locale groups (eg. 'en-001'), false otherwise

Returns

array
public static string
# guessFullLocale( string $language = '', string $script = '' )

Try to guess the full locale (with script and territory) ID associated to a language.

Try to guess the full locale (with script and territory) ID associated to a language.

Parameters

$language
The language identifier (if empty we'll use the current default language)
$script
The script identifier (if $language is empty we'll use the current default script)

Returns

string
Returns an empty string if the territory was not found, the territory ID otherwise
public static string
# getTerritory( string $locale = '', boolean $checkFallbackLocale = true )

Return the terrotory associated to the locale (guess it if it's not present in $locale).

Return the terrotory associated to the locale (guess it if it's not present in $locale).

Parameters

$locale
The locale identifier (if empty we'll use the current default locale)
$checkFallbackLocale
Set to true to check the fallback locale if $locale (or the default locale) don't have an associated territory, false to don't fallback to fallback locale

Returns

string
Punic APIs API documentation generated by ApiGen