diff --git a/modules/comment.page_title.inc b/modules/comment.page_title.inc
index 91e83d9..180b4ba 100644
--- a/modules/comment.page_title.inc
+++ b/modules/comment.page_title.inc
@@ -33,6 +33,10 @@ function comment_page_title_alter(&$title) {
 function comment_page_title_pattern_alter(&$pattern, &$types) {
   // Comment reply page
   if (arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) {
+    global $language;
+    // Keys
+    $default_comment_child_reply_pattern_key = 'page_title_comment_child_reply';
+    $default_comment_reply_pattern_key = 'page_title_comment_reply';
     // The node ID position is in arg 2...
     $types['node'] = menu_get_object('node', 2);
 
@@ -46,11 +50,13 @@ function comment_page_title_pattern_alter(&$pattern, &$types) {
     if (($pid = arg(3)) && $comment = _comment_load($pid)) {
       // Reply to comment...
       $types['comment'] = $comment;
-      $pattern = variable_get('page_title_comment_child_reply', '');
+      $lang_pattern_key = !empty($language) ? $default_comment_child_reply_pattern_key . '_' . $language->language : $default_comment_child_reply_pattern_key;
+      $pattern = variable_get($lang_pattern_key, '');
     }
     else {
       // Reply to node...
-      $pattern = variable_get('page_title_comment_reply', '');
+      $lang_pattern_key = !empty($language) ? $default_comment_reply_pattern_key . '_' . $language->language : $default_comment_reply_pattern_key;
+      $pattern = variable_get($lang_pattern_key, '');
     }
   }
 }
diff --git a/modules/forum.page_title.inc b/modules/forum.page_title.inc
index ca4658c..a38f03c 100644
--- a/modules/forum.page_title.inc
+++ b/modules/forum.page_title.inc
@@ -25,17 +25,25 @@ function forum_page_title_alter(&$title) {
  * Implementation of hook_page_title_pattern_alter().
  */
 function forum_page_title_pattern_alter(&$pattern, &$types) {
+  global $language;
+
+  // Setting up keys
+  $default_forum_vocab_pattern_key = 'page_title_vocab';
+  $default_forum_root_pattern_key = 'page_title_forum_root_title';
+
   // Forums Page title Patterns
   if (arg(0) == 'forum') {
     // If there is a numeric argument, then we're viewing a container or forum
     if (is_numeric(arg(1))) {
       $types['taxonomy'] = taxonomy_get_term(arg(1));
       $forum_vid = variable_get('forum_nav_vocabulary', '');
-      $pattern = variable_get('page_title_vocab_'. $forum_vid, '');
+      $lang_pattern_key = !empty($language) ? $default_forum_vocab_pattern_key . '_' . $forum_vid . '_' . $language->language : $default_forum_vocab_pattern_key;
+      $pattern = variable_get($lang_pattern_key, '');
     }
     // Otherwise its the root - lets grab the root pattern.
     else {
-      $pattern = variable_get('page_title_forum_root_title', '');
+      $lang_pattern_key = !empty($language) ? $default_forum_root_pattern_key . '_' . $language->language : $default_forum_root_pattern_key;
+      $pattern = variable_get($lang_pattern_key, '');
     }
   }
 }
diff --git a/modules/node.page_title.inc b/modules/node.page_title.inc
index e67a572..7e868ec 100644
--- a/modules/node.page_title.inc
+++ b/modules/node.page_title.inc
@@ -30,12 +30,13 @@ function node_page_title_pattern_alter(&$pattern, &$types) {
   if ((arg(0) == 'node' && is_numeric(arg(1)))) {
     $types['node'] = menu_get_object();
 
+    $default_pattern_key = 'page_title_type_'. $types['node']->type;
+    $lang_pattern_key = !empty($types['node']->language) ? $default_pattern_key . '_' . $types['node']->language : $default_pattern_key;
+    $pattern = variable_get($lang_pattern_key, '');
     // If the node has any taxonomy, grab the first time and pass it over to be passed as a token.
     // TODO: Handle multiple terms? Only pass specific terms per content type?
     if (!empty($types['node']->taxonomy)) {
       $types['taxonomy'] = current($types['node']->taxonomy);
     }
-
-    $pattern = variable_get('page_title_type_'. $types['node']->type, '');
   }
 }
diff --git a/modules/page_title.page_title.inc b/modules/page_title.page_title.inc
index cd03e37..8af2489 100644
--- a/modules/page_title.page_title.inc
+++ b/modules/page_title.page_title.inc
@@ -29,7 +29,18 @@ function page_title_page_title_alter(&$title) {
 function page_title_page_title_pattern_alter(&$pattern, &$data = array()) {
   // If frontpage, then use the frontpage pattern and set the title.
   if (drupal_is_front_page()) {
-    // Get the frontpage pattern
-    $pattern = variable_get('page_title_front', '[site-name] | [site-slogan]');
+    global $language;
+
+    // Setting up keys
+    $default_pattern_key = 'page_title_front';
+    $lang_pattern_key = 'page_title_front'. '_' . $language->language;
+
+    // Get pattern
+    $pattern = variable_get($lang_pattern_key, '');
+
+    // Fallback for frontpage
+    if (empty($pattern)) {
+      $pattern = variable_get($default_pattern_key, '[page-title] | [site-name]');
+    }
   }
 }
diff --git a/modules/taxonomy.page_title.inc b/modules/taxonomy.page_title.inc
index ae86426..bd95fa1 100644
--- a/modules/taxonomy.page_title.inc
+++ b/modules/taxonomy.page_title.inc
@@ -27,7 +27,10 @@ function taxonomy_page_title_alter(&$title) {
 function taxonomy_page_title_pattern_alter(&$pattern, &$types) {
   // Taxonomy Term Page
   if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)) && module_exists('taxonomy')) {
+    global $language;
     $types['taxonomy'] = taxonomy_get_term(arg(2));
-    $pattern = variable_get('page_title_vocab_'. $types['taxonomy']->vid, '');
+    $default_taxonomy_pattern_key = 'page_title_vocab' . '_' . $types['taxonomy']->vid;
+    $lang_key = $default_taxonomy_pattern_key . '_' . $language->language;
+    $pattern = variable_get($lang_key, '');
   }
 }
diff --git a/modules/user.page_title.inc b/modules/user.page_title.inc
index 1b96364..2301689 100644
--- a/modules/user.page_title.inc
+++ b/modules/user.page_title.inc
@@ -24,14 +24,20 @@ function user_page_title_alter(&$title) {
  * Implementation of hook_page_title_pattern_alter().
  */
 function user_page_title_pattern_alter(&$pattern, &$types) {
-  // User
+  global $language;
+  // Setting up keys
+  $default_user_pattern_key = 'page_title_user';
+  $default_blog_pattern_key = 'page_title_blog';
+  $lang_pattern_user_key = !empty($language) ? $default_user_pattern_key . '_' . $language->language : $default_user_pattern_key;
+  $lang_pattern_blog_key = !empty($language) ? $default_blog_pattern_key . '_' . $language->language : $default_blog_pattern_key;
   if (arg(0) == 'user' && is_numeric(arg(1))) {
+    // User
     $types['user'] = user_load(array('uid' => arg(1)));
-    $pattern = variable_get('page_title_user', '');
+    $pattern = variable_get($lang_pattern_user_key, '');
   }
-  // Blog
   elseif (arg(0) == 'blog' && is_numeric(arg(1))) {
+    // Blog
     $types['user'] = user_load(array('uid' => arg(1)));
-    $pattern = variable_get('page_title_blog', '');
+    $pattern = variable_get($lang_pattern_blog_key, '');
   }
 }
diff --git a/modules/views.page_title.inc b/modules/views.page_title.inc
index 23b560d..c799284 100644
--- a/modules/views.page_title.inc
+++ b/modules/views.page_title.inc
@@ -1,5 +1,5 @@
 <?php
-// $Id: views.page_title.inc,v 1.1.2.3 2010/10/31 12:23:51 njt1982 Exp $
+// $Id: views.page_title.inc,v 1.1.2.2 2010/08/25 12:54:05 njt1982 Exp $
 
 /**
  * @file
diff --git a/page_title-admin-settings-form.tpl.php b/page_title-admin-settings-form.tpl.php
index 850891c..23948ce 100644
--- a/page_title-admin-settings-form.tpl.php
+++ b/page_title-admin-settings-form.tpl.php
@@ -3,7 +3,7 @@
 
 /**
  * @file
- * Tempalte file for the admin settings form. Displays configuration in a neat table
+ * Template file for the admin settings form. Displays configuration in a neat table
  */
 
 $rows = array();
@@ -18,27 +18,26 @@ foreach (element_children($form['pattern']) as $key) {
 
   $row = array(
     array('data' => drupal_render($title), 'class' => 'page-type'),
+    array('data' => drupal_render($form['language'][$key]), 'class' => 'language'),
     array('data' => drupal_render($form['scope'][$key]), 'class' => 'scope'),
   );
   if (isset($form['showfield'][$key .'_showfield'])) {
     $row[] = array('data' => drupal_render($form['pattern'][$key]), 'class' => 'pattern');
-    $row[] = array('data' => drupal_render($form['showfield'][$key .'_showfield']), 'class' => 'showfield');
   }
   else {
     $row[] = array('data' => drupal_render($form['pattern'][$key]), 'colspan' => 2, 'class' => 'pattern');
   }
 
-  $rows[] = $row;
+$rows[] = $row;
 }
 
 $headers = array(
   array('data' => t('Page Type'), 'class' => 'page-type'),
+  array('data' => t('Language'), 'class' => 'language'),
   array('data' => t('Token Scope'), 'class' => 'scope'),
   array('data' => t('Pattern'), 'class' => 'pattern'),
-  array('data' => t('Show Field'), 'class' => 'showfie;d'),
 );
 
-
 drupal_add_css(drupal_get_path('module', 'page_title') .'/page_title.admin.css', 'module', 'all', FALSE);
 print theme('table', $headers, $rows, array('id' => 'page-title-settings'));
 
diff --git a/page_title.admin.css b/page_title.admin.css
index fd73b35..855f883 100644
--- a/page_title.admin.css
+++ b/page_title.admin.css
@@ -1,10 +1,16 @@
+table#page-title-settings thead th { text-align:center; }
+
 table#page-title-settings th.showfield { text-align:center; }
-table#page-title-settings th.scope { text-align:center; }
-table#page-title-settings th.page-type { text-align:right; }
+table#page-title-settings th.scope { text-align:left; }
+table#page-title-settings th.page-type { text-align:left; }
+table#page-title-settings th.language { text-align:left; }
+table#page-title-settings th.pattern { text-align:left; }
 
 table#page-title-settings td.showfield { width:10%; text-align:center; }
-table#page-title-settings td.scope { text-align:center; }
-table#page-title-settings td.page-type { text-align:right; }
+table#page-title-settings td.scope { text-align:left; }
+table#page-title-settings td.language { text-align:left; }
+table#page-title-settings td.page-type { text-align:left; }
+table#page-title-settings td.pattern input { text-align:left; width: 95%;}
 
 div.view-list-page-titles th.views-field-nid       { width:5%; }
 div.view-list-page-titles th.views-field-edit-node { width:20%; }
diff --git a/page_title.admin.inc b/page_title.admin.inc
index 5ef7c95..30c5d62 100644
--- a/page_title.admin.inc
+++ b/page_title.admin.inc
@@ -16,156 +16,156 @@ function page_title_admin_settings() {
   // Define a default looking 'form element' for setting.
   $showfield_form_element = array('#type' => 'checkbox', );
 
-
   // Define a default looking 'form element' for setting.
   $pattern_form_element = array(
     '#type' => 'textfield',
-    '#size' => 30,
+    '#size' => 50,
     '#maxlength' => 256,
   );
 
-
-  // Set the theme callback for the patterns section
-  $form['patterns'] = array(
+  // General form
+  $form['patterns']['general'] = array(
     '#type' => 'fieldset',
-    '#title' => t('Page Title Patterns'),
+    '#title' => t('General'),
+    '#description' => t('Default pattern will be used as a fallback (ie, when no other pattern is defined)'),
     '#collapsible' => TRUE,
-    '#theme' => 'page_title_admin_settings'
+    '#weight' => 0,
+    '#theme' => 'page_title_admin_settings',
+    'showfield' => array(
+      '#type' => 'radios',
+      '#title' => t('Showfield settings'),
+      '#description' => t('Activating showfield will allow you to define custom page titles on page edit.'),
+    )
   );
-
-
-  // Define the basic scope column values
-  $form['patterns']['scope'] = array(
-    'page_title_default'             => array('#type' => 'markup', '#value' => t('Global'), ),
-    'page_title_front'               => array('#type' => 'markup', '#value' => t('Global'), ),
-    'page_title_comment_reply'       => array('#type' => 'markup', '#value' => t('Node'), ),
-    'page_title_comment_child_reply' => array('#type' => 'markup', '#value' => t('Node') .'<br />'. t('Comment'), ),
-    'page_title_pager_pattern'       => array('#type' => 'markup', '#value' => t('Global'), ),
-    'page_title_user'                => array('#type' => 'markup', '#value' => t('User'), ),
+  // Content types form
+  $form['patterns']['content_type'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Content Types'),
+    '#description' => t('The following patterns will be used on pages like /node/4'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#weight' => 1,
+    '#theme' => 'page_title_admin_settings',
+    'showfield' => array(
+      '#type' => 'radios',
+      '#title' => t('Showfield settings'),
+      '#description' => t('Activating showfield will allow you to define custom page titles on page edit.'),
+    )
+  );
+  // Taxonomy form
+  $form['patterns']['taxonomy'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Taxonomy'),
+    '#description' => t('The following patterns will be used on pages like /taxonomy/term/4'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#weight' => 2,
+    '#theme' => 'page_title_admin_settings',
+    'showfield' => array(
+      '#type' => 'radios',
+      '#title' => t('Showfield settings'),
+      '#description' => t('Activating showfield will allow you to define custom page titles on page edit.'),
+    )
+  );
+  // Specific form
+  $form['patterns']['specific'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('More...'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#weight' => 3,
+    '#theme' => 'page_title_admin_settings',
   );
 
+  // List of all enabled languages
+  if (module_exists('locale')) {
+    $langs = array('' => t('Language neutral')) + locale_language_list('name');
+  }
+  else {
+    $langs = array();
+  }
+
+  // Initialisation of specific settings of patterns
+  _page_title_init_patterns_options($patterns);
 
-  // Define the 'default' token patterns
-  $form['patterns']['pattern'] = array(
-    //Define the default pattern - this is a "fallback" pattern.
-    'page_title_default' => array(
+  // GENERAL AND SPECIFIC PATTERNS
+  // default fallback pattern
+  $form['patterns']['general']['pattern']['page_title_default'] = array(
       '#title' => t('Default'),
       '#default_value' => variable_get('page_title_default', '[page-title] | [site-name]'),
       '#required' => TRUE,
-      '#description' => t('This pattern will be used as a <em>fallback</em> (ie, when no other pattern is defined)'),
-    ) + $pattern_form_element,
-
-    // Define the frontpage pattern. This is use on <front>
-    'page_title_front' => array(
-      '#title' => t('Frontpage'),
-      '#default_value' => variable_get('page_title_front', '[site-name] | [site-slogan]'),
-      '#description' => t('This pattern will be used for the site frontpage'),
-    ) + $pattern_form_element,
-
-    // Define the pager pattern. This is appended to any page requests containing 'page=[0-9]+' in the query string
-    'page_title_pager_pattern' => array(
-      '#title' => t('Pager Suffix'),
-      '#default_value' => variable_get('page_title_pager_pattern', ''),
-      '#description' => t('This pattern will be appended to a page title for any given page with a pager on it'),
-    ) + $pattern_form_element,
-
-    // Define the comment reply pattern. This is used for a root comment reply (ie comment/[0-9]+).
-    'page_title_comment_reply' => array(
-      '#title' => t('Comment Reply'),
-      '#default_value' => variable_get('page_title_comment_reply', ''),
-      '#description' => t('This pattern will be used for comment reply pages, where the reply is directly to a "node"'),
-    ) + $pattern_form_element,
-
-    // Define the comment reply to comment pattern. This is used for a reply to a comment (ie comment/[0-9]+/[0-9]+).
-    'page_title_comment_child_reply' => array(
-      '#title' => t('Comment Child Reply'),
-      '#default_value' => variable_get('page_title_comment_child_reply', ''),
-      '#description' => t('This pattern with be used for comment reply pages where the reply is to an existing "comment" (eg a comment thread)'),
-    ) + $pattern_form_element,
-
-    // Define the user profile page pattern. This is used on any 'user/[0-9]' pages
-    'page_title_user' => array(
-      '#title' => t('User Profile'),
-      '#default_value' => variable_get('page_title_user', ''),
-      '#description' => t('This pattern will be used for any user profile pages'),
-    ) + $pattern_form_element,
-  );
-
-
-  // Define the "showfield" checkbox for the user profile page
-  $form['patterns']['showfield']['page_title_user_showfield'] = array(
-    '#default_value' => variable_get('page_title_user_showfield', 0),
-  ) + $showfield_form_element;
-
-
-  // Definate the patterns per-node-type
-  $types = node_get_types();
-  foreach ($types as $type) {
-    // Define the node-type key
-    $key = 'page_title_type_'. $type->type;
-
-    // Pattern entry
-    $form['patterns']['pattern'][$key] = array(
-      '#title' => t('Content Type - %type', array('%type' => $type->name)),
-      '#default_value' => variable_get($key, ''),
-      '#description' => t('This pattern will be used for all %type node-type pages', array('%type' => $type->name)),
-    ) + $pattern_form_element;
-
-    $form['patterns']['showfield'][$key .'_showfield'] = array(
-      '#default_value' => variable_get($key .'_showfield', 0),
+  ) + $pattern_form_element;
+  $form['patterns']['general']['scope']['page_title_default'] = array('#type' => 'markup', '#value' => t('Global'), );
+  $form['patterns']['general']['language']['page_title_default'] = array('#type' => 'markup', '#value' => t('<i>All</i>'), );
+  // generation of other patterns
+  if (count($langs)) {
+    foreach ($patterns as $key => $pattern) {
+      $group = $pattern['#group'];
+      // decide if showfield is needed
+      if (isset($pattern['#showfield']) && $pattern['#showfield'] == 1) {
+        $form['patterns']['general']['showfield'][$key . '_showfield'] = array(
+          '#title' => $pattern['#title'],
+          '#default_value' => variable_get($key . '_showfield', 0),
+          '#required' => TRUE,
+        ) + $showfield_form_element;
+      }
+      // generation of all patterns for each languages
+      foreach ($langs as $langcode => $langname) {
+        $lang_key = empty($langcode) ? $key : $key . '_' . $langcode;
+        if ((isset($pattern['#langneutral']) && $pattern['#langneutral'] == 1) || ($langcode != '')) {
+          $form['patterns'][$group]['pattern'][$lang_key] = array() + $pattern_form_element;
+          $form['patterns'][$group]['pattern'][$lang_key]['#title'] = $pattern['#title'];
+          $form['patterns'][$group]['scope'][$lang_key] = array('#type' => 'markup', '#value' => $pattern['#scope']);
+          $form['patterns'][$group]['pattern'][$lang_key]['#default_value'] = variable_get($lang_key, '');
+          $form['patterns'][$group]['language'][$lang_key] = array('#type' => 'markup', '#value' => t('%lang', array('%lang' => $langname)));
+        }
+      }
+    }
+  };
+
+  // CONTENT TYPES PATTERNS
+  foreach (node_get_types('names') as $node_type => $node_type_name) {
+    $key = 'page_title_type_' . $node_type;
+    $form['patterns']['content_type']['showfield'][$key . '_showfield'] = array(
+      '#title' => $node_type_name,
+      '#default_value' => variable_get($key . '_showfield', 0),
+      '#required' => TRUE,
     ) + $showfield_form_element;
-
-    $form['patterns']['scope'][$key] = array('#type' => 'markup', '#value' => t('Node'), );
+    foreach ($langs as $langcode => $langname) {
+      $lang_key = empty($langcode) ? $key : $key . '_' . $langcode;
+      $form['patterns']['content_type']['pattern'][$lang_key] = array() + $pattern_form_element;
+      if (empty($langcode)) {
+        $form['patterns']['content_type']['pattern'][$lang_key]['#title'] = t('%title', array('%title' => $node_type_name));
+        $form['patterns']['content_type']['scope'][$lang_key] = array('#type' => 'markup', '#value' => t('Node'));
+      }
+      $form['patterns']['content_type']['pattern'][$lang_key]['#default_value'] = variable_get($lang_key, '');
+      $form['patterns']['content_type']['language'][$lang_key] = array('#type' => 'markup', '#value' => t('%lang', array('%lang' => $langname)));
+    }
   }
 
-
-  // Definate the patterns per-vocab-type - if Taxonomy Module is enabled
+  // TAXONOMY PATTERNS
   if (module_exists('taxonomy')) {
-    $vocabs = taxonomy_get_vocabularies();
-    foreach ($vocabs as $vocab) {
-      // Define the vocab key
-      $key = 'page_title_vocab_'. $vocab->vid;
-
-      // Pattern entry
-      $form['patterns']['pattern'][$key] = array(
-        '#title' => t('Vocabulary - %vocab_name', array('%vocab_name' => $vocab->name)),
-        '#default_value' => variable_get($key, ''),
-        '#description' => t('This pattern will be used for all %title term pages', array('%title' => $vocab->name)),
-      ) + $pattern_form_element;
-
-      $form['patterns']['showfield'][$key .'_showfield'] = array(
-        '#default_value' => variable_get($key .'_showfield', 0),
-      ) + $showfield_form_element;
-
-      $form['patterns']['scope'][$key] = array('#type' => 'markup', '#value' => t('Taxonomy'), );
+    $vocabularies = taxonomy_get_vocabularies();
+    if (sizeof($vocabularies) > 0) {
+      foreach ($vocabularies as $vocab) {
+        $key = 'page_title_vocab_' . $vocab->vid;
+        $form['patterns']['taxonomy']['showfield'][$key . '_showfield'] = array(
+          '#title' => $vocab->name,
+          '#default_value' => variable_get($key . '_showfield', 0),
+          '#required' => TRUE,
+        ) + $showfield_form_element;
+        foreach ($langs as $langcode => $langname) {
+          $lang_key = empty($langcode) ? $key : $key . '_' . $langcode;
+          $form['patterns']['taxonomy']['pattern'][$lang_key] = array() + $pattern_form_element;
+          $form['patterns']['taxonomy']['pattern'][$lang_key]['#title'] = t('%title', array('%title' => $vocab->name));
+          $form['patterns']['taxonomy']['scope'][$lang_key] = array('#type' => 'markup', '#value' => t('Taxonomy'));
+          $form['patterns']['taxonomy']['pattern'][$lang_key]['#default_value'] = variable_get($lang_key, '');
+          $form['patterns']['taxonomy']['language'][$lang_key] = array('#type' => 'markup', '#value' => t('%lang', array('%lang' => $langname)));
+        }
+      }
     }
   }
 
-
-  // Add the blog homepage pattern field
-  if (module_exists('blog')) {
-    $key = 'page_title_blog';
-    $form['patterns']['pattern'][$key] = array(
-      '#title' => t('Blog Homepage'),
-      '#default_value' => variable_get($key, ''),
-      '#description' => t('This pattern will be used for a users blog page (ie <code>/blog/1</code>)'),
-    ) + $pattern_form_element;
-
-    $form['patterns']['scope'][$key] = array('#type' => 'markup', '#value' => t('User'), );
-  }
-
-
-  // Add the forum root pattern field
-  if (module_exists('forum')) {
-    $form['patterns']['pattern']['page_title_forum_root_title'] = array(
-      '#title' => t('Forum Root'),
-      '#default_value' => variable_get('page_title_forum_root_title', ''),
-      '#description' => t('This pattern will be used on the forum root page (ie, <code>/forum</code>)'),
-    ) + $pattern_form_element;
-    $form['patterns']['scope']['page_title_forum_root_title'] = array('#type' => 'markup', '#value' => t('Global'));
-  }
-
-
   // Add the token help to a collapsed fieldset at the end of the configuration page.
   $form['token_help'] = array(
     '#type' => 'fieldset',
@@ -182,3 +182,28 @@ function page_title_admin_settings() {
   return system_settings_form($form);
 }
 
+/**
+ * Initialisation of patterns' settings.
+ * These patterns have custom settings, and thus are not content types or vacabularies.
+ * - Only frontpage needs a language neutral page title
+ * - Showfield appears only on user profiles
+ * - Token scopes are different from one pattern to another
+ */
+function _page_title_init_patterns_options(&$patterns) {
+  $patterns = array(
+    'page_title_front' => array('#title' => t('Frontpage'), '#group' => 'general', '#scope' => t('Global'), '#langneutral' => 1),
+    'page_title_pager_pattern' => array('#title' => t('Pager'), '#group' => 'specific', '#scope' => t('Global')),
+    'page_title_comment_reply' => array('#title' => t('Comment Reply'), '#group' => 'specific', '#scope' => t('Node')),
+    'page_title_comment_child_reply' => array('#title' => t('Comment Child Reply'), '#group' => 'specific', '#scope' => t('Node Comment')),
+  );
+  if (module_exists('profile')) {
+    $patterns['page_title_user']=array('#title' => t('User Profile'), '#group' => 'general', '#scope' => 'User', '#showfield' => 1);
+  };
+  if (module_exists('blog')) {
+    $patterns['page_title_blog']=array('#title' => t('Blog'), '#group' => 'general', '#scope' => 'User');
+  };
+  if (module_exists('forum')) {
+    $patterns['page_title_forum_root_title']=array('#title' => t('Forum Root'), '#group' => 'general', '#scope' => 'Global');
+  };
+}
+
diff --git a/page_title.info b/page_title.info
index 3a6540d..dd70989 100644
--- a/page_title.info
+++ b/page_title.info
@@ -3,9 +3,9 @@ name = Page Title
 description = "Enhanced control over the page title (in the &lt;head> tag)."
 dependencies[] = token
 core = 6.x
-; Information added by drupal.org packaging script on 2010-11-02
+; Information added by drupal.org packaging script on 2010-08-26
 version = "6.x-2.x-dev"
 core = "6.x"
 project = "page_title"
-datestamp = "1288657017"
+datestamp = "1282781730"
 
diff --git a/page_title.install b/page_title.install
index 12dc942..e95293f 100644
--- a/page_title.install
+++ b/page_title.install
@@ -11,7 +11,7 @@
  */
 function page_title_install() {
   drupal_install_schema('page_title');
-  drupal_set_message(t('Page Title has been installed. Please go to <strong>Admin > Site Configuration > Page title</strong> to configure the settings for your site, or !link', array('!link' => l(t('click here'), 'admin/settings/page-title'))));
+  drupal_set_message(st('Page Title has been installed. Please go to <strong>Admin > Site Configuration > Page title</strong> to configure the settings for your site, or !link', array('!link' => l(st('click here'), 'admin/settings/page-title'))));
 }
 
 
@@ -42,11 +42,11 @@ function page_title_update_6200() {
     return $ret;
   }
   elseif (db_table_exists('page_title_temp') || db_table_exists('page_title_old')) {
-    drupal_set_message(t('Page Title cannot be updated until page_title_temp and/or page_title_old have been removed. Please manually remove these tables (if safe to do so), return to <a href="@update-php">update.php</a> and run the remaining updates.', array('@update-php' => base_path() .'update.php?op=selection')), 'warning', FALSE);
+    drupal_set_message(st('Page Title cannot be updated until page_title_temp and/or page_title_old have been removed. Please manually remove these tables (if safe to do so), return to <a href="@update-php">update.php</a> and run the remaining updates.', array('@update-php' => base_path() .'update.php?op=selection')), 'warning', FALSE);
 
     return array('#abort' => array(
       'success' => FALSE,
-      'query' => t('It seems page_title_temp or page_title_old tables are already present in your database, possibly from a previous update. Please remove these tables from your database.')
+      'query' => sst('It seems page_title_temp or page_title_old tables are already present in your database, possibly from a previous update. Please remove these tables from your database.')
     ));
   }
 
diff --git a/page_title.module b/page_title.module
index 3f1411b..563f848 100644
--- a/page_title.module
+++ b/page_title.module
@@ -1,5 +1,5 @@
 <?php
-// $Id: page_title.module,v 1.18.2.55 2010/11/02 00:04:06 njt1982 Exp $
+// $Id: page_title.module,v 1.18.2.51 2010/08/25 13:40:28 njt1982 Exp $
 
 /**
  * @file
@@ -111,32 +111,49 @@ function page_title_theme() {
  * Updates settings after a node type change.
  */
 function page_title_node_type($op, $info) {
+  // List of all enabled languages
+  if (module_exists('locale')) {
+    $langs = locale_language_list();
+  }
+  else {
+    $langs = array();
+  }
+  // Keys prefix
+  $oldkey_prefix = 'page_title_type_'. $info->old_type;
+  $newkey_prefix = 'page_title_type_'. $info->type;
   // Handle a content type rename
   if ($op == 'update' && !empty($info->old_type) && $info->type != $info->old_type) {
-    // Load the old node type settings.
-    $temp = variable_get('page_title_type_'. $info->old_type, '');
-
-    // If the settings aren't empty, then save them into the new type
-    if (!empty($temp)) {
-      variable_set('page_title_type_'. $info->type, $temp);
-    }
-
-    // Delete the old setting
-    variable_del('page_title_type_'. $info->old_type);
-
-    // Essentially, do the same as above but with the _showfield suffix for the node type
-    $temp = variable_get('page_title_type_'. $info->old_type .'_showfield', 0);
+    // 1. Save showfield setting from old node type
+    $temp = variable_get($oldkey_prefix .'_showfield', 0);
     if ($temp) {
-      variable_set('page_title_type_'. $info->type .'_showfield', $temp);
+      variable_set($newkey_prefix .'_showfield', $temp);
     }
-    variable_del('page_title_type_'. $info->old_type .'_showfield');
-
+    variable_del($oldkey_prefix .'_showfield');
+    // 2. Save patterns of old node type for each languages available on the system
+    foreach ($langs as $langcode => $langname) {
+      // Key for the old and new node type per language
+      $oldkey_lang = $oldkey_prefix . '_' . $langcode;
+      $newkey_lang = $newkey_prefix . '_' . $langcode;
+      // Load the old node type setting
+      $temp = variable_get($oldkey_lang, '');
+      // If the setting is not empty, then save it with the new type
+      if (!empty($temp)) {
+        variable_set($newkey_lang, $temp);
+      }
+      // Delete the old setting
+      variable_del($oldkey_lang);
+    } // end foreach $alllangs
   }
-
-  // If deleted, remove the variables
+  // Handle a content type deletion
   if ($op == 'delete') {
-    variable_del('page_title_type_'. $info->type);
-    variable_del('page_title_type_'. $info->type .'_showfield');
+    // Removing default pattern and showfield
+    variable_del($newkey_prefix);
+    variable_del($newkey_prefix .'_showfield');
+    // Removing patterns associated to a language
+    foreach ($langs as $langcode => $langname) {
+      $newkey_lang = $newkey_prefix . '_' . $langcode;
+      variable_del($newkey_lang);
+    }
   }
 }
 
@@ -150,10 +167,12 @@ function page_title_form_alter(&$form, $form_state, $form_id) {
 
   // Check we're editing a node and also check that the node type's 'show field' is enabled
   if ($form['#id'] == 'node-form') {
-    $key = 'page_title_type_'. $form['type']['#value'] .'_showfield';
-    if (variable_get($key, 0)) {
-      $page_title = isset($form['#node']->page_title) ? $form['#node']->page_title : NULL;
-
+    $showfield_key = 'page_title_type_'. $form['type']['#value'] .'_showfield';
+    if (variable_get($showfield_key, 0)) {
+      $default_pattern_key = 'page_title_type_'. $form['type']['#value'];
+      // If a language exists for this node, we use the language related page title pattern, else we use the default pattern
+      $pattern_key = empty($form['#node']->language) ? $default_pattern_key : $default_pattern_key . '_' . $form['#node']->language;
+      $page_title = isset($form['#node']->page_title) ? $form['#node']->page_title : variable_get($pattern_key, NULL);
       // If we have vertical tabs installed, we need to render the form element slightly differently
       $show_vertical_tabs = FALSE;
       if (module_exists('vertical_tabs')) {
@@ -166,7 +185,6 @@ function page_title_form_alter(&$form, $form_state, $form_id) {
           $show_vertical_tabs = ($vt_conf = vertical_tabs_get_config($form_id)) && ($vt_conf['page_title'] !== 0);
         }
       }
-
       // If we have decided to show vertical tabs, render the page_title element into a fieldset, otherwise just a textfield with a weight putting it at the top.
       if ($show_vertical_tabs) {
         $form['page_title'] = array(
@@ -283,6 +301,7 @@ function page_title_form_user_profile_form_alter(&$form, &$form_state) {
  * Implementation of hook_form_FORM_ID_alter().
  */
 function page_title_form_node_type_form_alter(&$form, &$form_state) {
+  $key = 'page_title_type_'. $form['#node_type']->type;
   // Alter the node type form - allows easy access to the per-content type page title settings
   $form['page_title'] = array(
     '#type' => 'fieldset',
@@ -291,7 +310,6 @@ function page_title_form_node_type_form_alter(&$form, &$form_state) {
     '#collapsed' => TRUE,
     '#tree' => TRUE,
   );
-
   $form['page_title']['show_field'] = array(
     '#type' => 'checkboxes',
     '#title' => t('Page Title Field'),
@@ -299,16 +317,14 @@ function page_title_form_node_type_form_alter(&$form, &$form_state) {
     '#options' => array(
       'show_field' => t('Show field'),
     ),
-    '#default_value' => variable_get('page_title_type_'. $form['#node_type']->type .'_showfield', 0) ? array('show_field') : array(),
+    '#default_value' => variable_get( $key .'_showfield', 0) ? array('show_field') : array(),
   );
-
   $form['page_title']['pattern'] = array(
     '#type' => 'textfield',
     '#title' => t('Page Title Pattern'),
-    '#default_value' => variable_get('page_title_type_'. $form['#node_type']->type, ''),
+    '#default_value' => variable_get( $key , ''),
     '#description' => t('Enter the <em>Page Title</em> pattern you want to use for this node type. For more information, please use the !link settings page', array('!link' => l('Page Title', 'admin/content/page_title'))),
   );
-
   $form['#submit'][] = 'page_title_node_type_form_submit';
 }
 
@@ -317,10 +333,10 @@ function page_title_form_node_type_form_alter(&$form, &$form_state) {
  * Submit handler for the node_type_form element added in the hook_form_alter() above.
  */
 function page_title_node_type_form_submit($form, &$form_state) {
+  $key_type = 'page_title_type_'. $form_state['values']['type'];
   $show_field = $form_state['values']['page_title']['show_field']['show_field'] ? 1 : 0;
-  variable_set('page_title_type_'. $form_state['values']['type'] .'_showfield', $show_field);
-  variable_set('page_title_type_'. $form_state['values']['type'], $form_state['values']['page_title']['pattern']);
-
+  variable_set($key_type .'_showfield', $show_field);
+  variable_set($key_type, $form_state['values']['page_title']['pattern']);
   // For some reason the node module adds the fieldset as a separate entry in the variables table... we dont want this!
   variable_del('page_title_'. $form_state['values']['type']);
 }
@@ -441,7 +457,7 @@ function page_title_load_title($id, $type) {
 
 /**
  * Wrapper for old function...
- * NOTE: This has been depricated in favor of page_title_load_title().
+ * @deprecated Use page_title_load_title() instead.
  */
 function page_title_node_get_title($nid) {
   return page_title_load_title($nid, 'node');
@@ -450,7 +466,7 @@ function page_title_node_get_title($nid) {
 
 /**
  * Legacy page title setting function...
- * NOTE: This has been deprecated in favour of hook_page_title_alter().
+ * @deprecated Use hook_page_title_alter() instead.
  */
 function page_title_set_title($title = NULL) {
   static $stored_title;
@@ -496,7 +512,12 @@ function page_title_page_get_title($raw = FALSE) {
     }
 
     // Append the pattern for pages with a pager on them
-    $page_title_pattern .= isset($_REQUEST['page']) ? variable_get('page_title_pager_pattern', '') : '';
+    if (isset($_REQUEST['page'])) {
+      global $language;
+      $default_key = 'page_title_pager_pattern';
+      $lang_key = empty($language->language) ? $default_key : $default_key . '_' . $language->language;
+      $page_title_pattern .= variable_get($lang_key, '');
+    }
 
     // Apply token patterns by resetting the token cache first and then using token_replace_multiple to insert token values
     token_get_values('global', NULL, TRUE);
@@ -589,7 +610,6 @@ function _page_title_build_views_keys($view_name, $display_id) {
   return 'page_title-'. implode('-', array_filter(array($view_name, $display_id)));
 }
 
-
 /**
  * Form Alter handler for the views ui config form (used for filters and args)
  */
@@ -731,7 +751,7 @@ function page_title_page_title_api() {
 }
 
 /**
- * Core implementations of hook_page_title_api().
+ * Implementation of hook_page_title_api().
  */
 function taxonomy_page_title_api() { return page_title_page_title_api(); }
 function node_page_title_api() { return page_title_page_title_api(); }
