@jeffreycahyono
We have some initial thoughts regarding this component which will be introduced in 2.0 if not sooner (time and workload permitting). We will of course discuss it with the community before we move ahead so as to find the best solution that would suit the majority if not all of the community.
At the moment the way we are envisioning this is as follows:
Every string that is echoed from the framework will have a unique key. The keys will be made public to the developer. So for instance at the moment you might get a message
Action not defined in CommonController
This internally, right now, is echoed as is. However with the new functionality it will be a key to a key/value array i.e.
echo phrases['action_not_defined']
(writing pseudo code here)
The developer will be able to use the new component (which we have yet to name) available through the DI container as follows
$phrases = new \Phalcon\Phrases()
$phrases->set('action_not_defined", "What are you doing? Forgot something didn't you?");
which will then echo the appropriate message.
We are also thinking of helper functions such as:
$phrases->reset() // resets all strings to their default (English)
$phrases->reset(string/array) // resets string or array of strings to the defaults
$phrases->list() // Offers a json list of all the key/value pairs
$phrases->get(key) // Gets the text of a key.
Note that these are just initial thoughts and we will definitely discuss this with the community prior to implementation. The above is a rough draft of what we are thinking of. Implementing this as is (procedural/stand alone component) would be OK but we are also thinking of hooking up interfaces to this so that (as Jeffrey pointed above) they can be extended at will.