-
| $variant |
catalogue+variant. |
Loads the message for a particular catalogue+variant.
This methods needs to implemented by subclasses.
returns of translation messages.
-
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', 'Creole' 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
-
Gets the array of messages.
returns translation messages.
-
| $cache |
the cache handler. |
Sets the cache handler for caching the messages.
-
Sets the culture for this message source.
-
Private constructor. sfMessageSource must be initialized using
the factory method.