Is it somehow possible to translate text in title?

E.g. I have title for specific content:

[current-page:page-title] - keyword [node:field-mesto:name], second keyword | [site:name]

and I need keyword and second keyword to be translated in different languages.

Is there any possibility?

Thank you in advance for any idea!

Files: 
CommentFileSizeAuthor
#6 i18npagetitle.zip1.12 KBjasom

Comments

I also need D7 version multi-language support for page title patterns, as in D6 thread http://drupal.org/node/383358. Any thoughts on this?

Meanwhile, I found solution.

  1. I have installed custom tokens module http://drupal.org/project/token_custom.
  2. I have created new tokens - www.yoursite.com/admin/structure/token-custom - I've used php snippet to translate words
  3. I've used custom token in page title configuration page

I used this php snippet for each word I needed to be multilingual:

<?php
 
global $language;
 
$lang_name = $language->language;
  if (
$lang_name == "en" ) print "page";
  if (
$lang_name == "sk" ) print "str.";
 
?>

Of couse, its not very flexible (if you have many languages or you plan to add more later) but its solution for now.

Thanks... your solution helped me out!

Here is my use case for mulitlingual site with 2 languages - EN / FR.
I needed multilingual pattern for content type : News (Actualité), machine name = news.

1. Install module : Variable
2. in custom module implement hook

<?php
function CUSTOMMODULENAME_variable_info($options) {
 
$variables['page_title_type_news'] = array(
   
'type' => 'text',
   
'title' => t('News page title', array(), $options),
   
'default' => '',
   
'description' => t('Module : Page title', array(), $options),
  );
  return
$variables;
}
?>

Inspect pattern input name in admin/config/search/page-title to find out variable name,
for content types it will be 'page_title_type_CONTENTTYPENAME',
for user profile 'page_title_user'.

3. make variable mulitlingual on admin/config/regional/i18n/variable

4. now you can see language switcher on admin/config/search/page-title and define different patterns for each language :

pattern for English version = [current-page:page-title] | News | [site:name]
pattern for French version = [current-page:page-title] | Actualités | [site:name]

#4 works perfect for me, tnx matulis.

page_title_vocab_VOCABMACHINENAME for vocabulary page title
page_title_default for default page title
page_title_front for front page title

StatusFileSize
new1.12 KB

Here is upload of module based on #4. It's 7.1 edit of module used in my site (have more custom hooks at original one).

In this is 7.1 edit is set multilingual page title for content type page and article, taxonomy tags, default and front page. You will need probably to edit it and add hooks for your content types names and taxonomy names.

Let me know if it works.

@matulis Thanks, this is working perfectly!

@jasom thanks for the file, it's working great!