1 |
85ad3d82
|
Assos Assos
|
<?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 |
|
|
'access' => 'administer filters',
|
23 |
|
|
'description' => t('The translation system only translates strings with the selected text formats. All other strings will be ignored and removed from the list of translatable strings.'),
|
24 |
|
|
);
|
25 |
|
|
$variables['i18n_string_source_language'] = array(
|
26 |
|
|
'title' => t('Source language'),
|
27 |
|
|
'type' => 'language',
|
28 |
|
|
'default callback' => 'i18n_string_source_language',
|
29 |
|
|
'description' => t('Language that will be used as the source language for string translations. The default is the site default language.'),
|
30 |
|
|
);
|
31 |
|
|
$variables['i18n_string_debug'] = array(
|
32 |
|
|
'type' => 'enable',
|
33 |
|
|
'title' => t('Debug string translation', array(), $options),
|
34 |
|
|
'default' => 0,
|
35 |
|
|
'group' => 'debug',
|
36 |
|
|
);
|
37 |
|
|
return $variables;
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
/**
|
41 |
|
|
* Options callback, format list
|
42 |
|
|
*/
|
43 |
|
|
function i18n_string_variable_format_list() {
|
44 |
|
|
$list = array();
|
45 |
|
|
// As the user has administer filters permissions we get a full list here
|
46 |
|
|
foreach (filter_formats() as $fid => $format) {
|
47 |
|
|
$list[$fid] = $format->name;
|
48 |
|
|
}
|
49 |
|
|
return $list;
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
/**
|
53 |
|
|
* Allowed formats default value
|
54 |
|
|
*/
|
55 |
|
|
function i18n_string_variable_format_default() {
|
56 |
|
|
return array(filter_fallback_format());
|
57 |
|
|
} |