Issue #1170850: Fixed switching default language changes source language. Added varia...
[project/i18n.git] / i18n_string / i18n_string.variable.inc
1 <?php
2 /**
3 * @file
4 * Variable information
5 */
6
7 /**
8 * Implements hook_variable_info().
9 */
10 function i18n_string_variable_info($options = array()) {
11 $variables['i18n_string_translate_langcode_[language]'] = array(
12 'type' => 'multiple_language',
13 'title' => t('Enable translation for language'),
14 'multiple values' => array('type' => 'boolean'),
15 'group' => 'i18n',
16 );
17 $variables['i18n_string_allowed_formats'] = array(
18 'title' => t('Translatable text formats'),
19 'options callback' => 'i18n_string_variable_format_list',
20 'type' => 'options',
21 'default callback' => 'i18n_string_variable_format_default',
22 'description' => t('Only the strings that have the text formats selected will be allowed by the translation system. All the others will be deleted next time the strings are refreshed.'),
23 );
24 $variables['i18n_string_source_language'] = array(
25 'title' => t('Source language'),
26 'type' => 'language',
27 'default callback' => 'i18n_string_source_language',
28 'description' => t('Language that will be used as the source language for string translations. The default is the site default language.'),
29 );
30 $variables['i18n_string_debug'] = array(
31 'type' => 'enable',
32 'title' => t('Debug string translation', array(), $options),
33 'default' => 0,
34 'group' => 'debug',
35 );
36 return $variables;
37 }
38
39 /**
40 * Options callback, format list
41 */
42 function i18n_string_variable_format_list() {
43 $list = array();
44 // As the user has administer filters permissions we get a full list here
45 foreach (filter_formats() as $fid => $format) {
46 $list[$fid] = $format->name;
47 }
48 return $list;
49 }
50
51 /**
52 * Allowed formats default value
53 */
54 function i18n_string_variable_format_default() {
55 return array(filter_fallback_format());
56 }