added string and field translation table for translators
This commit is contained in:
@@ -64,7 +64,7 @@ select.form-select:disabled {
|
||||
border-width: 0px;
|
||||
border-style: solid;
|
||||
border-color: none;
|
||||
background: #fff;
|
||||
background: #f0f0f0;
|
||||
color: #1A1A1A;
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -84,6 +84,17 @@ select.form-select:focus:disabled {
|
||||
border-color: #fff;
|
||||
box-shadow: #fff 0 0 0px;
|
||||
}
|
||||
#i18n-string-locale-translate-edit-form {
|
||||
position: relative;
|
||||
}
|
||||
#i18n-string-locale-translate-edit-form #edit-original {
|
||||
font-size: 1.2em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
#i18n-string-locale-translate-edit-form .form-item.form-type-textarea {
|
||||
width: 24%;
|
||||
display: inline-block;
|
||||
}
|
||||
span.autocomplete-deluxe-button {
|
||||
top: 0.25em;
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ select.form-select:disabled{
|
||||
border-width:0px;
|
||||
border-style:solid;
|
||||
border-color:none;
|
||||
background:#fff;
|
||||
background:#f0f0f0;
|
||||
color:#1A1A1A;
|
||||
max-width:100%;
|
||||
}
|
||||
@@ -89,6 +89,17 @@ select.form-select:focus:disabled{
|
||||
box-shadow: #fff 0 0 0px;
|
||||
}
|
||||
|
||||
#i18n-string-locale-translate-edit-form{
|
||||
position: relative;
|
||||
#edit-original{
|
||||
font-size: 1.2em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.form-item.form-type-textarea{
|
||||
width:24%; display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
span.autocomplete-deluxe-button{top:0.25em;}
|
||||
|
||||
|
@@ -96,21 +96,21 @@ function guibik_preprocess_page(&$vars) {
|
||||
}
|
||||
|
||||
function guibik_preprocess_html(&$vars){
|
||||
|
||||
|
||||
$heads['icon'] = array(
|
||||
'#tag' => 'link',
|
||||
'#attributes' => array(
|
||||
'href' => base_path() . path_to_theme() .'/icon.png',
|
||||
'href' => base_path() . path_to_theme() .'/icon.png',
|
||||
'rel' => 'shortcut icon',
|
||||
'type' => 'image/png',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
$heads['apple-touch-icon'] = array(
|
||||
'#tag' => 'link',
|
||||
'#attributes' => array(
|
||||
'href' => base_path() . path_to_theme() .'/apple-touch-icon.png',
|
||||
'href' => base_path() . path_to_theme() .'/apple-touch-icon.png',
|
||||
'rel' => 'apple-touch-icon',
|
||||
),
|
||||
);
|
||||
@@ -124,7 +124,7 @@ function guibik_preprocess_views_view_table(&$vars){
|
||||
if($vars['title'] != ''){
|
||||
$vars['classes_array'][] = 'has-caption';
|
||||
}
|
||||
// dsm($vars);
|
||||
// dsm($vars);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,7 +134,7 @@ function OUT_guibik_form_element($variables) {
|
||||
$element = &$variables['element'];
|
||||
// This is also used in the installer, pre-database setup.
|
||||
$t = get_t();
|
||||
|
||||
|
||||
//dsm($element);
|
||||
|
||||
// This function is invoked as theme wrapper, but the rendered form element
|
||||
@@ -150,7 +150,7 @@ function OUT_guibik_form_element($variables) {
|
||||
// Add element's #type and #name as class to aid with JS/CSS selectors.
|
||||
if(!isset($element["#attributes"]['class']))
|
||||
$element["#attributes"]['class'] = array();
|
||||
|
||||
|
||||
$attributes['class'] = $element["#attributes"]['class'] + array('form-item');
|
||||
if (!empty($element['#type'])) {
|
||||
$attributes['class'][] = 'form-type-' . strtr($element['#type'], '_', '-');
|
||||
@@ -218,8 +218,79 @@ function guibik_field_widget_form_alter(&$element, &$form_state, $context) {
|
||||
foreach ($element as $delta => $item) {
|
||||
if(!isset($element[$delta]['#process']) || !is_array($element[$delta]['#process']))
|
||||
continue;
|
||||
|
||||
|
||||
$element[$delta]['#process'][] = "guibik_image_field_widget_process";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Theme function for the translation table.
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
function guibik_translation_table($variables) {
|
||||
$form = $variables['form'];
|
||||
$rows = array();
|
||||
$header = $form['header']['#value'];
|
||||
$languages = $form['languages']['#value'];
|
||||
|
||||
foreach (element_children($form['strings']) as $key) {
|
||||
// Build the table row.
|
||||
$row = array();
|
||||
$row['data'][] = array('data' => drupal_render($form['strings'][$key]['source']), 'class' => 'translation-source');
|
||||
|
||||
foreach ($languages as $lang_code => $lang_name) {
|
||||
$row['data'][] = array('data' => drupal_render($form['strings'][$key][$lang_code]), 'class' => 'translation-'. $lang_code);
|
||||
};
|
||||
$location = explode(':', $form['strings'][$key]['location']['#value']);
|
||||
if (count($location) == 4) {
|
||||
switch ($location[1]) {
|
||||
case 'term':
|
||||
$row['data'][] = l(t('Edit source'), 'admin/content/taxonomy/edit/term/'. $location[1], array('attributes' => array('title' => t('Edit term (@property)', array('@property' => t($location[2]))))));
|
||||
break;
|
||||
|
||||
case 'vocabulary':
|
||||
$row['data'][] = l(t('Edit source'), 'admin/content/taxonomy/edit/vocabulary/'. $location[1], array('attributes' => array('title' => t('Edit vocabulary (@property)', array('@property' => t($location[2]))))));
|
||||
break;
|
||||
|
||||
case 'item':
|
||||
$row['data'][] = l(t('Edit source'), 'admin/build/menu/item/'. $location[1] .'/edit', array('attributes' => array('title' => t('Edit menu item (@property)', array('@property' => t($location[2]))))));
|
||||
break;
|
||||
|
||||
case 'type':
|
||||
$node_types = node_type_get_names();
|
||||
$node_type = isset($node_types[$location[1]]) ? $node_types[$location[1]] : $location[1];
|
||||
$row['data'][] = l(t('Edit source'), 'admin/content/node-type/'. $location[1], array('attributes' => array('title' => t('Edit @node_type (@property)', array('@node_type' => $node_type, '@property' => t($location[2]))))));
|
||||
break;
|
||||
|
||||
default:
|
||||
$row['data'][] = '';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$row['data'][] = '';
|
||||
}
|
||||
$row['data'][] = l(t('Translate'), 'admin/config/regional/translate/edit/'. $key);
|
||||
if(user_access('delete_strings'))
|
||||
$row['data'][] = l(t('Delete string'), 'admin/config/regional/translate/delete/'. $key);
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$output = theme('table', array(
|
||||
'header' => $header,
|
||||
'rows' => $rows,
|
||||
'attributes' => array('id' => 'translation-table')
|
||||
));
|
||||
|
||||
if ($form['pager']['#markup']) {
|
||||
$output .= drupal_render($form['pager']);
|
||||
}
|
||||
$output .= drupal_render_children($form);
|
||||
|
||||
drupal_add_css(drupal_get_path('module', 'translation_table') .'/css/translation-table-admin.css');
|
||||
return $output;
|
||||
}
|
||||
|
Reference in New Issue
Block a user