简体   繁体   中英

Slider Translation in Drupal

this may be an stupid question... but I was hired recently to take care of a website for an event and the guy that made the website is no longer reacheable for me to ask questions...

I never used Drupal before and I'm having some trouble doing some things...

The last thing they asked me is to translate the whole website...ok...DONE...

But there is a view on my frontpage that is a slider, and I can't get it to work properly...

when im in language1 it displays correctly, when I'm in language2 it displays the same thing... when I click I see the article in language1...

I though about adding a filter in the view..type Translate Content: Language but it starts to put some different imagens on my slider, and also, it mix them...some are in language1 and some others are in language2

Weird CMS

Sometimes just linking the image to its node doesn't get you where you need to be. Try instead adding a field for the Drupal path (or the node ID if you aren't using paths). Exclude that field from the display, then rearrange it to be above the image field (if you don't rearrange it you won't be able to use it as a token.)

Then, on your image field, select "re-write the output of this field" - "output this field as a link" (wording may be slightly different depending on what version you are using) Use replacement patterns to get you to the desired url, with the desired language.

For example:

en/node/[nid]

Where "en" is the language prefix for your desired language (in this example, english) and [nid] is the replacement pattern for the Node ID. (Which again, has to be a field somewhere above the image field.) This will force the view to link to whatever node the image field belongs to, with the correct language.

Edited to add: make sure you deselect "link this field to its content" or it will override your custom rewrite and nothing will change.

Hope that helps. If you're still confused, tell me what major version of Drupal you're using (5, 6, or 7) and what version of views (2 or 3). I can be more specific.

I don't know which module for content slider is used, but if you use Content Glider, then this patch could help, it did for me:

diff --git a/content_glider.module b/content_glider.module
index 6e1eacd..e0c9397 100755
--- a/content_glider.module
+++ b/content_glider.module
@@ -257,7 +257,8 @@ function content_glider_block_info() {

 function content_glider_generate_block($delta) {

-  global $base_url;    
+  global $base_url;
+  global $language;    
   $ajax_base_path = $base_url;

   $efects = array('updown', 'downup', 'leftright', 'rightleft');
@@ -290,6 +291,7 @@ function content_glider_generate_block($delta) {
           ->fields('n', array('nid'))
           ->condition('type', $content_type,'IN')
           ->range(0, $content_glider_count)
+          ->condition('language', $language->language)
           ->orderBy('n.created' , $content_glider_order_type_val) ;
         $result = $query->execute();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM