symfony API

sfIMessageSource Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.0 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.0 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfIMessageSource interface.

Method Summary

  • void append()
    Adds a untranslated message to the source. Need to call save()
  • array catalogues()
    Returns a list of catalogue as key and all it variants as value.
  • boolean delete(, )
    Deletes a particular message from the specified catalogue.
  • string getCulture()
    Get the culture identifier for the source.
  • boolean load()
    Loads the translation table for this particular catalogue.
  • array read()
    Gets the translation table. This includes all the loaded sections.
  • boolean save()
    Saves the list of untranslated blocks to the translation source.
  • setCulture()
    Set the culture for this particular message source.
  • boolean update(, , , )
    Updates the translation.

Method Details

  • (void) append () Browse code

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

    to save the messages to source.

  • (array) catalogues () Browse code

    Returns a list of catalogue as key and all it variants as value.

    returns list of catalogues

  • (boolean) delete (, ) Browse code

    Deletes a particular message from the specified catalogue.

    returns true if deleted, false otherwise.

  • (string) getCulture () Browse code

    Get the culture identifier for the source.

    returns culture identifier.

  • (boolean) load () Browse code

    Loads the translation table for this particular catalogue.

    The translation should be loaded in the following order.
    # [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 true if loaded, false otherwise.

  • (array) read () Browse code

    Gets the translation table. This includes all the loaded sections.

    It must return a 2 level array of translation strings.
    # "catalogue+variant" the catalogue and its variants.
    # "source string" translation keys, and its translations.

    array('catalogue+variant' =>
    array('source string' => 'target string', ...)
    ...),
    ...);

    returns 2 level array translation table.

  • (boolean) save () Browse code

    Saves the list of untranslated blocks to the translation source.

    If the translation was not found, you should add those
    strings to the translation source via the append() method.

    returns true if saved successfuly, false otherwise.

  • setCulture () Browse code

    Set the culture for this particular message source.

  • (boolean) update (, , , ) Browse code

    Updates the translation.

    returns true if translation was updated, false otherwise.