summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhass2008-10-03 11:32:24 (GMT)
committer hass2008-10-03 11:32:24 (GMT)
commit98f49db344732f89307ab7dfebc0185e62faffe5 (patch)
treec6c94db382fb8d574e952fb7f5a57548fed32605
parentac10f55407e20de1eee98974f371606d04fb09dc (diff)
Code style fixes
-rw-r--r--i18n.admin.inc2
-rw-r--r--i18n.install7
-rw-r--r--i18n.module383
-rw-r--r--i18nblocks/i18nblocks.install31
-rw-r--r--i18nblocks/i18nblocks.module18
-rw-r--r--i18ncontent/i18ncontent.install2
-rw-r--r--i18ncontent/i18ncontent.module14
-rw-r--r--i18nmenu/i18nmenu.module16
-rw-r--r--i18npoll/i18npoll.module2
-rw-r--r--i18nprofile/i18nprofile.install5
-rw-r--r--i18nprofile/i18nprofile.module16
-rw-r--r--i18nstrings/i18nstrings.admin.inc6
-rw-r--r--i18nstrings/i18nstrings.module50
-rw-r--r--i18nsync/i18nsync.module34
-rw-r--r--i18ntaxonomy/i18ntaxonomy.admin.inc13
-rw-r--r--i18ntaxonomy/i18ntaxonomy.module53
-rw-r--r--i18ntaxonomy/i18ntaxonomy.pages.inc4
-rw-r--r--i18nviews/i18nviews.module6
18 files changed, 350 insertions, 312 deletions
diff --git a/i18n.admin.inc b/i18n.admin.inc
index 4388760..59d19a0 100644
--- a/i18n.admin.inc
+++ b/i18n.admin.inc
@@ -33,7 +33,7 @@ function i18n_admin_settings() {
}
// List of selection modes
-function _i18n_selection_mode(){
+function _i18n_selection_mode() {
return array(
'simple' => t('Current language and language neutral.'),
'mixed' => t('Mixed current language (if available) or default language (if not) and language neutral.'),
diff --git a/i18n.install b/i18n.install
index f6919a0..c60fc8c 100644
--- a/i18n.install
+++ b/i18n.install
@@ -58,8 +58,8 @@ function i18n_uninstall() {
function i18n_update_9() {
// Update content type settings
foreach (array_keys(node_get_types()) as $type) {
- if (variable_get('i18n_node_'.$type, 0)) {
- variable_set('language_content_type_'.$type, TRANSLATION_ENABLED);
+ if (variable_get('i18n_node_'. $type, 0)) {
+ variable_set('language_content_type_'. $type, TRANSLATION_ENABLED);
}
}
// General language settings
@@ -98,5 +98,4 @@ function i18n_update_10() {
variable_del('i18n_translation_links');
variable_del('i18n_translation_node_links');
return $items;
-}
-*/ \ No newline at end of file
+}*/ \ No newline at end of file
diff --git a/i18n.module b/i18n.module
index 2cc46e1..24b53ae 100644
--- a/i18n.module
+++ b/i18n.module
@@ -19,21 +19,21 @@ define('LANGUAGE_SUPPORT_NORMAL', 1);
define('LANGUAGE_SUPPORT_EXTENDED', 2);
/**
- * Implementation of hook_init()
+ * Implementation of hook_init().
*
- * Will initialize language dependent variables
- * Modify rewriting conditions when viewing specific nodes
+ * Will initialize language dependent variables.
+ * Modify rewriting conditions when viewing specific nodes.
*
- * Special fix for site_frontpage, that may have been used before the language variables are loaded
+ * Special fix for site_frontpage, that may have been used before the language variables are loaded.
*/
-function i18n_init(){
- // If not in bootstrap, variable init
- if(!_i18n_is_bootstrap()){
+function i18n_init() {
+ // If not in bootstrap, variable init.
+ if (!_i18n_is_bootstrap()) {
$default_frontpage = variable_get('site_frontpage', 'node');
i18n_variable_init();
- // Now we check whether this is the frontpage and it should be a different one
+ // Now we check whether this is the frontpage and it should be a different one.
if ($default_frontpage != variable_get('site_frontpage', 'node') && $_GET['q'] == drupal_get_normal_path($default_frontpage)) {
$_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node'));
}
@@ -46,26 +46,26 @@ function i18n_init(){
function i18n_help($path = 'admin/help#i18n', $arg) {
switch ($path) {
case 'admin/help#i18n' :
- $output = '<p>' . t('This module improves support for multilingual content in Drupal sites:') . '</p>';
+ $output = '<p>'. t('This module improves support for multilingual content in Drupal sites:') .'</p>';
$output .= '<ul>';
- $output .= '<li>' . t('Shows content depending on page language') . '</li>';
- $output .= '<li>' . t('Handles multilingual variables') . '</li>';
- $output .= '<li>' . t('Extended language option for chosen content types. For these content types transations will be allowed for all defined languages, not only for enabled ones.') . '</li>';
- $output .= '<li>' . t('Provides a block for language selection and two theme functions: <i>i18n_flags</i> and <i>i18n_links</i>') . '</li>';
+ $output .= '<li>'. t('Shows content depending on page language') .'</li>';
+ $output .= '<li>'. t('Handles multilingual variables') .'</li>';
+ $output .= '<li>'. t('Extended language option for chosen content types. For these content types transations will be allowed for all defined languages, not only for enabled ones.') .'</li>';
+ $output .= '<li>'. t('Provides a block for language selection and two theme functions: <i>i18n_flags</i> and <i>i18n_links</i>') .'</li>';
$output .= '</ul>';
- $output .= '<p>' . t('This is the base module for several others adding different features:') . '</p>';
+ $output .= '<p>'. t('This is the base module for several others adding different features:') .'</p>';
$output .= '<ul>';
- $output .= '<li>' . t('Multilingual menu items') . '</li>';
- $output .= '<li>' . t('Multilingual taxonomy Adds a language field for taxonomy vocabularies and terms') . '</li>';
+ $output .= '<li>'. t('Multilingual menu items') .'</li>';
+ $output .= '<li>'. t('Multilingual taxonomy Adds a language field for taxonomy vocabularies and terms') .'</li>';
$output .= '</ul>';
- $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@i18n">Internationalization module</a>.', array('@i18n' =>'http://drupal.org/node/133977')) .'</p>';
+ $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@i18n">Internationalization module</a>.', array('@i18n' => 'http://drupal.org/node/133977')) .'</p>';
return $output;
case 'admin/settings/i18n':
$output = '<ul>';
- $output .= '<li>' . t('To manage languages go to the <a href="@configure_languages">languages configuration page</a>.', array('@configure_languages' => url('admin/settings/language'))).'</li>';
- $output .= '<li>' . t('To enable multilingual support for specific content types go to <a href="@configure_content_types">configure content types</a>.', array('@configure_content_types' => url('admin/content/types'))).'</li>';
- $output . '</ul>';
+ $output .= '<li>'. t('To manage languages go to the <a href="@configure_languages">languages configuration page</a>.', array('@configure_languages' => url('admin/settings/language'))) .'</li>';
+ $output .= '<li>'. t('To enable multilingual support for specific content types go to <a href="@configure_content_types">configure content types</a>.', array('@configure_content_types' => url('admin/content/types'))) .'</li>';
+ $output .= '</ul>';
return $output;
}
}
@@ -93,7 +93,7 @@ function i18n_menu() {
/**
* Implementation of hook_menu_alter().
*
- * Take over the node translation page
+ * Take over the node translation page.
*/
function i18n_menu_alter(&$items) {
// dsm($router_items);
@@ -124,9 +124,10 @@ function i18n_menu_alter(&$items) {
/*
function i18n_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
if (variable_get("i18n_node_$node->type", 0)) {
- switch ($op) {
+ switch ($op) {
case 'load':
return db_fetch_array(db_query("SELECT trid, language, status AS i18n_status FROM {i18n_node} WHERE nid=%d", $node->nid));
+
case 'insert':
case 'update':
db_query("DELETE FROM {i18n_node} WHERE nid=%d",$node->nid);
@@ -140,31 +141,34 @@ function i18n_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
$item['path'] = ($item['path']) ? $item['path'] : "node/$node->nid";
$item['type'] = $item['type'] | MENU_MODIFIED_BY_ADMIN;
if ($item['mid']) {
- // Update menu item
+ // Update menu item.
db_query("UPDATE {menu} SET pid = %d, path = '%s', title = '%s', description = '%s', weight = %d, type = %d, language = '%s' WHERE mid = %d", $item['pid'], $item['path'], $item['title'], $item['description'], $item['weight'], $item['type'], $node->language, $item['mid']);
drupal_set_message(t('The menu item %title has been updated with node language.', array('%title' => $item['title'])));
- } elseif(SAVED_NEW == menu_save_item($item)) {
- // Creating new menu item with node language
+ }
+ elseif (SAVED_NEW == menu_save_item($item)) {
+ // Creating new menu item with node language.
db_query("UPDATE {menu} SET language = '%s' WHERE mid = %d", $node->language, $item['mid']);
drupal_set_message(t('The menu item %title has been added with node language.', array('%title' => $item['title'])));
}
menu_rebuild();
- unset($node->menu); // Avoid further processing by menu module
+ unset($node->menu); // Avoid further processing by menu module.
}
- // Pathauto integration. Dynamic replacement of variables to allow different patterns per language
+ // Pathauto integration. Dynamic replacement of variables to allow different patterns per language.
if (module_exists('path') && module_exists('pathauto')) {
- // Language for pathauto variables is either node language or default language
+ // Language for pathauto variables is either node language or default language.
$language = $node->language ? $node->language : i18n_default_language();
if ($language != i18n_get_lang()) {
i18n_variable_init($language, 'pathauto_node');
}
}
break;
+
case 'delete':
db_query('DELETE FROM {i18n_node} WHERE nid=%d', $node->nid);
break;
+
case 'prepare':
- // Book pages, set the right language nodes and outlines
+ // Book pages, set the right language nodes and outlines.
if (arg(3) == 'parent' && is_numeric(arg(4)) && ($parent = node_load(arg(4))) && $parent->language) {
$node->language = $parent->language;
i18n_selection_mode('node', $parent->language);
@@ -172,13 +176,12 @@ function i18n_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
break;
}
}
-}
-*/
+}*/
/**
* Implementation of hook_alter_translation_link().
*
- * Handles links for extended language. The links will have current language
+ * Handles links for extended language. The links will have current language.
*/
function i18n_translation_link_alter(&$links, $path) {
global $language;
@@ -190,7 +193,7 @@ function i18n_translation_link_alter(&$links, $path) {
foreach (translation_node_get_translations($node->tnid) as $langcode => $translation_node) {
if (!isset($links[$langcode]) && isset($languages[$langcode])) {
$extended[$langcode] = array(
- 'href' => 'node/'.$translation_node->nid . $matches[2],
+ 'href' => 'node/'. $translation_node->nid . $matches[2],
'language' => $language,
'language_icon' => $languages[$langcode],
'title' => $languages[$langcode]->native,
@@ -198,7 +201,7 @@ function i18n_translation_link_alter(&$links, $path) {
);
}
}
- // This will run after languageicon module, so we add icon in case that one is enabled
+ // This will run after languageicon module, so we add icon in case that one is enabled.
if ($extended && function_exists('languageicons_translation_link_alter')) {
languageicons_translation_link_alter($extended, $path);
}
@@ -209,14 +212,14 @@ function i18n_translation_link_alter(&$links, $path) {
/**
* Implementation of hook_link_alter().
*
- * Handles links for extended languages. Sets current interface language;
+ * Handles links for extended languages. Sets current interface language.
*/
function i18n_link_alter(&$links, $node) {
global $language;
if ($node->tnid) {
foreach (array_keys(i18n_language_list('extended')) as $langcode) {
- $index = 'node_translation_'.$langcode;
+ $index = 'node_translation_'. $langcode;
if (!empty($links[$index])) {
$links[$index]['language'] = $language;
}
@@ -225,12 +228,12 @@ function i18n_link_alter(&$links, $node) {
}
/**
- * Implementation of hook_user()
+ * Implementation of hook_user().
*
- * Switch to user's language after login
+ * Switch to user's language after login.
*/
function i18n_user($op, &$edit, &$account, $category = NULL) {
- if($op == 'login' && $account->language) {
+ if ($op == 'login' && $account->language) {
$_SESSION['language'] = $account->language;
i18n_get_lang($account->language);
}
@@ -241,10 +244,10 @@ function i18n_user($op, &$edit, &$account, $category = NULL) {
*/
/**
- * Get language properties
+ * Get language properties.
*
* @param $code
- * Language code
+ * Language code.
* @param $property
* It may be 'name', 'native', 'ltr'...
*/
@@ -254,30 +257,31 @@ function i18n_language_property($code, $property) {
}
/**
- * Get node language
+ * Get node language.
*/
function i18n_node_get_lang($nid, $default = '') {
- $lang = db_result(db_query('SELECT language FROM {node} WHERE nid = %d',$nid));
+ $lang = db_result(db_query('SELECT language FROM {node} WHERE nid = %d', $nid));
return $lang ? $lang : $default ;
}
/**
- * Get allowed languages for node
+ * Get allowed languages for node.
*
- * This allows node types to define its own language list implementing hook 'language_list'
+ * This allows node types to define its own language list implementing hook 'language_list'.
*
* @param $node
- * Node to retrieve language list for
+ * Node to retrieve language list for.
* @param $translate
- * Only languages available for translation. Filter out existing translations
+ * Only languages available for translation. Filter out existing translations.
*/
function i18n_node_language_list($node, $translate = FALSE) {
- // Check if the node module manages its own language list
+ // Check if the node module manages its own language list.
$languages = node_invoke($node, 'language_list', $translate);
if (!$languages) {
- if (variable_get('i18n_node_'.$node->type, 0) == LANGUAGE_SUPPORT_EXTENDED) {
+ if (variable_get('i18n_node_'. $node->type, 0) == LANGUAGE_SUPPORT_EXTENDED) {
$languages = locale_language_list('name', TRUE); // All defined languages
- } else {
+ }
+ else {
$languages = locale_language_list(); // All enabled languages
}
if ($translate && isset($node->tnid) && $node->tnid && ($translations = translation_node_get_translations($node->tnid))) {
@@ -293,24 +297,24 @@ function i18n_node_language_list($node, $translate = FALSE) {
}
/**
- * Function i18n_get_links
+ * Function i18n_get_links().
*
- * Returns an array of links for all languages, with or without names/flags
+ * Returns an array of links for all languages, with or without names/flags.
*
* @param $path
- * Drupal internal path
+ * Drupal internal path.
* @param $query
- * Query string
+ * Query string.
* @param $names
- * Names to use for the links. Defaults to native language names
+ * Names to use for the links. Defaults to native language names.
*/
function i18n_get_links($path = '', $query = NULL, $names = NULL) {
- if($path == variable_get('site_frontpage', 'node')) {
+ if ($path == variable_get('site_frontpage', 'node')) {
$path = '';
}
$names = $names ? $names : locale_language_list('native');
- foreach (array_keys(i18n_supported_languages()) as $lang){
- $links[$lang]= theme('i18n_link', $names[$lang], i18n_path($path, $lang), $lang, $query);
+ foreach (array_keys(i18n_supported_languages()) as $lang) {
+ $links[$lang] = theme('i18n_link', $names[$lang], i18n_path($path, $lang), $lang, $query);
}
return $links;
}
@@ -318,57 +322,63 @@ function i18n_get_links($path = '', $query = NULL, $names = NULL) {
/**
* Selection mode for content.
*
- * Warning: when used with params they need to be escaped, as some values are thrown directly in queries
+ * Warning: when used with params they need to be escaped, as some values are thrown directly in queries.
*
- * Allows several modes for query rewriting and to change them programatically
- * off = No language conditions inserted
- * simple = Only current language and no language
- * mixed = Only current and default languages
- * strict = Only current language
- * default = Only default language
- * user = User defined, in the module's settings page
- * params = Gets the stored params
- * reset = Returns to previous
- * custom = add custom where clause, like "%alias.language = 'en'"
- */
-function i18n_selection_mode($mode= NULL, $params= NULL){
+ * Allows several modes for query rewriting and to change them programatically.
+ * off = No language conditions inserted.
+ * simple = Only current language and no language.
+ * mixed = Only current and default languages.
+ * strict = Only current language.
+ * default = Only default language.
+ * user = User defined, in the module's settings page.
+ * params = Gets the stored params.
+ * reset = Returns to previous.
+ * custom = add custom where clause, like "%alias.language = 'en'".
+ */
+function i18n_selection_mode($mode = NULL, $params = NULL) {
static $current_mode = NULL;
static $current_value = '';
static $store = array();
- // Initialization, first time this runs with no explicit mode
+ // Initialization, first time this runs with no explicit mode.
if (!$current_mode && !$mode) {
$current_mode = variable_get('i18n_selection_mode', 'simple');
if ($current_mode != 'off') {
- // Node language when loading specific nodes or creating translations
+ // Node language when loading specific nodes or creating translations.
if (arg(0) == 'node' ) {
if (($node = menu_get_object('node')) && $node->language) {
$current_mode = 'node';
$current_value = $node->language;
- } elseif (arg(1) == 'add' && !empty($_GET['translation']) && !empty($_GET['language']) && empty($_POST)) {
+ }
+ elseif (arg(1) == 'add' && !empty($_GET['translation']) && !empty($_GET['language']) && empty($_POST)) {
$current_mode = 'translation';
$current_value = db_escape_string($_GET['language']);
}
- } elseif (arg(0) == 'admin') {
- // There are some exceptions for admin pages
+ }
+ elseif (arg(0) == 'admin') {
+ // There are some exceptions for admin pages.
if (arg(1) == 'content' && user_access('administer all languages')) {
- // No restrictions for administration pages
+ // No restrictions for administration pages.
$current_mode = 'off';
- } elseif (arg(1) == 'build' && arg(2) == 'menu-customize') {
- // All nodes available when editing custom menu items
+ }
+ elseif (arg(1) == 'build' && arg(2) == 'menu-customize') {
+ // All nodes available when editing custom menu items.
$current_mode = 'off';
}
}
}
}
- if(!$mode) {
+ if (!$mode) {
return $current_mode;
- } elseif($mode == 'params'){
+ }
+ elseif ($mode == 'params') {
return $current_value;
- } elseif($mode == 'reset'){
+ }
+ elseif ($mode == 'reset') {
list($current_mode, $current_value) = array_pop($store);
- } else {
+ }
+ else {
array_push($store, array($current_mode, $current_value));
$current_mode = $mode;
$current_value = $params;
@@ -376,40 +386,41 @@ function i18n_selection_mode($mode= NULL, $params= NULL){
}
/**
- * Implementation of hook_db_rewrite_sql()
+ * Implementation of hook_db_rewrite_sql().
*
- * Rewrite node queries so language selection options are enforced
+ * Rewrite node queries so language selection options are enforced.
*/
-function i18n_db_rewrite_sql($query, $primary_table, $primary_key, $args = array()){
- // If mode is 'off' = no rewrite, we cannot return any empty 'where' string so check here
+function i18n_db_rewrite_sql($query, $primary_table, $primary_key, $args = array()) {
+ // If mode is 'off' = no rewrite, we cannot return any empty 'where' string so check here.
$mode = i18n_selection_mode();
if ($mode == 'off') return;
- // Disable language conditions for views
- if (array_key_exists('view',$args)) return;
+ // Disable language conditions for views.
+ if (array_key_exists('view', $args)) return;
switch ($primary_table) {
case 'n':
case 'node':
- // No rewrite for queries with subselect ? (views count queries)
- // @ TO DO Actually these queries look un-rewrittable, check with other developers
+ // No rewrite for queries with subselect ? (views count queries).
+ // @ TO DO Actually these queries look un-rewrittable, check with other developers.
if (preg_match("/FROM \(SELECT/", $query)) return;
- // No rewrite for translation module queries
+ // No rewrite for translation module queries.
if (preg_match("/.*FROM {node} $primary_table WHERE.*$primary_table\.tnid/", $query)) return;
- // When loading specific nodes, language conditions shouldn't apply
+ // When loading specific nodes, language conditions shouldn't apply.
if (preg_match("/WHERE.*\s$primary_table.nid\s*=\s*(\d|%d)/", $query)) return;
- // If language conditions already there, get out
+ // If language conditions already there, get out.
if (preg_match("/i18n/", $query)) return;
// Mixed mode is a bit more complex, we need to join in one more table
- // and add some more conditions, but only if language is not default
+ // and add some more conditions, but only if language is not default.
if ($mode == 'mixed' && i18n_get_lang() != i18n_default_language()) {
- $result['join'] = "LEFT JOIN {node} i18n ON $primary_table.tnid = i18n.tnid AND i18n.language = '".i18n_get_lang()."'";
+ $result['join'] = "LEFT JOIN {node} i18n ON $primary_table.tnid = i18n.tnid AND i18n.language = '". i18n_get_lang() ."'";
$result['where'] = i18n_db_rewrite_where($primary_table, 'node', 'simple');
- // So we show also nodes that have default language
- $result['where'] .= " OR ($primary_table.language = '" . i18n_default_language() . "' AND i18n.nid IS NULL)" ;
- } else {
+ // So we show also nodes that have default language.
+ $result['where'] .= " OR ($primary_table.language = '". i18n_default_language() ."' AND i18n.nid IS NULL)";
+ }
+ else {
$result['where'] = i18n_db_rewrite_where($primary_table, 'node', $mode);
}
return $result;
@@ -417,74 +428,79 @@ function i18n_db_rewrite_sql($query, $primary_table, $primary_key, $args = array
}
/**
- * Rewrites queries depending on rewriting mode
+ * Rewrites queries depending on rewriting mode.
*/
-function i18n_db_rewrite_where($alias, $type, $mode = NULL){
+function i18n_db_rewrite_where($alias, $type, $mode = NULL) {
if (!$mode) {
- // Some exceptions for query rewrites
+ // Some exceptions for query rewrites.
$mode = i18n_selection_mode();
}
- // Get languages to simplify query building
+ // Get languages to simplify query building.
$current = i18n_get_lang();
$default = i18n_default_language();
if ($mode == 'strict' && $type != 'node') {
- // Special case. Selection mode is 'strict' but this should be only for node queries
+ // Special case. Selection mode is 'strict' but this should be only for node queries.
$mode = 'simple';
}
elseif ($mode == 'mixed' && $current == $default) {
- // If mode is mixed but current = default, is the same as 'simple'
+ // If mode is mixed but current = default, is the same as 'simple'.
$mode = 'simple';
}
- switch ($mode){
+ switch ($mode) {
case 'off':
return '';
+
case 'simple':
return "$alias.language ='$current' OR $alias.language ='' OR $alias.language IS NULL" ;
+
case 'mixed':
return "$alias.language ='$current' OR $alias.language ='$default' OR $alias.language ='' OR $alias.language IS NULL" ;
+
case 'strict':
return "$alias.language ='$current'" ;
+
case 'node':
case 'translation':
- return "$alias.language ='".i18n_selection_mode('params')."' OR $alias.language ='' OR $alias.language IS NULL" ;
+ return "$alias.language ='". i18n_selection_mode('params') ."' OR $alias.language ='' OR $alias.language IS NULL" ;
+
case 'default':
return "$alias.language ='$default' OR $alias.language ='' OR $alias.language IS NULL" ;
+
case 'custom':
return str_replace('%alias', $alias, i18n_selection_mode('params'));
}
}
/**
- * Implementation of hook_exit
+ * Implementation of hook_exit().
*/
-function i18n_exit(){
+function i18n_exit() {
_i18n_variable_exit();
}
/**
* Implementation of hook_form_alter();
*
- * This is the place to add language fields to all forms
+ * This is the place to add language fields to all forms.
*/
function i18n_form_alter(&$form, $form_state, $form_id) {
- switch ($form_id){
- case 'node_type_form':
- // Add extended language support option to content type form.
- $form['workflow']['i18n_node'] = array(
- '#type' => 'radios',
- '#title' => t('Extended language support'),
- '#default_value' => variable_get('i18n_node_'. $form['#node_type']->type, LANGUAGE_SUPPORT_NORMAL),
- '#options' => _i18n_content_language_options(),
- '#description' => t('If enabled, all defined languages will be allowed for this content type in addition to only enabled ones. This is useful to have more languages for content than for the interface.')
- );
-
- break;
+ switch ($form_id) {
+ case 'node_type_form':
+ // Add extended language support option to content type form.
+ $form['workflow']['i18n_node'] = array(
+ '#type' => 'radios',
+ '#title' => t('Extended language support'),
+ '#default_value' => variable_get('i18n_node_'. $form['#node_type']->type, LANGUAGE_SUPPORT_NORMAL),
+ '#options' => _i18n_content_language_options(),
+ '#description' => t('If enabled, all defined languages will be allowed for this content type in addition to only enabled ones. This is useful to have more languages for content than for the interface.')
+ );
+ break;
default:
- // Extended language for node edit form
+ // Extended language for node edit form.
if (isset($form['#id']) && $form['#id'] == 'node-form') {
if (isset($form['#node']->type) && variable_get('language_content_type_'. $form['#node']->type, 0)) {
$form['language']['#options'] = i18n_node_language_list($form['#node'], TRUE);
@@ -493,27 +509,37 @@ function i18n_form_alter(&$form, $form_state, $form_id) {
/** @ TO DO Upgrade
if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id && $node = $form['#node']) {
// Language field
- if(variable_get('i18n_node_'.$form['type']['#value'], 0) && !isset($form['i18n']['language'])) {
+ if (variable_get('i18n_node_'.$form['type']['#value'], 0) && !isset($form['i18n']['language'])) {
// Language field
- $form['i18n'] = array('#type' => 'fieldset', '#title' => t('Multilingual settings'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#weight' => -4);
- // Language will default to current only when creating a node
+ $form['i18n'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Multilingual settings'),
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE,
+ '#weight' => -4
+ );
+ // Language will default to current only when creating a node.
$language = isset($form['#node']->language) ? $form['#node']->language : (arg(1)=='add' ? i18n_get_lang() : '');
$form['i18n']['language'] = _i18n_language_select($language, t('If you change the language, you must click on <i>Preview</i> to get the right categories &amp; terms for that language.'), -4, i18n_node_language_list($node));
- $form['i18n']['trid'] = array('#type' => 'value', '#value' => $form['#node']->trid);
+ $form['i18n']['trid'] = array(
+ '#type' => 'value',
+ '#value' => $form['#node']->trid
+ );
}
- // Correction for lang/node/nid aliases generated by path module
- // if($form['#node']->path && $form['#node']->path == i18n_get_lang().'/node/'.$form['#node']->nid){
- if($node->path) {
+ // Correction for lang/node/nid aliases generated by path module.
+ // if ($form['#node']->path && $form['#node']->path == i18n_get_lang().'/node/'.$form['#node']->nid) {
+ if ($node->path) {
$alias = drupal_lookup_path('alias', 'node/'.$node->nid);
- if($alias && $alias != 'node/'.$node->nid){
+ if($alias && $alias != 'node/'.$node->nid) {
$form['#node']->path = $alias;
- } else {
+ }
+ else {
unset($form['#node']->path);
}
}
}
*/
- // Multilingual variables in settings form
+ // Multilingual variables in settings form.
if (isset($form['#theme']) && $form['#theme'] == 'system_settings_form' && $variables = variable_get('i18n_variables', 0)) {
if (i18n_form_alter_settings($form, $variables)) {
$form['#submit'][] = 'i18n_variable_form_submit';
@@ -533,6 +559,7 @@ function i18n_form_alter(&$form, $form_state, $form_id) {
function i18n_perm() {
return array('administer all languages');
}
+
/**
* Process menu and menu item add/edit form submissions.
*/
@@ -543,16 +570,16 @@ function i18n_menu_edit_item_form_submit($form, &$form_state) {
}
/**
- * Check for multilingual variables in form
+ * Check for multilingual variables in form.
*/
function i18n_form_alter_settings(&$form, &$variables) {
$result = 0;
foreach (element_children($form) as $field) {
- if(isset($form[$field]['#type']) && $form[$field]['#type'] == 'fieldset') {
+ if (isset($form[$field]['#type']) && $form[$field]['#type'] == 'fieldset') {
$result += i18n_form_alter_settings($form[$field], $variables);
}
elseif (in_array($field, $variables)) {
- $form[$field]['#description'] .= ' <strong>' . t('This is a multilingual variable.') . '</strong>';
+ $form[$field]['#description'] .= ' <strong>'. t('This is a multilingual variable.') .'</strong>';
$result++;
}
}
@@ -560,7 +587,7 @@ function i18n_form_alter_settings(&$form, &$variables) {
}
/**
- * Save multilingual variables and remove them from form
+ * Save multilingual variables and remove them from form.
*/
function i18n_variable_form_submit($form, &$form_state) {
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
@@ -585,24 +612,24 @@ function i18n_variable_form_submit($form, &$form_state) {
}
/**
- * Initialization of multilingual variables
+ * Initialization of multilingual variables.
*
* @param $language
- * Language to retrieve variables. Defaults to current language
+ * Language to retrieve variables. Defaults to current language.
* @param $prefix
- * Variable name prefix to load just a selected group of variables
+ * Variable name prefix to load just a selected group of variables.
*/
-function i18n_variable_init($langcode = NULL, $prefix = ''){
+function i18n_variable_init($langcode = NULL, $prefix = '') {
global $conf;
global $i18n_conf;
$langcode = $langcode ? $langcode : i18n_get_lang();
- if ($i18n_variables = variable_get('i18n_variables', '')){
+ if ($i18n_variables = variable_get('i18n_variables', '')) {
if (!$i18n_conf) {
$i18n_conf = array();
}
$variables = _i18n_variable_init($langcode, $prefix);
- foreach($i18n_variables as $name){
+ foreach ($i18n_variables as $name) {
$i18n_conf[$name] = isset($variables[$name]) ? $variables[$name] : (isset($conf[$name]) ? $conf[$name] : '');
}
@@ -610,29 +637,27 @@ function i18n_variable_init($langcode = NULL, $prefix = ''){
}
}
-
-
/**
- * Helper function to create language selector
+ * Helper function to create language selector.
*/
-function _i18n_language_select($value ='', $description ='', $weight = -20, $languages = NULL){
+function _i18n_language_select($value ='', $description ='', $weight = -20, $languages = NULL) {
$languages = $languages ? $languages : locale_language_list();
return array(
- '#type' => 'select',
- '#title' => t('Language'),
- '#default_value' => $value,
- '#options' => array_merge(array('' => ''), $languages),
- '#description' => $description,
- '#weight' => $weight,
+ '#type' => 'select',
+ '#title' => t('Language'),
+ '#default_value' => $value,
+ '#options' => array_merge(array('' => ''), $languages),
+ '#description' => $description,
+ '#weight' => $weight,
);
}
/**
- * Load language variables into array
+ * Load language variables into array.
*/
-function _i18n_variable_init($language, $prefix = ''){
+function _i18n_variable_init($language, $prefix = '') {
$variables = array();
- $cacheid = 'variables:'.$language.($prefix ? ':'.$prefix : '');
+ $cacheid = 'variables:'. $language . ($prefix ? ':'. $prefix : '');
if ($cached = cache_get($cacheid)) {
$variables = $cached->data;
}
@@ -647,25 +672,25 @@ function _i18n_variable_init($language, $prefix = ''){
}
/**
- * Save multilingual variables that may have been changed by other methods than settings pages
+ * Save multilingual variables that may have been changed by other methods than settings pages.
*/
-function _i18n_variable_exit(){
+function _i18n_variable_exit() {
global $i18n_conf;
global $conf;
- if($i18n_conf){
+ if ($i18n_conf) {
$lang = i18n_get_lang();
$refresh = FALSE;
- // Rewritten because array_diff_assoc may fail with array variables
- foreach($i18n_conf as $name => $value){
- if($value != $conf[$name]) {
+ // Rewritten because array_diff_assoc may fail with array variables.
+ foreach ($i18n_conf as $name => $value) {
+ if ($value != $conf[$name]) {
$refresh = TRUE;
$i18n_conf[$name] = $conf[$name];
db_query("DELETE FROM {i18n_variable} WHERE name='%s' AND language='%s'", $name, $lang );
db_query("INSERT INTO {i18n_variable} (language, name, value) VALUES('%s', '%s', '%s')", $lang, $name, serialize($conf[$name]));
}
}
- if($refresh) {
- cache_set('variables:'.$lang, $i18n_conf);
+ if ($refresh) {
+ cache_set('variables:'. $lang, $i18n_conf);
}
}
}
@@ -673,7 +698,7 @@ function _i18n_variable_exit(){
/**
* Check whether we are in bootstrap mode
*/
-function _i18n_is_bootstrap(){
+function _i18n_is_bootstrap() {
return !function_exists('drupal_get_headers');
}
@@ -703,6 +728,7 @@ function i18n_language_list($type = 'enabled', $field = 'name') {
switch ($type) {
case 'enabled':
return locale_language_list($field);
+
case 'extended':
$enabled = locale_language_list($field);
$defined = locale_language_list($field, TRUE);
@@ -711,17 +737,17 @@ function i18n_language_list($type = 'enabled', $field = 'name') {
}
/**
- * Returns default language code
+ * Returns default language code.
*/
-function i18n_default_language(){
+function i18n_default_language() {
return language_default('language');
}
/**
- * Get list of supported languages, native name
+ * Get list of supported languages, native name.
*
* @param $all
- * TRUE to get all defined languages
+ * TRUE to get all defined languages.
*/
function i18n_supported_languages($all = FALSE) {
return locale_language_list('native', $all);
@@ -736,7 +762,7 @@ function i18n_supported_languages($all = FALSE) {
* The value to set. This can be any PHP data type; these functions take care
* of serialization as necessary.
* @param $langcode
- * Language code
+ * Language code.
*/
function i18n_variable_set($name, $value, $langcode) {
global $conf, $i18n_conf;
@@ -746,7 +772,7 @@ function i18n_variable_set($name, $value, $langcode) {
db_query("INSERT INTO {i18n_variable} (name, language, value) VALUES ('%s', '%s', '%s')", $name, $langcode, serialize($value));
db_unlock_tables();
- cache_clear_all('variables:'.$langcode, 'cache');
+ cache_clear_all('variables:'. $langcode, 'cache');
$conf[$name] = $value;
$i18n_conf[$name] = $value;
@@ -758,31 +784,32 @@ function i18n_variable_set($name, $value, $langcode) {
* @param $name
* The name of the variable to undefine.
* @param $langcode
- * Language code
+ * Language code.
*/
function i18n_variable_del($name, $langcode) {
global $conf, $i18n_conf;
db_query("DELETE FROM {i18n_variable} WHERE name = '%s' AND language='%s'", $name, $langcode);
- cache_clear_all('variables:'.$langcode, 'cache');
+ cache_clear_all('variables:'. $langcode, 'cache');
unset($conf[$name]);
unset($i18n_conf[$name]);
}
/**
- * Utility. Get part of array variable
+ * Utility. Get part of array variable.
*/
function i18n_array_variable_get($name, $element, $default = NULL) {
if (($values = variable_get($name, array())) && isset($values[$element])) {
return $values[$element];
- } else {
+ }
+ else {
return $default;
}
}
/**
- * Utility. Set part of array variable
+ * Utility. Set part of array variable.
*/
function i18n_array_variable_set($name, $element, $value) {
$values = variable_get($name, array());
@@ -794,7 +821,9 @@ function i18n_array_variable_set($name, $element, $value) {
* @} End of "defgroup i18n_api".
*/
- // List of language support modes for content
+/**
+ * List of language support modes for content.
+ */
function _i18n_content_language_options() {
return array(
LANGUAGE_SUPPORT_NORMAL => t('Normal - All enabled languages will be allowed.'),
diff --git a/i18nblocks/i18nblocks.install b/i18nblocks/i18nblocks.install
index 2d5bec8..c37da98 100644
--- a/i18nblocks/i18nblocks.install
+++ b/i18nblocks/i18nblocks.install
@@ -11,18 +11,19 @@
* Implementation of hook_install().
*/
function i18nblocks_install() {
- // Create database tables
+ // Create database tables.
drupal_install_schema('i18nblocks');
// We dont need to change module weight
//db_query("UPDATE {system} SET weight = 20 WHERE name = 'i18nblocks' AND type = 'module'");
}
/**
- * Implementation of hook_uninstall()
+ * Implementation of hook_uninstall().
*/
function i18nblocks_uninstall() {
drupal_uninstall_schema('i18nblocks');
}
+
/**
* Implementation of hook_schema().
*/
@@ -34,7 +35,8 @@ function i18nblocks_schema() {
'description' => t('The i18n block identifier.'),
'type' => 'serial',
'unsigned' => TRUE,
- 'not null' => TRUE),
+ 'not null' => TRUE
+ ),
'module' => array(
'type' => 'varchar',
'length' => 64,
@@ -71,21 +73,21 @@ function i18nblocks_schema() {
}
/**
- * Update: move old variable to new tables
+ * Update: move old variable to new tables.
*/
function i18nblocks_update_1() {
$ret = array();
$t = get_t();
- require_once drupal_get_path('module', 'i18nblocks').'/i18nblocks.module';
- require_once drupal_get_path('module', 'i18n').'/i18n.module';
- // Create the tables if updating from previous version
+ require_once drupal_get_path('module', 'i18nblocks') .'/i18nblocks.module';
+ require_once drupal_get_path('module', 'i18n') .'/i18n.module';
+ // Create the tables if updating from previous version.
i18nblocks_install();
- // Move old data from variables into new tables
+ // Move old data from variables into new tables.
$languages = i18n_supported_languages();
if ($number = variable_get('i18nblocks_number', 0)) {
for ($delta = 1; $delta <= $number; $delta++) {
- if ($block = variable_get('i18nblocks_' . $delta, NULL)) {
- $update = update_sql("INSERT INTO {i18n_blocks}(delta) VALUES('" . db_escape_string($delta) . "')");
+ if ($block = variable_get('i18nblocks_'. $delta, NULL)) {
+ $update = update_sql("INSERT INTO {i18n_blocks}(delta) VALUES('". db_escape_string($delta) ."')");
$ret[] = $update;
$metablock = array();
if ($update['success']) {
@@ -95,7 +97,7 @@ function i18nblocks_update_1() {
$metablock['i18nblocks'] = array();
foreach (array_keys($languages) as $lang) {
if (isset($block[$lang]) && isset($block[$lang]['module']) && isset($block[$lang]['delta'])) {
- $metablock['i18nblocks'][$lang] = $block[$lang]['module'] . ':' . $block[$lang]['delta'];
+ $metablock['i18nblocks'][$lang] = $block[$lang]['module'] .':'. $block[$lang]['delta'];
}
}
}
@@ -107,7 +109,7 @@ function i18nblocks_update_1() {
}
/**
- * Drupal 6 upgrade script
+ * Drupal 6 upgrade script.
*/
function i18nblocks_update_2() {
$ret = array();
@@ -123,7 +125,7 @@ function i18nblocks_update_2() {
}
/**
- * Drop old tables and fields. Uncomment when the previous one is 100% working
+ * Drop old tables and fields. Uncomment when the previous one is 100% working.
*/
/*
function i18nblocks_update_3() {
@@ -131,5 +133,4 @@ function i18nblocks_update_3() {
$items[] = update_sql('DROP TABLE {i18n_blocks_i18n}');
$items[] = update_sql('DROP TABLE {i18n_blocks_drupal5}');
return $items;
-}
-*/
+}*/
diff --git a/i18nblocks/i18nblocks.module b/i18nblocks/i18nblocks.module
index 4fefd62..8b8469c 100644
--- a/i18nblocks/i18nblocks.module
+++ b/i18nblocks/i18nblocks.module
@@ -34,13 +34,13 @@ function _block_types() {
function i18nblocks_help($path, $arg) {
switch ($path) {
case 'admin/help#i18nblocks':
- $output = '<p>' . t('This module provides support for multilingual blocks.') . '</p>';
- $output .= '<p>' . t('You can set up a language for a block or define it as translatable:') . '</p>';
+ $output = '<p>'. t('This module provides support for multilingual blocks.') .'</p>';
+ $output .= '<p>'. t('You can set up a language for a block or define it as translatable:') .'</p>';
$output .= '<ul>';
- $output .= '<li>' . t('Blocks with a language will be displayed only in pages with that language.') . '</li>';
- $output .= '<li>' . t('Translatable blocks can be translated using the localization interface.') . '</li>';
+ $output .= '<li>'. t('Blocks with a language will be displayed only in pages with that language.') .'</li>';
+ $output .= '<li>'. t('Translatable blocks can be translated using the localization interface.') .'</li>';
$output .= '</ul>';
- $output .= '<p>' . t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) . '</p>';
+ $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>';
return $output;
}
}
@@ -81,8 +81,8 @@ function i18nblocks_block($op = 'list', $delta = 0, $edit = array()) {
$form['i18nblocks']['#value'] = t('This is a localizable block.');
return $form;
}
-}
-*/
+}*/
+
/**
* Implementation of hook_locale().
*
@@ -174,7 +174,7 @@ function i18nblocks_form_submit($form, &$form_state) {
break;
default:
- // The block has a language.
+ // The block has a language.
i18nblocks_save($values);
}
}
@@ -221,7 +221,7 @@ function i18nblocks_save($block) {
* @param $language
* Language to localize the block.
*/
-function i18nblocks_get_block($delta, $language){
+function i18nblocks_get_block($delta, $language) {
// Get block metadata.
$meta = db_fetch_object(db_query("SELECT b.* FROM {blocks} b INNER JOIN {i18n_blocks} i ON i.delta = b.delta AND i.module = b.module WHERE i.ibid = '%d'", $delta));
// Get block data from module.
diff --git a/i18ncontent/i18ncontent.install b/i18ncontent/i18ncontent.install
index 0099c45..537621e 100644
--- a/i18ncontent/i18ncontent.install
+++ b/i18ncontent/i18ncontent.install
@@ -12,7 +12,7 @@ function i18ncontent_install() {
}
/**
- * Implementatin of hook_enable()
+ * Implementation of hook_enable().
*/
function i18ncontent_enable() {
i18ncontent_locale_refresh();
diff --git a/i18ncontent/i18ncontent.module b/i18ncontent/i18ncontent.module
index 57fd9a9..75efe11 100644
--- a/i18ncontent/i18ncontent.module
+++ b/i18ncontent/i18ncontent.module
@@ -19,20 +19,20 @@
function i18ncontent_help($path, $arg) {
switch ($path) {
case 'admin/help#i18ncontent':
- $output = '<p>' . t('This module will localize all content type configuration texts.') . '</p>';
+ $output = '<p>'. t('This module will localize all content type configuration texts.') .'</p>';
$output .= '<ul>';
- $output .= '<li>' . t('Content type names') . '</li>';
- $output .= '<li>' . t('Submission guidelines') . '</li>';
- $output .= '<li>' . t("Content type descriptions were previously localized so they won't be affected.") . '</li>';
+ $output .= '<li>'. t('Content type names') .'</li>';
+ $output .= '<li>'. t('Submission guidelines') .'</li>';
+ $output .= '<li>'. t("Content type descriptions were previously localized so they won't be affected.") .'</li>';
$output .= '</ul>';
- $output .= '<p>' . t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) . '</p>';
+ $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>';
return $output;
}
if ($arg[0] == 'node' && $arg[1] == 'add' && $arg[2]) {
$type = str_replace('-', '_', $arg[2]);
if ($help = ts("nodetype:$type:help")) {
- return '<p>' . filter_xss_admin($help) . '</p>';
+ return '<p>'. filter_xss_admin($help) .'</p>';
}
}
}
@@ -134,7 +134,7 @@ function i18ncontent_menu_alter(&$menu) {
if (!empty($item['page callback']) && $item['page callback'] == 'node_add') {
$arg = arg(NULL, $path);
$menu[$path]['title callback'] = 'i18nstrings_title_callback';
- $menu[$path]['title arguments'] = array('nodetype:' . $arg[2] . ':name', $item['title']);
+ $menu[$path]['title arguments'] = array('nodetype:'. $arg[2] .':name', $item['title']);
}
}
}
diff --git a/i18nmenu/i18nmenu.module b/i18nmenu/i18nmenu.module
index fc8783c..7a26ed3 100644
--- a/i18nmenu/i18nmenu.module
+++ b/i18nmenu/i18nmenu.module
@@ -45,7 +45,7 @@ function i18nmenu_menu_link_alter(&$item, $menu) {
if (!empty($item['language'])) {
$item['options']['langcode'] = $item['language'];
}
- elseif(isset($item['language'])) {
+ elseif (isset($item['language'])) {
unset($item['options']['langcode']);
}
// @ TO DO: Refresh texts
@@ -61,12 +61,12 @@ function i18nmenu_menu_link_alter(&$item, $menu) {
function i18nmenu_help($path, $arg) {
switch ($path) {
case 'admin/help#i18nmenu' :
- $output = '<p>' . t('This module provides support for translatable custom menu items:') . '</p>';
+ $output = '<p>'. t('This module provides support for translatable custom menu items:') .'</p>';
$output .= '<ul>';
- $output .= '<li>' . t('Create menus as usual, with names in the default language, usually English. If the menu is already created, no changes are needed.') . '</li>';
- $output .= '<li>' . t('Optionally, you can set up a language for a menu item so it is only displayed for that language.') . '</li>';
+ $output .= '<li>'. t('Create menus as usual, with names in the default language, usually English. If the menu is already created, no changes are needed.') .'</li>';
+ $output .= '<li>'. t('Optionally, you can set up a language for a menu item so it is only displayed for that language.') .'</li>';
$output .= '</ul>';
- $output .= '<p>' . t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) . '</p>';
+ $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>';
return $output;
}
}
@@ -106,9 +106,9 @@ function i18nmenu_localize_tree(&$tree) {
// If the title is the same it will be localized by the menu system.
if ($link['link_title'] != $router['title']) {
//$tree[$index]['link']['title'] = 'Translated';
- $tree[$index]['link']['title'] = tt('menu:item:' . $link['mlid'] . ':title', $link['link_title'], NULL, TRUE);
+ $tree[$index]['link']['title'] = tt('menu:item:'. $link['mlid'] .':title', $link['link_title'], NULL, TRUE);
}
- // Localize subtree
+ // Localize subtree.
if ($item['below'] !== FALSE) {
i18nmenu_localize_tree($tree[$index]['below']);
}
@@ -134,7 +134,7 @@ function i18nmenu_get_router($path) {
/**
* Implementation of hook_form_alter().
*/
-function i18nmenu_form_alter(&$form, $form_state, $form_id){
+function i18nmenu_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'menu_edit_item') {
//dsm ($form);
if ($form['menu']['#item'] && isset($form['menu']['#item']['options']['langcode'])) {
diff --git a/i18npoll/i18npoll.module b/i18npoll/i18npoll.module
index a0a67e4..547d294 100644
--- a/i18npoll/i18npoll.module
+++ b/i18npoll/i18npoll.module
@@ -112,7 +112,7 @@ function i18npoll_view($node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
if ($node->allowvotes && $block) {
$links[] = array(
'title' => t('Results'),
- 'href' => 'node/' . $node->nid . '/results',
+ 'href' => 'node/'. $node->nid .'/results',
'attributes' => array(
'title' => t('View the current poll results.')
)
diff --git a/i18nprofile/i18nprofile.install b/i18nprofile/i18nprofile.install
index 464d051..ce7188c 100644
--- a/i18nprofile/i18nprofile.install
+++ b/i18nprofile/i18nprofile.install
@@ -34,7 +34,7 @@ function i18nprofile_update_2() {
}
// Category translations from variables.
foreach (array_keys(language_list()) as $lang) {
- if ($translation = variable_get('i18nprofile_' . $lang, FALSE)) {
+ if ($translation = variable_get('i18nprofile_'. $lang, FALSE)) {
foreach ($translation as $category => $translation) {
if (in_array($category, $categories) && $translation) {
$context = i18nstrings_context('profile:category', $category);
@@ -65,5 +65,4 @@ function i18nprofile_update_3() {
variable_del('i18nprofile_'.$lang);
}
return $items;
-}
-*/ \ No newline at end of file
+}*/ \ No newline at end of file
diff --git a/i18nprofile/i18nprofile.module b/i18nprofile/i18nprofile.module
index 3046310..6dc248b 100644
--- a/i18nprofile/i18nprofile.module
+++ b/i18nprofile/i18nprofile.module
@@ -15,9 +15,9 @@
*/
function i18nprofile_help($path, $arg) {
switch ($path) {
- case 'admin/modules#description' :
- $output = '<p>' . t('Supports translation for profile module field names and descriptions.') . '</p>';
- $output .= '<p>' . t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) . '</p>';
+ case 'admin/modules#description':
+ $output = '<p>'. t('Supports translation for profile module field names and descriptions.') .'</p>';
+ $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>';
return $output;
}
}
@@ -64,7 +64,7 @@ function i18nprofile_menu_alter(&$items) {
if (($categories = _user_categories($empty_account)) && (count($categories) > 1)) {
foreach ($categories as $key => $category) {
// 'account' is already handled by the MENU_DEFAULT_LOCAL_TASK.
- $path = 'user/%user_category/edit/' . $category['name'];
+ $path = 'user/%user_category/edit/'. $category['name'];
if ($category['name'] != 'account' && !empty($items[$path])) {
$items[$path]['title callback'] = 'i18nprofile_translate_category'; // Was 'check_plain',
$items[$path]['title arguments'] = array($category['title']); // Was array($category['title'])
@@ -101,7 +101,7 @@ function i18nprofile_profile_alter(&$account) {
}
else {
// Link
- $account->content[$name][$field]['#value'] == check_markup(l($account->$field, 'profile/' . $field . '/' . $account->$field));
+ $account->content[$name][$field]['#value'] == check_markup(l($account->$field, 'profile/'. $field .'/'. $account->$field));
}
}
}
@@ -150,7 +150,7 @@ function i18nprofile_field_form_submit($form, &$form_state) {
/**
* Translate form fields for a given category.
*/
-function i18nprofile_form_translate_category(&$form, $category){
+function i18nprofile_form_translate_category(&$form, $category) {
if (!empty($form[$category])) {
$form[$category]['#title'] = tt('profile:category', $form[$category]['#title']);
foreach (element_children($form[$category]) as $field) {
@@ -233,7 +233,7 @@ function i18nprofile_form_translate_all($form_id, &$form) {
*/
function i18nprofile_categories($getraw = FALSE) {
$language = i18n_get_lang();
- if ($translation = variable_get('i18nprofile_'.$language, 0)) {
+ if ($translation = variable_get('i18nprofile_'. $language, 0)) {
if ($getraw) {
return $translation;
}
@@ -256,7 +256,7 @@ function i18nprofile_categories($getraw = FALSE) {
*
* @ TODO Drupal 6
*/
-function i18nprofile_fields($category){
+function i18nprofile_fields($category) {
static $_fields;
$language = i18n_get_lang();
if (!isset($_fields[$category])) {
diff --git a/i18nstrings/i18nstrings.admin.inc b/i18nstrings/i18nstrings.admin.inc
index b763e38..701561c 100644
--- a/i18nstrings/i18nstrings.admin.inc
+++ b/i18nstrings/i18nstrings.admin.inc
@@ -27,7 +27,7 @@ function i18nstrings_admin_refresh() {
$form['refresh'] = array(
'#type' => 'submit',
'#value' => t('Refresh strings'),
- '#suffix' => '<p>' . t('This will create all the missing strings for the selected text groups.') . '</p>',
+ '#suffix' => '<p>'. t('This will create all the missing strings for the selected text groups.') .'</p>',
);
// Get all languages, except default language.
$languages = locale_language_list('name', TRUE);
@@ -40,7 +40,7 @@ function i18nstrings_admin_refresh() {
$form['update'] = array(
'#type' => 'submit',
'#value' => t('Update translations'),
- '#suffix' => '<p>' . t('This will fetch all existing translations from the localization tables for the selected text groups and languages.') . '</p>',
+ '#suffix' => '<p>'. t('This will fetch all existing translations from the localization tables for the selected text groups and languages.') .'</p>',
);
return $form;
}
@@ -75,7 +75,7 @@ function i18nstrings_admin_update($language, $groups) {
$params[] = $language;
$sql = 'SELECT g.*, t.translation, t.lid as tlid FROM {locales_source} g INNER JOIN {locales_source} s ON g.source = s.source AND s.lid <> g.lid ';
$sql .= 'INNER JOIN {locales_target} t ON s.lid = t.lid LEFT JOIN {locales_target} t2 ON g.lid = t2.lid ';
- $sql .= 'WHERE t2.lid IS NULL AND g.textgroup IN ('. db_placeholders($groups, 'varchar'). ") AND t.language = '%s'";
+ $sql .= 'WHERE t2.lid IS NULL AND g.textgroup IN ('. db_placeholders($groups, 'varchar') .") AND t.language = '%s'";
$result = db_query($sql , $params);
$count = 0;
while ($string = db_fetch_object($result)) {
diff --git a/i18nstrings/i18nstrings.module b/i18nstrings/i18nstrings.module
index 607542f..1e58c40 100644
--- a/i18nstrings/i18nstrings.module
+++ b/i18nstrings/i18nstrings.module
@@ -26,25 +26,25 @@
function i18nstrings_help($path, $arg) {
switch ($path) {
case 'admin/help#i18nstrings':
- $output = '<p>' . t('This module adds support for other modules to translate user defined strings. Depending on which modules you have enabled that use this feature you may see different text groups to translate.') . '<p>';
+ $output = '<p>'. t('This module adds support for other modules to translate user defined strings. Depending on which modules you have enabled that use this feature you may see different text groups to translate.') .'<p>';
$output .= '<ul>';
- $output .= '<li>' . t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) . '</li>';
- $output .= '<li>' . t('If you are missing strings to translate, use the <a href="@refresh-strings">refresh strings</a> page.', array('@refresh-strings' => url('admin/build/translate/refresh'))) . '</li>';
+ $output .= '<li>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</li>';
+ $output .= '<li>'. t('If you are missing strings to translate, use the <a href="@refresh-strings">refresh strings</a> page.', array('@refresh-strings' => url('admin/build/translate/refresh'))) .'</li>';
$output .= '</ul>';
- $output .= '<p>' . t('Read more on the <i>Internationalization handbook</i>: <a href="http://drupal.org/node/313293">Translating user defined strings</a>.') . '</p>';
+ $output .= '<p>'. t('Read more on the <i>Internationalization handbook</i>: <a href="http://drupal.org/node/313293">Translating user defined strings</a>.') .'</p>';
return $output;
case 'admin/build/translate/refresh':
- $output = '<p>' . t('On this page you can refresh and update values for user defined strings.') . '</p>';
+ $output = '<p>'. t('On this page you can refresh and update values for user defined strings.') . '</p>';
$output .= '<ul>';
- $output .= '<li>' . t('Use the refresh option when you are missing strings to translate for a given text group. All the strings will be re-created keeping existing translations.') . '</li>';
- $output .= '<li>' . t('Use the update option when some of the strings had been previously translated with the localization system, but the translations are not showing up for the configurable strings.') . '</li>';
+ $output .= '<li>'. t('Use the refresh option when you are missing strings to translate for a given text group. All the strings will be re-created keeping existing translations.') .'</li>';
+ $output .= '<li>'. t('Use the update option when some of the strings had been previously translated with the localization system, but the translations are not showing up for the configurable strings.') .'</li>';
$output .= '</ul>';
- $output .= '<p>' . t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) . '</p>';
+ $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>';
return $output;
case 'admin/settings/language':
- $output .= '<p>' . t('<strong>Warning</strong>: Changing the default language may have unintended effects on string translations. Read more about <a href="@i18nstrings-help">String translation</a>', array('@i18nstrings-help' => url('admin/help/i18nstrings'))) . '</p>';
+ $output .= '<p>'. t('<strong>Warning</strong>: Changing the default language may have unintended effects on string translations. Read more about <a href="@i18nstrings-help">String translation</a>', array('@i18nstrings-help' => url('admin/help/i18nstrings'))) .'</p>';
return $output;
}
}
@@ -71,7 +71,7 @@ function i18nstrings_menu() {
*/
function i18nstrings_form_alter(&$form, $form_state, $form_id) {
- switch ($form_id){
+ switch ($form_id) {
case 'locale_translate_export_po_form':
case 'locale_translate_import_form':
$names = locale_language_list('name', TRUE);
@@ -154,7 +154,7 @@ function ts($name, $string = '', $langcode = NULL, $update = FALSE) {
function ttd($name, $string, $langcode = NULL, $update = FALSE) {
$context = i18nstrings_context($name, $string);
$context = implode('/', (array)$context);
- return tt($name, $string, $langcode, $update).'[T:' . $string . '(' . $context . ')]';
+ return tt($name, $string, $langcode, $update).'[T:'. $string .'('. $context .')]';
}
/**
@@ -295,7 +295,7 @@ function i18nstrings_add_string($name, $string) {
// Mysql just gets last id for latest query ?
$source->lid = db_last_insert_id('locales_source', 'lid');
// Clear locale cache so this string can be added in a later request.
- cache_clear_all('locale:'.$context->textgroup.':', 'cache', TRUE);
+ cache_clear_all('locale:'. $context->textgroup .':', 'cache', TRUE);
// Create string.
$status = SAVED_NEW;
}
@@ -409,7 +409,7 @@ function i18nstrings_update_context($oldname, $newname) {
$result = db_query("SELECT s.*, i.type, i.objectid, i.property FROM {locales_source} s LEFT JOIN {i18n_strings} i ON s.lid = i.lid WHERE s.textgroup = '%s' AND s.location LIKE '%s'", $oldcontext->textgroup, $location);
while ($source = db_fetch_object($result)) {
// Make sure we have string and context.
- $context = i18nstrings_context($oldcontext->textgroup . ':' . $source->location);
+ $context = i18nstrings_context($oldcontext->textgroup .':'. $source->location);
foreach ($replace as $field => $value) {
$context->$field = $value;
}
@@ -454,7 +454,7 @@ function i18nstrings_textgroup($textgroup, $string = NULL, $langcode = NULL) {
// perspective that is a really bad idea, so we have no user
// interface for this. Be careful when turning this option off!
if (variable_get('locale_cache_strings', 1) == 1) {
- if ($cache = cache_get('locale:'.$textgroup.':'.$langcode, 'cache')) {
+ if ($cache = cache_get('locale:'. $textgroup .':'. $langcode, 'cache')) {
$locale_t[$textgroup][$langcode] = $cache->data;
}
else {
@@ -465,7 +465,7 @@ function i18nstrings_textgroup($textgroup, $string = NULL, $langcode = NULL) {
while ($data = db_fetch_object($result)) {
$locale_t[$textgroup][$langcode][$data->source] = (empty($data->translation) ? TRUE : $data->translation);
}
- cache_set('locale:' . $textgroup . ':' . $langcode, $locale_t[$textgroup][$langcode]);
+ cache_set('locale:'. $textgroup .':'. $langcode, $locale_t[$textgroup][$langcode]);
}
}
}
@@ -485,7 +485,7 @@ function i18nstrings_textgroup($textgroup, $string = NULL, $langcode = NULL) {
// and clear cache, to include the string into caching next time. Saved version is
// also a string-history information for later pruning of the tables.
db_query_range("UPDATE {locales_source} SET version = '%s' WHERE lid = %d", VERSION, $translation->lid, 0, 1);
- cache_clear_all('locale:' . $textgroup . ':', 'cache', TRUE);
+ cache_clear_all('locale:'. $textgroup .':', 'cache', TRUE);
}
}
else {
@@ -493,7 +493,7 @@ function i18nstrings_textgroup($textgroup, $string = NULL, $langcode = NULL) {
db_query("INSERT INTO {locales_source} (location, source, textgroup, version) VALUES ('%s', '%s', 'default', '%s')", request_uri(), $string, VERSION);
$locale_t[$langcode][$string] = TRUE;
// Clear locale cache so this string can be added in a later request.
- cache_clear_all('locale:' . $textgroup . ':', 'cache', TRUE);
+ cache_clear_all('locale:'. $textgroup .':', 'cache', TRUE);
}
}
@@ -505,13 +505,13 @@ function i18nstrings_textgroup($textgroup, $string = NULL, $langcode = NULL) {
*
* I.e.
* 'taxonomy:term:1:name'
- *
+ *
* will become a $context object where
* $context->textgroup = 'taxonomy';
* $context->type = 'term';
* $context->objectid = 1;
* $context->property = 'name';
- *
+ *
* Examples:
* 'taxonomy:title' -> (taxonomy, title, 0, 0)
* 'contenttypes:type:[type]:name'
@@ -533,7 +533,7 @@ function i18nstrings_context($context, $string = NULL) {
}
else {
// We add empty fields at the end before splitting.
- list($textgroup, $type, $objectid, $property) = split(':', $context . ':::');
+ list($textgroup, $type, $objectid, $property) = split(':', $context .':::');
$context = (object)array(
'textgroup' => $textgroup,
'type' => $type,
@@ -567,7 +567,7 @@ function i18nstrings_context_query($context, $alias = 's') {
* Returns the location for the locale table for a string context.
*/
function i18nstrings_location($context) {
- if (is_string($context)){
+ if (is_string($context)) {
$context = i18nstrings_context($context);
}
$location[] = $context->type;
@@ -597,7 +597,7 @@ function i18nstrings_prefetch($context, $langcode = NULL, $join = array(), $cond
$conditions['s.textgroup'] = $value;
}
else {
- $conditions['i.' . $key] = $value;
+ $conditions['i.'. $key] = $value;
}
}
}
@@ -605,17 +605,17 @@ function i18nstrings_prefetch($context, $langcode = NULL, $join = array(), $cond
$where = $params = array();
foreach ($conditions as $key => $value) {
if (is_array($value)) {
- $where[] = $key . ' IN (' . db_placeholders($value, is_int($value[0]) ? 'int' : 'string') . ')';
+ $where[] = $key .' IN ('. db_placeholders($value, is_int($value[0]) ? 'int' : 'string') .')';
$params = array_merge($params, $value);
}
else {
- $where[] = $key . ' = ' . is_int($value) ? '%d' : "'%s'";
+ $where[] = $key .' = '. is_int($value) ? '%d' : "'%s'";
$params[] = $value;
}
}
$sql = "SELECT s.textgroup, s.source, i.type, i.objectid, i.property, t.translation FROM {locales_source} s";
$sql .=" INNER JOIN {i18n_strings} i ON s.lid = i.lid INNER JOIN {locales_target} t ON s.lid = t.lid ";
- $sql .= implode(' ', $join) . ' ' . implode (' AND ', $where);
+ $sql .= implode(' ', $join) .' '. implode (' AND ', $where);
$result = db_query($sql, $params);
// Fetch all rows and store in cache.
diff --git a/i18nsync/i18nsync.module b/i18nsync/i18nsync.module
index 7e52a3f..54e20d9 100644
--- a/i18nsync/i18nsync.module
+++ b/i18nsync/i18nsync.module
@@ -22,16 +22,16 @@
function i18nsync_help($path, $arg) {
switch ($path) {
case 'admin/help#i18nsync' :
- $output = '<p>' . t('This module synchronizes content taxonomy and fields accross translations:') . '</p>';
- $output .= '<p>' . t('First you need to select which fields should be synchronized. Then, after a node has been updated, all enabled vocabularies and fields will be synchronized as follows:') . '</p>';
+ $output = '<p>'. t('This module synchronizes content taxonomy and fields accross translations:') .'</p>';
+ $output .= '<p>'. t('First you need to select which fields should be synchronized. Then, after a node has been updated, all enabled vocabularies and fields will be synchronized as follows:') .'</p>';
$output .= '<ul>';
- $output .= '<li>' . t('All the node fields selected for synchronization will be set to the same value for all translations.') . '</li>';
- $output .= '<li>' . t('For multilingual vocabularies, the terms for all translations will be replaced by the translations of the original node terms.') . '</li>';
- $output .= '<li>' . t('For other vocabularies, the terms will be just copied over to all the translations.');
+ $output .= '<li>'. t('All the node fields selected for synchronization will be set to the same value for all translations.') .'</li>';
+ $output .= '<li>'. t('For multilingual vocabularies, the terms for all translations will be replaced by the translations of the original node terms.') .'</li>';
+ $output .= '<li>'. t('For other vocabularies, the terms will be just copied over to all the translations.') .'</li>';
$output .= '</ul>';
- $output .= '<p><strong>' . t('Note that permissions are not checked for each node. So if someone can edit a node and it is set to synchronize, all the translations will be synchronized anyway.') . '</strong></p>';
- $output .= '<p>' . t('To enable synchronization check content type options to select which fields to synchronize for each node type') . '</p>';
- $output .= '<p>' . t('The list of available fields for synchronization will include some standard node fields and all CCK fields. You can add more fields to the list in a configuration variable. See README.txt for how to do it.') . '</p>';
+ $output .= '<p><strong>' . t('Note that permissions are not checked for each node. So if someone can edit a node and it is set to synchronize, all the translations will be synchronized anyway.') .'</strong></p>';
+ $output .= '<p>'. t('To enable synchronization check content type options to select which fields to synchronize for each node type') .'</p>';
+ $output .= '<p>'. t('The list of available fields for synchronization will include some standard node fields and all CCK fields. You can add more fields to the list in a configuration variable. See README.txt for how to do it.') .'</p>';
$output .= '<p>'. t('For more information, see the online handbook entry for <a href="@i18n">Internationalization module</a>.', array('@i18n' => 'http://drupal.org/node/133977')) .'</p>';
return $output;
}
@@ -93,8 +93,8 @@ function i18nsync_form_alter(&$form, $form_state, $form_id) {
/**
* Theming function for workflow checkboxes.
*/
-function theme_i18nsync_workflow_checkbox($element){
- $output = $element['#group_title'] ? '<div class="description">' . $element['#group_title'] . '</div>' : '';
+function theme_i18nsync_workflow_checkbox($element) {
+ $output = $element['#group_title'] ? '<div class="description">'. $element['#group_title'] .'</div>' : '';
$output .= theme('checkbox', $element);
return $output;
}
@@ -152,10 +152,10 @@ function i18nsync_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
/**
* Prepare node translation. Copy over sincronizable fields.
*/
-function i18nsync_prepare_translation(&$node, $source, $field_list){
+function i18nsync_prepare_translation(&$node, $source, $field_list) {
foreach ($field_list as $field) {
if (empty($source->$field)) continue;
- switch($field) {
+ switch ($field) {
case 'taxonomy':
i18nsync_taxonomyfield($node, $source);
break;
@@ -212,7 +212,7 @@ function i18nsync_node_translation($node, $translation, $fields, $op) {
continue;
}
else {
- switch($field) {
+ switch ($field) {
case 'taxonomy': // Do nothing it has already been syncd.
i18nsync_taxonomyfield($translation, $node);
break;
@@ -297,7 +297,7 @@ function i18nsync_node_translation_attached_node(&$node, &$translation, $field)
* Node type.
*/
function i18nsync_node_fields($type) {
- return variable_get('i18nsync_nodeapi_'.$type, array());
+ return variable_get('i18nsync_nodeapi_'. $type, array());
}
/**
@@ -338,12 +338,12 @@ function i18nsync_node_available_fields($type) {
$fields += variable_get("i18nsync_fields_node_$type", array());
// Image attach.
- if (variable_get('image_attach_' . $type, 0)) {
+ if (variable_get('image_attach_'. $type, 0)) {
$fields['image']['#title'] = t('Image Attach module');
$fields['image']['#options']['iid'] = t('Attached image nodes');
}
// Event fields.
- if (variable_get('event_nodeapi_' . $type, 'never') != 'never') {
+ if (variable_get('event_nodeapi_'. $type, 'never') != 'never') {
$fields['event']['#title'] = t('Event fields');
$fields['event']['#options'] = array(
'event_start' => t('Event start'),
@@ -382,4 +382,4 @@ function i18nsync_node_available_fields($type) {
array
...
'type_name' => string 'test' (length=4)
-*/
+ */
diff --git a/i18ntaxonomy/i18ntaxonomy.admin.inc b/i18ntaxonomy/i18ntaxonomy.admin.inc
index fe495af..9c82c7e 100644
--- a/i18ntaxonomy/i18ntaxonomy.admin.inc
+++ b/i18ntaxonomy/i18ntaxonomy.admin.inc
@@ -45,7 +45,7 @@ function i18ntaxonomy_translation_term_form($form_state, $vid, $trid = NULL, $ed
'#type' => 'hidden',
'#value' => $trid
);
- $translations = i18ntaxonomy_term_get_translations(array('trid' =>$trid));
+ $translations = i18ntaxonomy_term_get_translations(array('trid' => $trid));
}
//var_dump($translations);
$vocabulary = taxonomy_vocabulary_load($vid);
@@ -79,7 +79,7 @@ function i18ntaxonomy_translation_term_form($form_state, $vid, $trid = NULL, $ed
}
$form['destination'] = array(
'#type' => 'hidden',
- '#value' => 'admin/content/taxonomy/' . arg(3) . '/translation'
+ '#value' => 'admin/content/taxonomy/'. arg(3) .'/translation'
);
return $form;
}
@@ -112,7 +112,7 @@ function i18ntaxonomy_translation_term_form_submit($form, &$form_state) {
*/
function i18ntaxonomy_translation_save($terms, $trid = 0) {
// Delete old translations for this trid.
- if ($trid){
+ if ($trid) {
db_query("UPDATE {term_data} SET trid = 0 WHERE trid = %d", $trid);
}
// Now pick up all the tids in an array.
@@ -128,7 +128,7 @@ function i18ntaxonomy_translation_save($terms, $trid = 0) {
db_query('LOCK TABLES {term_data} WRITE');
$trid = (is_numeric($trid) && $trid) ? $trid : i18ntaxonomy_next_trid();
$params = array_merge(array($trid), $translations);
- db_query('UPDATE {term_data} SET trid = %d WHERE tid IN(' . db_placeholders($translations). ')', $params);
+ db_query('UPDATE {term_data} SET trid = %d WHERE tid IN('. db_placeholders($translations) .')', $params);
db_query('UNLOCK TABLES');
}
}
@@ -167,7 +167,7 @@ function i18ntaxonomy_translation_overview($vid) {
$thisrow = array();
foreach ($languages as $lang => $name) {
if (array_key_exists($lang, $terms)) {
- $thisrow[] = l($terms[$lang]->name, 'taxonomy/term/' . $terms[$lang]->tid);
+ $thisrow[] = l($terms[$lang]->name, 'taxonomy/term/'. $terms[$lang]->tid);
}
else {
$thisrow[] = '--';
@@ -178,7 +178,8 @@ function i18ntaxonomy_translation_overview($vid) {
}
if ($rows) {
$output .= theme('table', $header, $rows);
- } else {
+ }
+ else {
$messages[] = t('No translations defined for this vocabulary.');
}
$messages[]= l(t('Create new translation'), "admin/content/taxonomy/$vid/translation/edit/new");
diff --git a/i18ntaxonomy/i18ntaxonomy.module b/i18ntaxonomy/i18ntaxonomy.module
index f9d91da..705bd96 100644
--- a/i18ntaxonomy/i18ntaxonomy.module
+++ b/i18ntaxonomy/i18ntaxonomy.module
@@ -34,19 +34,19 @@ define('I18N_TAXONOMY_TRANSLATE', 3);
function i18ntaxonomy_help($path, $arg) {
switch ($path) {
case 'admin/help#i18ntaxonomy' :
- $output = '<p>' . t('This module adds support for multilingual taxonomy. You can set up multilingual options for each vocabulary:') . '</p>';
+ $output = '<p>'. t('This module adds support for multilingual taxonomy. You can set up multilingual options for each vocabulary:') .'</p>';
$output .= '<ul>';
- $output .= '<li>' . t('A language can be assigned globaly for a vocabulary.') . '</li>';
- $output .= '<li>' . t('Different terms for each language with translation relationships.') . '</li>';
- $output .= '<li>' . t('Terms can be common to all languages, but may be localized.') . '</li>';
+ $output .= '<li>'. t('A language can be assigned globaly for a vocabulary.') .'</li>';
+ $output .= '<li>'. t('Different terms for each language with translation relationships.') .'</li>';
+ $output .= '<li>'. t('Terms can be common to all languages, but may be localized.') .'</li>';
$output .= '</ul>';
- $output .= '<p>' . t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) . '</p>';
- $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@i18n">Internationalization module</a>.', array('@i18n' =>'http://drupal.org/node/133977')) . '</p>';
+ $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>';
+ $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@i18n">Internationalization module</a>.', array('@i18n' =>'http://drupal.org/node/133977')) .'</p>';
return $output;
case 'admin/settings/i18n':
$output = '<ul>';
- $output .= '<li>' . t('To set up multilingual options for vocabularies go to <a href="@configure_taxonomy">Taxonomy configuration page</a>.', array('@configure_taxonomy' => url('admin/content/taxonomy'))) . '</li>';
+ $output .= '<li>'. t('To set up multilingual options for vocabularies go to <a href="@configure_taxonomy">Taxonomy configuration page</a>.', array('@configure_taxonomy' => url('admin/content/taxonomy'))) .'</li>';
$output . '</ul>';
return $output;
@@ -54,13 +54,13 @@ function i18ntaxonomy_help($path, $arg) {
$vocabulary = taxonomy_vocabulary_load($arg[3]);
switch (i18ntaxonomy_vocabulary($vocabulary->vid)) {
case I18N_TAXONOMY_LOCALIZE:
- return '<p>' . t('%capital_name is a localizable vocabulary. You will be able to translate term names and descriptions using the localization interface.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name)) . '</p>';
+ return '<p>'. t('%capital_name is a localizable vocabulary. You will be able to translate term names and descriptions using the localization interface.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name)) .'</p>';
case I18N_TAXONOMY_LANGUAGE:
- return '<p>' . t('%capital_name is a vocabulary with a fixed language. All the terms in this vocabulary will have %language language.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name, '%language' => i18n_language_property($vocabulary->language, 'name'))) . '</p>';
+ return '<p>'. t('%capital_name is a vocabulary with a fixed language. All the terms in this vocabulary will have %language language.', array('%capital_name' => drupal_ucfirst($vocabulary->name), '%name' => $vocabulary->name, '%language' => i18n_language_property($vocabulary->language, 'name'))) .'</p>';
case I18N_TAXONOMY_TRANSLATE:
- return '<p>' . t('%capital_name is a full multilingual vocabulary. You will be able to set a language for each term and create translation relationships.', array('%capital_name' => drupal_ucfirst($vocabulary->name))) . '</p>';
+ return '<p>'. t('%capital_name is a full multilingual vocabulary. You will be able to set a language for each term and create translation relationships.', array('%capital_name' => drupal_ucfirst($vocabulary->name))) .'</p>';
}
}
@@ -212,7 +212,7 @@ function i18ntaxonomy_translation_tids($str_tids, $lang) {
}
/**
- * Implementation of hook_taxonomy.
+ * Implementation of hook_taxonomy().
*
* $edit parameter may be an array or an object !!
*/
@@ -262,7 +262,7 @@ function i18ntaxonomy_taxonomy($op, $type, $edit = NULL) {
/**
* Implementation of hook_db_rewrite_sql().
*/
-function i18ntaxonomy_db_rewrite_sql($query, $primary_table, $primary_key){
+function i18ntaxonomy_db_rewrite_sql($query, $primary_table, $primary_key) {
// No rewrite for administration pages or mode = off.
$mode = i18n_selection_mode();
if ($mode == 'off' || arg(0) == 'admin') return;
@@ -295,7 +295,7 @@ function i18ntaxonomy_form_alter(&$form, $form_state, $form_id) {
$languages = locale_language_list('name');
foreach ($vocabularies as $vocabulary) {
if ($vocabulary->language) {
- $form[$vocabulary->vid]['types']['#value'] .= '&nbsp(' . $languages[$vocabulary->language] . ')';
+ $form[$vocabulary->vid]['types']['#value'] .= '&nbsp('. $languages[$vocabulary->language] .')';
}
}
break;
@@ -306,7 +306,7 @@ function i18ntaxonomy_form_alter(&$form, $form_state, $form_id) {
$languages = locale_language_list('name');
foreach (element_children($form) as $key) {
if (isset($form[$key]['#term']) && ($lang = $form[$key]['#term']['language'])) {
- $form[$key]['view']['#value'] .= '&nbsp(' . $languages[$lang] . ')';
+ $form[$key]['view']['#value'] .= '&nbsp('. $languages[$lang] .')';
}
}
}
@@ -360,19 +360,28 @@ function i18ntaxonomy_form_alter(&$form, $form_state, $form_id) {
break;
case I18N_TAXONOMY_LANGUAGE:
- $form['language'] = array('#type' => 'value', '#value' => $vocabulary->language);
+ $form['language'] = array(
+ '#type' => 'value',
+ '#value' => $vocabulary->language
+ );
$form['identification']['language_info'] = array('#value' => t('All terms in this vocabulary have a fixed language: %language', array('%language' => i18n_language_property($vocabulary->language, 'name'))));
break;
case I18N_TAXONOMY_LOCALIZE:
- $form['language'] = array('#type' => 'value', '#value' => '');
- $form['identification']['name']['#description'] .= ' <strong>' . t('This name will be localizable.') .'</strong>';
- $form['identification']['description']['#description'] .= ' <strong>' . t('This description will be localizable.') . '</strong>';
+ $form['language'] = array(
+ '#type' => 'value',
+ '#value' => ''
+ );
+ $form['identification']['name']['#description'] .= ' <strong>'. t('This name will be localizable.') .'</strong>';
+ $form['identification']['description']['#description'] .= ' <strong>'. t('This description will be localizable.') .'</strong>';
break;
case I18N_TAXONOMY_NONE:
default:
- $form['language'] = array('#type' => 'value', '#value' => '');
+ $form['language'] = array(
+ '#type' => 'value',
+ '#value' => ''
+ );
break;
}
break;
@@ -472,7 +481,7 @@ function _i18ntaxonomy_term_select($title, $name, $value, $vocabulary_id, $descr
* Returns a list for terms for vocabulary, language.
*/
function i18ntaxonomy_vocabulary_get_terms($vid, $lang, $status = 'all') {
- switch($status) {
+ switch ($status) {
case 'translated':
$result = db_query("SELECT * FROM {term_data} WHERE vid = %d AND language = '%s' AND trid > 0", $vid, $lang);
break;
@@ -487,7 +496,7 @@ function i18ntaxonomy_vocabulary_get_terms($vid, $lang, $status = 'all') {
}
$list = array();
while ($term = db_fetch_object($result)) {
- $list[$term->tid] = $term->name;
+ $list[$term->tid] = $term->name;
}
return $list;
}
@@ -507,7 +516,7 @@ function i18ntaxonomy_term_get_translations($params, $getall = TRUE) {
$conds[] = "i.$field = '%s'";
$values[] = $value;
}
- if (!$getall){ // If not all, a parameter must be tid.
+ if (!$getall) { // If not all, a parameter must be tid.
$conds[] = "t.tid != %d";
$values[] = $params['tid'];
}
diff --git a/i18ntaxonomy/i18ntaxonomy.pages.inc b/i18ntaxonomy/i18ntaxonomy.pages.inc
index d38b543..441080d 100644
--- a/i18ntaxonomy/i18ntaxonomy.pages.inc
+++ b/i18ntaxonomy/i18ntaxonomy.pages.inc
@@ -94,7 +94,7 @@ function i18ntaxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
* @ingroup themeable
*/
function theme_taxonomy_term_page($tids, $result) {
- drupal_add_css(drupal_get_path('module', 'taxonomy') . '/taxonomy.css');
+ drupal_add_css(drupal_get_path('module', 'taxonomy') .'/taxonomy.css');
$output = '';
@@ -102,7 +102,7 @@ function theme_taxonomy_term_page($tids, $result) {
if (count($tids) == 1) {
$term = taxonomy_get_term($tids[0]);
if (i18ntaxonomy_vocabulary($term->vid) == I18N_TAXONOMY_LOCALIZE) {
- $description = tt('taxonomy:term:' . $term->tid . ':description', $term->description);
+ $description = tt('taxonomy:term:'. $term->tid .':description', $term->description);
}
else {
$description = $term->description;
diff --git a/i18nviews/i18nviews.module b/i18nviews/i18nviews.module
index d2be54c..fe7586a 100644
--- a/i18nviews/i18nviews.module
+++ b/i18nviews/i18nviews.module
@@ -16,8 +16,8 @@
function i18nviews_help($path, $arg) {
switch ($path) {
case 'admin/modules#description' :
- $output = '<p>' . t('Supports translation for views strings: title, header, footer...') . '</p>';
- $output .= '<p>' . t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) . '</p>';
+ $output = '<p>'. t('Supports translation for views strings: title, header, footer...') .'</p>';
+ $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>';
return $output;
}
}
@@ -72,7 +72,7 @@ function i18nviews_views_pre_view(&$view, &$display_id, &$args) {
// That's a full taxonomy box.
$view->field[$index]['handler'] = 'i18ntaxonomy_views_handler_field_allterms';
}
- elseif(preg_match("/term_node_(\d+)\.name/", $data['id'], $matches)) {
+ elseif (preg_match("/term_node_(\d+)\.name/", $data['id'], $matches)) {
$vid = $matches[1];
if ($translate[$vid]) {
// Set new handler for this field.