Drupal Front Page Module Multi-language patch
12th April 2009 by erdincDrupal için cms’ten bağımsız ana sayfa hazırlayabilmenizi sağlayan güzel bir modüldür Front Page. Ancak en büyük eksikliği çoklu diller için ayrı ana sayfalar hazırlanamıyor olmasıydı, dı diyorum çünkü “hacky” bir yöntemle uzun zamandır çoklu dil desteğiyle kullanıyordum. Biraz elini yüzünü düzeltip paylaşmak istedim, ahım-şahım bir şey değil ama kullanmak isteyen olursa diye kendisini internetin tozlu raflarına bırakalım…
PS: Yamanın düzgün çalışması için i18n modülününde yüklü ve aktif olması gerekmektedir.
— front_page.module.org 2008-10-20 02:15:31.000000000 +0300
+++ front_page.module 2009-04-12 15:38:31.000000000 +0300
@@ -94,6 +94,15 @@
‘#description’ => t(’Paste your HTML or TEXT here.’) .’‘. t(’You can paste in the full HTML code for a complete page and include a different style sheet in the HEAD of the document if you want a completely different layout and style to the rest of your site.’),
);+ $form[$role]['front_'. $role .'_text_eng'] = array(
+ ‘#type’ => ‘textarea’,
+ ‘#title’ => t(’English’),
+ ‘#default_value’ => variable_get(’front_’. $role .’_text_eng’, ”),
+ ‘#cols’ => 60,
+ ‘#rows’ => 20,
+ ‘#description’ => t(’Paste your HTML or TEXT here.’) .’‘. t(’Front page content in English language.’),
+ );
+
// Set the type options common for all roles.
$options = array(
‘themed’ => t(’themed’),
@@ -301,9 +310,13 @@
// the following is the code that loads the front_page settings
global $user;- // if the user is not logged in load up the page for anonymous users
- if (!$user->uid) {
- $output = variable_get(’front_1_text’, ‘drupal’);
+ // Always show default language on the front page
+ $cur_lang = i18n_get_lang();
+
+ if ($cur_lang == “en”)
+ $output = variable_get(’front_1_text_eng’, ‘drupal’);
+ else
+ $output = variable_get(’front_1_text’, ‘drupal’);// If PHP code execution is allowed then use eval.
if (variable_get(’front_1_php’, 0)) {
@@ -324,8 +337,7 @@
drupal_goto($path = $output, $query = null, $fragment = null);
break;
}
- }
-
+$roles = “”; //make sure the roles variable is clear
$roles = user_roles(); //load up the user roles for the site




Teşekkürler patch için. Gerçi front_page’in içine statik html eklemek yerine ana sayfayı boş kullanıp bloklarla şekillendirdiğinizde i18n’in multilanguage block özelliği sayesinde ana sayfanızda da çoklu dil kullanabiliyorsunuz.