symfony API

sfMessageSource Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.3 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.3 version. Switch to:

Abstract sfMessageSource class.

Method Summary

  • array &($variant)
    Loads the message for a particular catalogue+variant.
  • append($message)
    Adds a untranslated message to the source. Need to call save()
  • sfMessageSource factory($type, $source, $filename)
    Factory method to instantiate a new sfMessageSource depending on the
  • sfMessageCache getCache()
    Gets the cache handler for this source.
  • array getCatalogueList($catalogue)
    Gets all the variants of a particular catalogue.
  • string getCulture()
    Gets the culture identifier for the source.
  • int getLastModified($source)
    Gets the last modified unix-time for this particular catalogue+variant.
  • string getSource($variant)
    Gets the source, this could be a filename or database ID.
  • boolean isValidSource($source)
    Determines if the source is valid.
  • boolean load($catalogue)
    Loads a particular message catalogue. Use read() to
  • array read()
    Gets the array of messages.
  • setCache($cache)
    Sets the cache handler for caching the messages.
  • setCulture($culture)
    Sets the culture for this message source.
  • __construct()
    Private constructor. sfMessageSource must be initialized using

Method Details

  • (array) & ($variant) Browse code

    $variant catalogue+variant.

    Loads the message for a particular catalogue+variant.

    This methods needs to implemented by subclasses.

    returns of translation messages.

  • append ($message) Browse code

    $message message to add

    Adds a untranslated message to the source. Need to call save()

    to save the messages to source.

  • (sfMessageSource) factory ($type, $source, $filename) Browse code

    $type the message source type.
    $source the location of the resource.
    $filename the filename of the custom message source.

    Factory method to instantiate a new sfMessageSource depending on the

    source type. The built-in source types are 'XLIFF', 'SQLite',
    'MySQL', 'gettext', and 'Aggregate'.
    The source parameter is dependent on the source type.
    For 'gettext' and 'XLIFF', it should point to the directory
    where the messages are stored. For database types, e.g. 'SQLite' and
    'MySQL', it should be a PEAR DB style DSN string.

    Custom message source are possible by supplying the a filename parameter
    in the factory method.

    returns a new message source of the specified type.

    throws sfException

  • (sfMessageCache) getCache () Browse code

    Gets the cache handler for this source.

    returns cache handler

  • (array) getCatalogueList ($catalogue) Browse code

    $catalogue catalogue name

    Gets all the variants of a particular catalogue.

    This method must be implemented by subclasses.

    returns list of all variants for this catalogue.

  • (string) getCulture () Browse code

    Gets the culture identifier for the source.

    returns culture identifier.

  • (int) getLastModified ($source) Browse code

    $source catalogue+variant

    Gets the last modified unix-time for this particular catalogue+variant.

    returns last modified in unix-time format.

  • (string) getSource ($variant) Browse code

    $variant catalogue+variant

    Gets the source, this could be a filename or database ID.

    returns the resource key

  • (boolean) isValidSource ($source) Browse code

    $source catalogue+variant

    Determines if the source is valid.

    returns true if valid, false otherwise.

  • (boolean) load ($catalogue) Browse code

    $catalogue a catalogue to load

    Loads a particular message catalogue. Use read() to

    to get the array of messages. The catalogue loading sequence
    is as follows:

    # [1] Call getCatalogueList($catalogue) to get a list of variants for for the specified $catalogue.
    # [2] For each of the variants, call getSource($variant) to get the resource, could be a file or catalogue ID.
    # [3] Verify that this resource is valid by calling isValidSource($source)
    # [4] Try to get the messages from the cache
    # [5] If a cache miss, call load($source) to load the message array
    # [6] Store the messages to cache.
    # [7] Continue with the foreach loop, e.g. goto [2].

    returns always true

  • (array) read () Browse code

    Gets the array of messages.

    returns translation messages.

  • setCache ($cache) Browse code

    $cache the cache handler.

    Sets the cache handler for caching the messages.

  • setCulture ($culture) Browse code

    $culture culture name

    Sets the culture for this message source.

  • __construct () Browse code

    Private constructor. sfMessageSource must be initialized using

    the factory method.