0

I support an existing site that contains a multilingual section. We have a link to this section on the homepage and it just consists of some basic pages. Now I have been asked to incorporate one of our existing content types into this section (i.e. Content Type A - English, Content Type A - Spanish). The node/add form and the node display pages all need to be in Spanish. I also need to be prepared to support additional content types, additional languages, etc.

So I'm experimenting with the Locale and Internationalization modules. The problem I'm having is that it seems to be designed for an entire multilingual site. I need the site to remain an English site. For example, when an anonymous user creates a spanish node, the user is returned to homepage: www.example.com/es. The homepage is not going to be translated. User should be returned to www.example.com. I also noticed all of the links on www.example.com/es include the es prefix in the path.

Question(s): Is this the right approach to a multilingual section? If so, is there a way to configure Drupal to understand that www.example.com/es, www.example.com/es/mypage, etc. do not exist?

1 Answer 1

1

Yes you are right, internationalization is made for a full website in several languages. But you will be probably be able to achieve what you want by using views everywhere.

Instead of displaying a classical node, you will display a view with 1 node inside a block, inside a panel (probably). You setup your view to use the language your want and the content type you want, that should do the trick. It's a bit different approach if you compare it with the standard drupal approach of creating page.

To ensure that the node page is not accessible, you can use the module node page disabled.

I hope it helps

Cheers

4
  • So this approach would use internationalization and only one content type foo to be used by both English/Spanish speakers, as usual. But when it comes time to display a Spanish node, then I would use a views block to display the node in Spanish but not have the whole page (i.e. headers, sidebars, links, etc.) taken over by internationalization. I'll also need the rules module to redirect anonymous users on the Spanish node/add form back to the english homepage after clicking save. This could work. I'll give it a try and report back.
    – ann b
    Commented Jul 22, 2016 at 15:07
  • Yes, that's my point. The view provides only the nodes you need in the language you need inside the region you wants. Good luck in your implementation.
    – Denis K
    Commented Jul 25, 2016 at 0:32
  • Great answer! This worked. I created this view with a spanish language filter and a page display. Then I wrapped my strings in the preprocessor and template using the t() function. The only challenge was figuring out how to get the user defined strings (i.e. field labels) translated to Spanish on technically an English page. I needed to add hook_field_attach_view_alter(&$output, $context) to my module and pass my own $langcode variable to the translation functions. And of course use the Translate tab at admin/config/regional/translate/translate to translate all of these strings.
    – ann b
    Commented Aug 4, 2016 at 20:02
  • i m happy you succeed. Cheers
    – Denis K
    Commented Aug 4, 2016 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.