/[drupal]/contributions/modules/l10n_server/l10n_community/export.inc
ViewVC logotype

Diff of /contributions/modules/l10n_server/l10n_community/export.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.15.2.16 by goba, Wed Nov 11 18:21:01 2009 UTC revision 1.1.2.15.2.17 by goba, Thu Nov 19 22:57:43 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: export.inc,v 1.1.2.15.2.15 2009/09/18 18:03:18 goba Exp $  // $Id: export.inc,v 1.1.2.15.2.16 2009/11/11 18:21:01 goba Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 62  function l10n_community_export_form(&$fo Line 62  function l10n_community_export_form(&$fo
62    else {    else {
63      $form['data']['project'] = array(      $form['data']['project'] = array(
64        '#title' => t('Project'),        '#title' => t('Project'),
65          '#required' => TRUE,
66      );      );
67      if (($count = count($projects)) <= 30) {      if (($count = count($projects)) <= 30) {
68        // Radio box widget for as much as 5 projects, select widget for 5-30 projects.        // Radio box widget for as much as 5 projects, select widget for 5-30 projects.
# Line 86  function l10n_community_export_form(&$fo Line 87  function l10n_community_export_form(&$fo
87      $form['data']['project']['#default_value'] = $projects[$uri]->title;      $form['data']['project']['#default_value'] = $projects[$uri]->title;
88    
89      $releases = l10n_community_get_releases($uri);      $releases = l10n_community_get_releases($uri);
90      $release_options = array('all' => t('All'));      $release_options = array('all' => t('All releases merged'));
91      foreach ($releases as $rid => $this_release) {      foreach ($releases as $rid => $this_release) {
92        $release_options[$rid] = $this_release->title;        $release_options[$rid] = t('@release only', array('@release' => $this_release->title));
93      }      }
94      $form['data']['release'] = array(      $form['data']['release'] = array(
95        '#title' => t('Release'),        '#title' => t('Release'),
96        '#type' => count($release_options) <= 3 ? 'radios' : 'select',        '#type' => count($release_options) <= 3 ? 'radios' : 'select',
97        '#options' => $release_options,        '#options' => $release_options,
98        '#default_value' => isset($release) ? $release : 'all',        '#default_value' => isset($release) ? $release : 'all',
       '#description' => t('Exporting with all releases is useful for translators, but is not optimal to use for end users because unused data would clutter up their database, when files get imported. Export for all releases if you would like to provide a complete translation, and you work with a desktop tool.'),  
99      );      );
100    }    }
101    if (isset($langcode) && isset($form['data']['release'])) {    if (isset($langcode) && isset($form['data']['release'])) {
# Line 113  function l10n_community_export_form(&$fo Line 113  function l10n_community_export_form(&$fo
113      $form['format']['type'] = array(      $form['format']['type'] = array(
114        '#title' => t('Type'),        '#title' => t('Type'),
115        '#type' => 'radios',        '#type' => 'radios',
116        '#options' => array('translation' => t('Translation'), 'template' => t('Translation template')),        '#options' => array('translation' => t('Include both English originals and translations'), 'template' => t('Just export English originals')),
117        '#default_value' => 'translation',        '#default_value' => 'translation',
       '#description' => t('Templates only contain the source (English) strings, translations are represented by empty placeholders.')  
118      );      );
119      $form['format']['version'] = array(      $form['format']['version'] = array(
120        '#title' => t('Format'),        '#title' => t('Packaging'),
121        '#type' => 'radios',        '#type' => 'radios',
122        '#options' => array('drupal-6' => t('Drupal 6 package format'), 'drupal-5' => t('Drupal 5 package format for autolocale module'), 'flat-package' => t('Flat package for CVS commit'), 'all-in-one' => t('All in one file')),        '#options' => array('drupal-6' => t('Drupal 6 package format (translations directories)'), 'drupal-5' => t('Drupal 5 package format (for autolocale module)'), 'flat-package' => t('Flat package for CVS commit (use for Drupal core)'), 'all-in-one' => t('All in one file')),
123        '#default_value' => 'drupal-6',        '#default_value' => 'drupal-6',
       '#description' => t("Drupal 5's autolocale module and Drupal 6 use different conventions for directory naming in packages. Temporarily, as long as you need to use CVS to distribute translations the flat package helps you generate a package for committing to Drupal.org. Additionally, for testing, spell checking and smaller modules, you can also export in one file without packaging as well. It is not advised to use big .po files for importing in Drupal though, as it might lead to incomplete imports. Use packages for usage with Drupal importing."),  
124      );      );
125      $form['format']['compact'] = array(      $form['format']['compact'] = array(
126        '#title' => t('Compact files'),        '#title' => t('Verbosity'),
127        '#description' => t('Compact files will not include the list of files being used to parse the translatable strings. Locations comments mentioning the filenames and line numbers are also skipped and translations are not separated by a newline. This saves a considerable amount of file size for distribution, but will not look nice if you would like to edit with a simple text editor.'),        '#type' => 'radios',
128        '#type' => 'checkbox',        '#options' => array(0 => t('Verbose files useful for desktop translation'), 1 => t('Compact files optimized for size, not desktop editing')),
129        '#default_value' => 0,        '#default_value' => 0,
130      );      );
131    }    }
# Line 142  function l10n_community_export_form(&$fo Line 140  function l10n_community_export_form(&$fo
140   * Release field is mandatory.   * Release field is mandatory.
141   */   */
142  function l10n_community_export_form_validate($form, &$form_state) {  function l10n_community_export_form_validate($form, &$form_state) {
143    if (empty($form_state['values']['project'])) {    if (!$project = l10n_community_project_uri_by_title($form_state['values']['project'])) {
144      form_set_error('project', t('You should choose a project, submit the form and choose a release.'));      form_set_error('project', t('Invalid project selected.'));
   }  
   elseif (!$project = l10n_community_project_uri_by_title($form_state['values']['project'])) {  
     form_set_error('project', t('Invalid project chosen.'));  
145      $form_state['values']['project'] = '';      $form_state['values']['project'] = '';
146    }    }
147  }  }

Legend:
Removed from v.1.1.2.15.2.16  
changed lines
  Added in v.1.1.2.15.2.17

  ViewVC Help
Powered by ViewVC 1.1.3