Multi-language patterns for single Content Types
willeaton - February 25, 2009 - 11:05
| Project: | Page Title |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
Im sure I posted something about this recently but cant find any trace of the ticket. How do you do content type patterns for multiple languages in drupal 6?
Thanks
Will

#1
Currently you cant specify different Page Title patterns for different languages on the same node type. This is a good point though...
Marking as a Feature Request.
Nick
#2
I have re-written the module myself manually, I will attach it to this post. Basically there are only 2 small changes to make, in aws_page_title_admin_settings() and aws_page_title_page_get_title().
It does need the table ordering cleaning up but the code is there. Also note that I have renamed the module to "aws_page_title" so just do a find and replace.
Hope it helps
Thanks
Will
#3
#4
p.s. make sure you uninstall page_title before installing my version if you want to test. It does use same table names... just in case you hit errors and dont know why.
#5
Excellent - thanks Will. I'll try to get this converted into a patch and committed for a future release.
#6
willeaton
I did not understand the solution you have provided (perhaps a patch would be helpful)
Here is what jose reyero seems to be proposing in order to make
i18n_variablesfor ANY modulehttp://drupal.org/node/252245#comment-1194143
I suppose if system_settings_form is used in the module and appropriate variables are put in
settings.phpini18n_variables$conf['i18n_variables'] = array('site_name',
'site_slogan',
'site_mission',
'site_footer',
'anonymous',
'menu_primary_menu',
'menu_secondary_menu',
'contact_form_information',
'site_frontpage',
//following we are internationalizing the module's variables
'page_title_front',
'page_title_type_content_type_name',
'page_title_type_page',
'page_title_type_story'
);
then each variable will be internationalized
I don't know how to code such solution but just throwing it out there for anyone that is more advanced with drupal internals
#7
Hey GiorgosK, no problems, sorry I wasn't able to provide proper patches, Im not really up to scratch on those. Basically, the way the module currently works is to save the content type pattern as a row in the variables table. All I have done is added some extra lines of code
if(module_exists('i18n'))foreach(i18n_language_list() as $key => $value)
this first checks that multilanguage is on and then uses the API to fetch all active languages. The rest of the foreach loop is a repeat of all the content type fields for each language. The same idea is implemented in the front end part of the module (actually displaying the page title), the addition simply inserts the current language into the variable structure when calling it... i.e. instead of calling page_title_page it would call page_title_en_page
If that doesn't make sense then let me know, I would be happy to go through it with you.
Thanks
Will
#8
I just installed the AWS version and it doesn't have a frontpage option for the other languages. I have sites with multiple subdomains like
www.domain.com
es.domain.com
fr.domain.com
Is there a way to add a slot so each languages homepage has it's own title? I'm not using the sitename as the title tag.
#9
Well JeremyL there is, if you look at line 113 and 114
$form['title']['aws_page_title_front'] = array('#type' => 'markup', '#value' => 'Frontpage Pattern');$form['pattern']['aws_page_title_front'] = array('#type' => 'textfield', '#default_value' => variable_get('aws_page_title_front', '[site-name] | [site-slogan]'), '#maxlength' => 128, '#description' => t('This is the frontpage pattern.'));
I left these two fields out of the language loop, I'm sure there was a reason/problem but I can't remember what I'm afraid. All you would have to do is move these two fields within the 'foreach' loop and replace them with
$form['title']['aws_page_title_".$key."_front'] = array('#type' => 'markup', '#value' => 'Frontpage Pattern');$form['pattern']['aws_page_title_".$key."_front'] = array('#type' => 'textfield', '#default_value' => variable_get('aws_page_title_".$key."_front', '[site-name] | [site-slogan]'), '#maxlength' => 128, '#description' => t('This is the frontpage pattern.'));
Make sure you paste the original version of these 2 lines of code into the 'else' section on line 141,
Also, change line 330 (may change after above changes)
$aws_page_title_pattern = variable_get('aws_page_title_front', '[site-name] | [site-slogan]');to
$aws_page_title_pattern = variable_get('aws_page_title_'. (isset($node->language) ? $node->language."_" : '').'front', '[site-name] | [site-slogan]');I haven't tested it but should work.
Will Eaton
#10
The PAGE_TITLE module can use the VOCAB translations of i18n module (Taxonomy Translation)?
By example, I have this pattern:
[site-name] > [vocab] > [page-title]
I could have this titles:
Drupal.org > Essential Modules > My Module
Drupal.org > Módulos Esenciales > Mi Módulo
In this case "Módulos Esenciales" is translation for vocab "Essential Modules", how to enable this feature?
#11
Has this feature been added to a development snapshot? Is there a patch that applies with the most recent stable release?
#12
I was hoping that this would have been posted by now, another website I am working on will need this as well.