/**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     require_once dirname(__FILE__) . '/../../../config/ProjectConfiguration.class.php';
     $configuration = ProjectConfiguration::getApplicationConfiguration('public', 'prod', true);
     sfContext::createInstance($configuration);
     $liveLang = $arguments['live_lang'];
     $langToDeploy = $arguments['lang_to_deploy'];
     $liveLangs = SfConfig::get('app_site_langs');
     $langsUnderDev = SfConfig::get('app_site_langsUnderDev');
     if (in_array($liveLang, $liveLangs) === false) {
         die("The live lang doesn't seem to be live!");
     }
     if (in_array($langToDeploy, $langsUnderDev) === false) {
         die("You can deploy only a language under development");
     }
     $c = new Criteria();
     $c->add(PcTranslationPeer::LANGUAGE_ID, $langToDeploy);
     $translationsToDeploy = PcTranslationPeer::doSelect($c);
     $i = 0;
     foreach ($translationsToDeploy as $translationToDeploy) {
         $this->log("Deploying the string " . $translationToDeploy->getStringId() . " from {$langToDeploy} to {$liveLang}");
         $liveTranslation = PcTranslationPeer::retrieveByPK($liveLang, $translationToDeploy->getStringId());
         $liveTranslation->setString($translationToDeploy->getString())->save();
         $translationToDeploy->delete();
         $i++;
     }
     $this->log("All done. {$i} strings deployed.");
 }
 function __($stringId)
 {
     if (!defined('PLANCAKE_PUBLIC_RELEASE')) {
         $lang = PcLanguagePeer::getUserPreferredLanguage()->getId();
         $key = '';
         if ($cache = PcCache::getInstance()) {
             $key = PcCache::generateKeyForTranslation($lang, $stringId);
             if ($cache->has($key)) {
                 return $cache->get($key);
             }
         }
         $translation = PcTranslationPeer::retrieveByPK($lang, $stringId);
         if (!is_object($translation) || !strlen(trim($translation->getString())) > 0) {
             $translation = PcTranslationPeer::retrieveByPK(SfConfig::get('app_site_defaultLang'), $stringId);
         }
         if (!$translation) {
             throw new Exception("Couldn't find the string {$stringId} for the language {$lang}");
         }
         $ret = $translation->getString();
         if ($cache) {
             $cache->set($key, $ret);
         }
     } else {
         global $pc_lang;
         if (!array_key_exists($stringId, $pc_lang)) {
             throw new Exception("Couldn't find the string {$stringId}");
         }
         $ret = $pc_lang[$stringId];
     }
     return $ret;
 }