/**
  * @service language write
  * @return Gpf_Rpc_Action
  */
 public function saveFields(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setErrorMessage($this->_('Failed to save %s field(s)'));
     $action->setInfoMessage($this->_('%s field(s) successfully saved'));
     $language = new Gpf_Db_Language();
     $language->setId($action->getParam(Gpf_Db_Table_Languages::ID));
     $language->load();
     $csvFile = new Gpf_Io_Csv_Reader(Gpf_Lang_CsvLanguage::getAccountCsvFileName($language->getCode()));
     $csvLanguage = new Gpf_Lang_CsvLanguage();
     $csvLanguage->loadFromCsvFile($csvFile);
     $fields = new Gpf_Data_RecordSet();
     $fields->loadFromArray($action->getParam("fields"));
     foreach ($fields as $field) {
         $translation = new Gpf_Lang_Parser_Translation();
         $translation->setSourceMessage($field->get('id'));
         if ($csvLanguage->existTranslation($translation)) {
             $existingTranslation = $csvLanguage->getTranslation($translation);
             if ($existingTranslation->getStatus() == Gpf_Lang_Parser_Translation::STATUS_NOT_TRANSLATED) {
                 $existingTranslation->setStatus(Gpf_Lang_Parser_Translation::STATUS_TRANSLATED);
                 $csvLanguage->incrementTranslatedCount();
             }
             $existingTranslation->set($field->get("name"), $this->sourceCodeSpecialChars($field->get("value")));
         }
         $action->addOk();
     }
     $csvLanguage->exportAccountCache();
     $language->setTranslatedPercentage($csvLanguage->getTranslationPercentage());
     $language->save();
     return $action;
 }