• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

plugins/views_plugin_localization_core.inc

Go to the documentation of this file.
00001 <?php
00002 
00013 class views_plugin_localization_core extends views_plugin_localization {
00014 
00026   function translate_string($string, $keys = array(), $format = '') {
00027     return t($string);
00028   }
00029 
00041   function save_string($string, $keys = array(), $format = '') {
00042     global $language;
00043 
00044     // If the current language is 'en', we need to reset the language
00045     // in order to trigger an update.
00046     // TODO: add test for number of languages.
00047     if ($language->language == 'en') {
00048       $changed = TRUE;
00049       $languages = language_list();
00050       $cached_language = $language;
00051       unset($languages['en']);
00052       if (!empty($languages)) {
00053         $language = current($languages);
00054       }
00055     }
00056 
00057     t($string);
00058 
00059     if (isset($cached_language)) {
00060       $language = $cached_language;
00061     }
00062     return TRUE;
00063   }
00064 
00073   function delete($source) {
00074     return FALSE;
00075   }
00076 
00085   function export($source) {
00086     if (!empty($source['value'])) {
00087       $this->export_strings[] = $source['value'];
00088     }
00089   }
00090 
00097   function export_render($indent = '  ') {
00098     $output = '';
00099     if (!empty($this->export_strings)) {
00100       $this->export_strings = array_unique($this->export_strings);
00101       $output = $indent . '$translatables[\'' . $this->view->name . '\'] = array(' . "\n";
00102       foreach ($this->export_strings as $string) {
00103         $output .= $indent . "  t('" . str_replace("'", "\'", $string) . "'),\n";
00104       }
00105       $output .= $indent . ");\n";
00106     }
00107     return $output;
00108   }
00109 }

Generated on Sun Feb 26 2012 12:52:52 for Views by  doxygen 1.7.1