Take a look at:
symfony/lib/plugins/sfPropelPlugin/lib/propel/sfPropel.class.php
class sfPropel
{
static protected
$initialized = false,
$defaultCulture = 'en';
static public function initialize(sfEventDispatcher $dispatcher,
$culture = null)
{
$dispatcher->connect('user.change_culture', array('sfPropel',
'listenToChangeCultureEvent'));
if (!is_null($culture))
{
self::setDefaultCulture($culture);
}
else if (class_exists('sfContext', false) &&
sfContext::hasInstance() && $user = sfContext::getInstance()-
>getUser())
{
self::setDefaultCulture($user->getCulture());
}
self::$initialized = true;
}
static public function setDefaultCulture($culture)
{
self::$defaultCulture = $culture;
}
static public function getDefaultCulture()
{
if (!self::$initialized && class_exists('sfProjectConfiguration',
false))
{
self::initialize(sfProjectConfiguration::getActive()-
>getEventDispatcher());
}
return self::$defaultCulture;
}
/**
* Listens to the user.change_culture event.
*
* @param sfEvent An sfEvent instance
*
*/
static public function listenToChangeCultureEvent(sfEvent $event)
{
self::setDefaultCulture($event['culture']);
}
...
}
On 16 Wrz, 19:59, "Jonathan Wage" <[EMAIL PROTECTED]> wrote:
> Can you show me some code of how propel does it?
>
> - Jon
>
> On Tue, Sep 16, 2008 at 4:22 AM, Lucjan Wilczewski <
>
>
>
>
>
> [EMAIL PROTECTED]> wrote:
>
> > Now this change is introduced, and my homemade solution doesn't work
> > anymore ;) , I would like to ask if there is other way to set
> > currentCulture other than calling setCurrentCulture explicitly before
> > any get/set calls on record? (sfPropel had it handled by connecting
> > with user.change_culture event a method that did the change on static
> > $defaultCulture).
>
> > On 11 Wrz, 13:36, "Jonathan Wage" <[EMAIL PROTECTED]> wrote:
> > > I believe the symfony trac uses components for this. I have updated the
> > > ticket and assigned it to the sfDoctrinePlugin component.
>
> > > - Jon
>
> > > On Thu, Sep 11, 2008 at 3:26 AM, Thomas Rabaix <[EMAIL PROTECTED]
> > >wrote:
>
> > > > done,http://trac.symfony-project.org/ticket/4357
>
> > > > However there is no category sfDoctrinePlugin in the ticket system.
>
> > > > Thomas
>
> > > > On Wed, Sep 10, 2008 at 9:33 PM, Jonathan Wage <[EMAIL PROTECTED]>
> > wrote:
> > > > > Create a ticket in the symfony-project trac and we can implement this
> > in
> > > > an
> > > > > upcoming version of sfDoctrinePlugin.
>
> > > > > - Jon
>
> > > > > On Wed, Sep 10, 2008 at 8:51 AM, Thomas Rabaix <
> > [EMAIL PROTECTED]>
> > > > > wrote:
>
> > > > >> Hello,
>
> > > > >> Doctrine does not seems to have a transparent way to access to i18n
> > > > >> field like Propel. And it looks odd to write in the template
> > > > >> <?php echo $myI18nModel->Translation['FR']->get('name') ?> as it
> > > > >> suppose to keep the culture ...
>
> > > > >> $myI18n->getName() , it nicier ...
>
> > > > >> Not sure it is a bug or a normal behavior, so I have written a small
> > > > >> wrapper to do so :http://pastebin.com/f4075e78a
>
> > > > >> I can open a ticket if necessary.
>
> > > > >> --
> > > > >> Thomas Rabaix
> > > > >> Internet Consultant
>
> > > > > --
> > > > > Jonathan H. Wage
> > > > > Open Source Software Developer & Evangelist
> > > > >http://www.jwage.com
>
> > > > --
> > > > Thomas Rabaix
> > > > Internet Consultant
>
> > > --
> > > Jonathan H. Wage
> > > Open Source Software Developer & Evangelisthttp://www.jwage.com
>
> --
> Jonathan H. Wage
> Open Source Software Developer & Evangelisthttp://www.jwage.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---