summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Reyero2006-05-11 22:00:45 (GMT)
committer Jose Reyero2006-05-11 22:00:45 (GMT)
commit5eb277a1b4a38250130e0e1528b593c6ab0737d6 (patch)
treee2dff0fa251573ef4c67b3e3178813d939bb8841
parent93bfcece054185bd6c02ee7c08dc3c43d844ffd2 (diff)
Fixed: http://drupal.org/node/22345
Removed database scripts, now included in the install file
-rw-r--r--i18n.inc16
-rw-r--r--i18n.mysql34
-rw-r--r--i18n.pgsql28
-rw-r--r--translation.module4
4 files changed, 13 insertions, 69 deletions
diff --git a/i18n.inc b/i18n.inc
index 599f682..6345073 100644
--- a/i18n.inc
+++ b/i18n.inc
@@ -285,12 +285,18 @@ function i18n_get_lang() {
}
}
-// Note: do not call url() anymore, it will be called from l()
-function i18n_url($url, $lang) {
- if (!$url || $url == variable_get('site_frontpage', 'node')) {
+/**
+ * Produces i18n paths
+ * If path is empty or site frontpage, path = 'lang'
+ * Search for alias before adding language
+ */
+function i18n_path($path, $lang) {
+ if (!$path || $path == variable_get('site_frontpage', 'node')) {
return $lang;
+ } elseif($alias = drupal_lookup_path('alias', $path) ) {
+ return $lang.'/'.$alias;
} else {
- return $lang.'/'.$url;
+ return $lang.'/'.$path;
}
}
@@ -332,7 +338,7 @@ function i18n_block($op = 'list', $delta = 0) {
*/
function i18n_get_links($path = '') {
foreach(i18n_supported_languages() as $lang => $name){
- $links[$lang]= theme('i18n_link', $name, i18n_url($path, $lang), $lang);
+ $links[$lang]= theme('i18n_link', $name, i18n_path($path, $lang), $lang);
}
return $links;
}
diff --git a/i18n.mysql b/i18n.mysql
deleted file mode 100644
index 6b420f1..0000000
--- a/i18n.mysql
+++ /dev/null
@@ -1,34 +0,0 @@
---
--- Table: 'i18n_node'
---
-
-CREATE TABLE `i18n_node` (
- `nid` int(11) unsigned NOT NULL ,
- `trid` int(10) unsigned NOT NULL default '0',
- `language` VARCHAR(12) NOT NULL default '',
- `status` smallint(6) NOT NULL default '0',
- PRIMARY KEY (`nid`)
-);
-
-# Add language field to term_data
-
-ALTER TABLE `term_data`
- ADD `language` varchar(12) NOT NULL default '';
-ALTER TABLE `term_data`
- ADD `trid` int(10) unsigned NOT NULL default '0';
-
-# Add language to vocabulary
-
-ALTER TABLE `vocabulary`
-ADD `language` varchar(12) NOT NULL default '';
-
---
--- Table structure for table 'i18n_variable'
---
-
-CREATE TABLE i18n_variable (
- name varchar(48) NOT NULL default '',
- language varchar(12) NOT NULL default '',
- value longtext NOT NULL,
- PRIMARY KEY (name, language)
-);
diff --git a/i18n.pgsql b/i18n.pgsql
deleted file mode 100644
index c4265eb..0000000
--- a/i18n.pgsql
+++ /dev/null
@@ -1,28 +0,0 @@
---
--- Table: 'i18n_node'
---
-
-CREATE TABLE i18n_node (
- nid integer NOT NULL default '0',
- trid integer NOT NULL default '0',
- language varchar(12) NOT NULL default '',
- status smallint NOT NULL default '0',
- PRIMARY KEY (nid)
-);
-
-CREATE SEQUENCE i18n_node_trid_seq INCREMENT 1 START 1;
-
-
-CREATE SEQUENCE term_data_trid_seq INCREMENT 1 START 1;
-
--- Add language and trid fields to term_data
-ALTER TABLE term_data ADD language varchar(12);
-UPDATE term_data SET language='';
-ALTER TABLE term_data ALTER COLUMN language SET NOT NULL;
-ALTER TABLE term_data ALTER COLUMN language SET DEFAULT '';
-
--- Add language field to vocabulary
-ALTER TABLE vocabulary ADD language varchar(12);
-UPDATE vocabulary SET language='';
-ALTER TABLE term_data ALTER COLUMN language SET NOT NULL;
-ALTER TABLE term_data ALTER COLUMN language SET DEFAULT '';
diff --git a/translation.module b/translation.module
index 3886c99..f9d42aa 100644
--- a/translation.module
+++ b/translation.module
@@ -617,7 +617,7 @@ function translation_get_links($path = '', $names = 1) {
foreach(i18n_supported_languages() as $lang => $name){
$url = translation_url($path, $lang);
$name = $names ? $name: '' ; // Should be localized??
- $links[]= theme('i18n_link', $name, "$lang/$url" , $lang);
+ $links[]= theme('i18n_link', $name, i18n_path($url, $lang) , $lang);
}
return $links;
}
@@ -633,7 +633,7 @@ function theme_translation_node_link($node, $lang, $baselang = NULL, $title = FA
$languages = i18n_supported_languages();
$name = $languages[$lang];
}
- return theme('i18n_link', $name, "$baselang/node/$node->nid", $lang);
+ return theme('i18n_link', $name, i18n_path('node/'.$node->nid, $baselang), $lang);
}
function theme_translation_link($text, $target, $lang, $separator=' ') {