You are here

function gtranslate_admin in Translate Drupal with GTranslate 6

Same name and namespace in other branches
  1. 7 gtranslate.module \gtranslate_admin()
1 string reference to 'gtranslate_admin'
gtranslate_menu in ./gtranslate.module

File

./gtranslate.module, line 368

Code

function gtranslate_admin() {
  $languages = array(
    'en' => 'English',
    'ar' => 'Arabic',
    'bg' => 'Bulgarian',
    'zhCN' => 'Chinese (Simplified)',
    'zhTW' => 'Chinese (Traditional)',
    'hr' => 'Croatian',
    'cs' => 'Czech',
    'da' => 'Danish',
    'nl' => 'Dutch',
    'fi' => 'Finnish',
    'fr' => 'French',
    'de' => 'German',
    'el' => 'Greek',
    'hi' => 'Hindi',
    'it' => 'Italian',
    'ja' => 'Japanese',
    'ko' => 'Korean',
    'no' => 'Norwegian',
    'pl' => 'Polish',
    'pt' => 'Portuguese',
    'ro' => 'Romanian',
    'ru' => 'Russian',
    'es' => 'Spanish',
    'sv' => 'Swedish',
    'ca' => 'Catalan',
    'tl' => 'Filipino',
    'iw' => 'Hebrew',
    'id' => 'Indonesian',
    'lv' => 'Latvian',
    'lt' => 'Lithuanian',
    'sr' => 'Serbian',
    'sk' => 'Slovak',
    'sl' => 'Slovenian',
    'uk' => 'Ukrainian',
    'vi' => 'Vietnamese',
    'sq' => 'Albanian',
    'et' => 'Estonian',
    'gl' => 'Galician',
    'hu' => 'Hungarian',
    'mt' => 'Maltese',
    'th' => 'Thai',
    'tr' => 'Turkish',
    'fa' => 'Persian',
    'af' => 'Afrikaans',
    'ms' => 'Malay',
    'sw' => 'Swahili',
    'ga' => 'Irish',
    'cy' => 'Welsh',
    'be' => 'Belarusian',
    'is' => 'Icelandic',
    'mk' => 'Macedonian',
    'yi' => 'Yiddish',
    'hy' => 'Armenian',
    'az' => 'Azerbaijani',
    'eu' => 'Basque',
    'ka' => 'Georgian',
    'ht' => 'Haitian Creole',
    'ur' => 'Urdu',
  );

  // Move the default language to the first position and sort
  asort($languages);
  $languages = array_merge(array(
    variable_get('gtranslate_main_lang', 'en') => $languages[variable_get('gtranslate_main_lang', 'en')],
  ), $languages);
  $form['general'] = array(
    '#type' => 'fieldset',
    '#title' => t('General Configuration'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['general']['gtranslate_method'] = array(
    '#type' => 'radios',
    '#title' => t('Translation Method'),
    '#default_value' => variable_get('gtranslate_method', 'onfly'),
    '#options' => array(
      'google-default' => 'Google Default',
      'redirect' => 'Redirect',
      'onfly' => 'On Fly',
    ),
    '#description' => t("Select which method shall be used when translating the page. On Fly method will show flags and make the translation on the fly without any redirects. Google Default will show only a dropdown provided by Google and it will translate the page on the fly, but you cannot configure it's appearance. Redirect method will redirect the visitor to the translated page. It requires your site to be online, localhost will not work. If the Pro version is installed it will use SEF URLs and keep the visitor on your domain, also it can work on localhost."),
    '#required' => TRUE,
  );
  $form['general']['gtranslate_pro'] = array(
    '#type' => 'checkbox',
    '#title' => t('Operate with Pro version'),
    '#default_value' => variable_get('gtranslate_pro', 0),
    '#description' => t("If you have Pro version installed you need to check this box. Find out more on <a href=http://gtranslate.net/?xyz=1002 target=_blank>http://gtranslate.net</a>"),
  );
  $form['general']['gtranslate_enterprise'] = array(
    '#type' => 'checkbox',
    '#title' => t('Operate with Enterprise version'),
    '#default_value' => variable_get('gtranslate_enterprise', 0),
    '#description' => t("If you have Enterprise version configured you need to check this box. Find out more on <a href=http://gtranslate.net/?xyz=1002 target=_blank>http://gtranslate.net</a>"),
  );
  $form['general']['gtranslate_analytics'] = array(
    '#type' => 'checkbox',
    '#title' => t('Analytics'),
    '#default_value' => variable_get('gtranslate_analytics', 0),
    '#description' => t("If you have Google Analytics new code on your site (_gaq). You can enable this which will allow you to see translation events in Google Analytics -&gt; Content -&gt; Event Tracking. Note: Will not work if you use Google Default translation method."),
  );
  $form['general'][''] = array(
    '#type' => 'markup',
    '#value' => '<h3>Tour Video</h3>
            <iframe src="http://player.vimeo.com/video/30132555?title=1&amp;byline=0&amp;portrait=0" width="568" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
            <p>If you would like to <i>edit translations manually</i> and have <i>SEF URLs</i> (http://domain.com<u>/es/</u>, http://domain.com<u>/fr/</u>, http://domain.com<u>/it/</u>, etc.) for translated languages or you want your <i>translated pages to be indexed</i> in search engines to <i>increase international traffic</i> you may consider <a href="http://gtranslate.net/features?xyz=1002" target="_blank">GTranslate Pro</a> version.</p>
            <h3>Translation Delivery Network</h3>
            <iframe src="http://player.vimeo.com/video/38686858?title=1&amp;byline=0&amp;portrait=0" width="568" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
            <p>If you would like to use our next generation <i>cloud service</i> which will allow you to <i>host your languages</i> on top level country domain name (ccTLD) to <i>rank higher</i> on local search engines results you may consider <a href="http://gtranslate.net/features?xyz=1002" target="_blank">GTranslate Enterprise</a> a <a href="http://gtranslate.net/translation-delivery-network" target="_blank">Translation Delivery Network</a>. In that case for example for Spanish you can have <u>es.domain.com</u> or <u>domain.es</u> if you own it.</p>',
  );
  $form['appearance'] = array(
    '#type' => 'fieldset',
    '#title' => t('Appearance Configuration'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['appearance']['gtranslate_look'] = array(
    '#type' => 'select',
    '#title' => t('Look'),
    '#default_value' => variable_get('gtranslate_look', 'both'),
    '#size' => 1,
    '#options' => array(
      'both' => 'Both',
      'flags' => 'Flags',
      'dropdown' => 'Dropdown list',
    ),
    '#description' => t("Select the look of the module."),
    '#required' => TRUE,
  );
  $form['appearance']['gtranslate_flag_size'] = array(
    '#type' => 'radios',
    '#title' => t('Flag Size'),
    '#default_value' => variable_get('gtranslate_flag_size', '16'),
    '#options' => array(
      '16' => '16',
      '24' => '24',
      '32' => '32',
    ),
    '#description' => t("Select the flag size in pixels."),
    '#required' => TRUE,
  );
  $form['appearance']['gtranslate_new_window'] = array(
    '#type' => 'checkbox',
    '#title' => t('Open translated page in a new window'),
    '#default_value' => variable_get('gtranslate_new_window', 0),
    '#description' => t("The translated page will appear in a new window."),
  );
  $form['language'] = array(
    '#type' => 'fieldset',
    '#title' => t('Language Configuration'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['language']['gtranslate_main_lang'] = array(
    '#type' => 'select',
    '#title' => t('Main Language'),
    '#default_value' => variable_get('gtranslate_main_lang', 'en'),
    '#size' => 1,
    '#options' => $languages,
    '#description' => t("Your sites main language"),
    '#required' => TRUE,
  );
  $languages_flags = array(
    'en',
    'fr',
    'de',
    'it',
    'pt',
    'ru',
    'es',
  );
  foreach ($languages as $lang => $language) {
    $form['language']["gtranslate_{$lang}"] = array(
      '#type' => 'radios',
      '#title' => t("Show {$language}"),
      '#default_value' => variable_get("gtranslate_{$lang}", in_array($lang, $languages_flags) ? 2 : 1),
      '#options' => array(
        1 => 'Yes',
        0 => 'No',
        2 => 'As a flag',
      ),
      '#description' => t("Show {$language} in the language list"),
      '#required' => TRUE,
    );
  }
  return system_settings_form($form);
}