Is it possible to translate view path/title of custom content type? - drupal

I'm a newcomer to Drupal.
I have a Drupal installation with i18n module.
Everything works perfectly however I faced one issue.
I created custom content type and a view to display it. Now I have a quesiton... Is there any possibility to translate view path/title?
Regards,
DaveW

Well known issue for all people starting their adventure with Drupal.
How to solve the problem? It's very, very simple. I presume you have your languages created and enabled - I'll use English as default language.
Create your view with requested title and path. I always use English language as the first language, ie. news.
Go to Administration » Configuration » Search and metadata » URL aliases and create new alias by clicking Add new alias link (if this module is disable you need to enable it).
From dropdown menu, select your second (or third etc.) language, in my case Polish.
In Existing system path field provide the English path of the view you created: in our case it's news.
In Path alias field provide your translation, ie. wiadomosci for Polish language.
Voila. Now, when Polish is the current language, it will use an alias wiadomosci for news path.
Note: Just tested on fresh latest Drupal installation - works perfectly.

If you take a look here:
http://reyero.net/en/drupal/drupal7_i18n_beta1_overview (This is the module author's page)
He shows options for enabling translation of taxonomy terms, which would be the path up to your actual page - such as categories you've set up for your content.
There is also a tickbox for node, which would be your content. One would think that this would translate the either the url or the node content.
His site doesn't seem to translate to the url to spanish, but just changes menu items. The URL falls back to the node number instead of the alias which was previously displayed.
Maybe this helps or maybe this is already obvious to you, but I would tray playing with those options.
Nice overview - http://evolvingweb.ca/story/drupal-7-multilingual-whats-new-i18n
Path Translation
The Drupal 7 Path Translation Module allows you to create translation
sets for paths. Path translations are used for generic paths (for
example, for views pages), not for node or taxonomy page paths. You
can configure multilingual paths by going to Configuration » Regional
and language » Translation sets » Paths.
Seems to imply that there is a way to translate the nodes - not sure if you have to hard code or if it will happen automatically - looks promising though.
This guide might be helpful as well: http://drupal.org/node/133977

The easiest way seems to be to go with the Internationalisation Views module: https://drupal.org/project/i18nviews.

Related

Can't translate block in Drupal

I am building site in Drupal and I need your help. I have an assignment to make one more language translation of the site, and so far so good. However, I have one trouble with one block which isn't going to get translated, even though in the settings I translated it.
Also one strange activity I noticed is that when I try to go to VIEW section of all the other languages, I get dropped to front page (where that block is actually located) but if I press VIEW from my language translation (Swedish) of the block I get to completely new page.
If I go to front page and my language is selected, that block is actually using default language.
Any help what may cause it?
For desire url aliasing you need to install pathauto drupal module. then you can configure alise from below url
admin/config/search/path/patterns
OK, I have found a solution to this problem.
It appears that Drupal 7 by default sets your new language homepage to the default homepage and that's why this block was using default language since it was relying on the front page. Anyway, to fix the issue follow the steps:
Login to adming account, go to Configuration, System, Site Information and in the field Default front page for the language you have chosen navigate to your specific node page. That's it.

Can plone.app.multilingual work for partially translated sites?

I'm trying to get plone.app.multilingual to work with a site which is currently in English, but will become partially translated. I'm using plone.app.multilingual rather than the more familiar LinguaPlone because of Dexterity content types used by the site which LinguaPlone does not support.
I have a test site to play with. As soon as I translate one page it seems to create a /en folder for the English content and (e.g.) /fr one for the French. I can switch back and forth between the two language variants of the page, but once I'm in the French language I can't see all the other English pages. As a site visitor this is no use and it ignores the fact that although a browser may be set to prefer French, it might also accept English. I have selected what I believe to be the relevant options to allow fallback to the default site language and it lets me view them if I know the URL of the page, but that's not much use if I don't see that the content is there in the first place.
Can plone.app.multilingual be made to work in such a way that a user can see a page of content in some language even if it's not their own, or is my only option to convert the site to use Archetypes?
Thanks.
LinguaPlone would handle this case the same way: Make all content 'language neutral', except for where there is a translation.
By marking all your content 'language neutral', it'll be found and displayed to the end-user no matter what language preference has been set. Now, if any of your content does have a translsation, you do need to set English as the language for the original version so that it'll only be displayed when English is selected.
To do this, you probably can use a subscriber to the plone.multilingual.events.IObjectTranslatedEvent.
As for the creation of en/ and fr/ locations for your content, that's the task of the ITranslationLocator adapter (from plone.multilingual.interfaces, you can override that adapter to provide your own choices. See the default implementations for how this currently works.

Prefixing the pathauto structure with a country code

My client wants their site to be localised, so that example.com/uk presents the uk version, example.com/aus would be the australian version etc etc. However, I want the actual content, and the nodes delivered, to remain and the basic path structure to not change- just prefixed with the country code. Of course I want a 'switch country' button, automatic redirections based on geoIP etc, but for now I just want to focus on the path structure. However, I still want the country selected to be available within views, content types, template files etc, so that uk/products/chairs and aus/products/chairs will still be aliases of node/1 but will then be supplied with a session/cookie/variable set as 'uk' or 'aus'.
Does anyone know any way of doing this please? Google hasn't really supplied much knowledge :/
Many fanks! :)
If you're on Drupal 7, just go to admin/config/regional/language and click "edit" for each language which will allow you to set the "Path prefix language code." This will append the phrase of your choosing after the domain and before the Drupal path just as you requested.
The "Switch country" button can be found on the Blocks page as the "Language switcher" block.
As for uk/products/chairs and aus/products/chairs, so long as one is a translation of the other (using the built-in locale module and possibly the internationalization module, you shouldn't have any problems.

Drupal Site Index - not crawling through "Blocks"?

I created a "View"* in Drupal to grab all the content and essentially make a site map, but I realized that it doesn't have an option to grab content from the Blocks I have created. Does anyone have an idea if I can even do that?
If not, should I essentially make each block a page so that it can crawl through the pages? I worry that this will end up becoming unmanageable in the end... What are some other options/work arounds? My end goal is to make a site map - maybe I am making this too complicated?
*To make my view I did:
Administration->Structure->Views->Add. Then I made it a page, called it "site-index", and made it "show Content of type All" (with tagged field empty). Then I chose "Content: Title" for my Fields and my Filter Criteria is set as: "Content: Published (Yes):" - That way, it will grab the titles of my web pages.
Thanks, and please reply if further clarification is needed!
Apologies if I'm wrong but I think there might be a bit of confusion over terminology here. In the context of a view Content means nodes, not all HTML content on the site. Your view will return a list of all published nodes, which are essentially the pages on your site.
On a normal sitemap (if there is such a thing) you would only link to full pages, not to parts of pages like a block, they are essentially used to provide a hierarchical overview of your site to aid navigation for users and, probably more importantly these days, search engines (you can submit an XML sitemap to the major search engines instead of this but that's really for another question).
Rather than doing this yourself I'd actually recommend you download and install the Sitemap module which will do all of the work for you, as well as arranging the content in their respective hierarchy.

Drupal: best practice to arrange various Drupal entities into one site /subsection

It's perhaps a common task to create a subsection on site, which will reside under sitename.com/subpath.
The subsection will contain own menu with a few links (Calendar view, Add MyEvent content type form, Table View).
But clicking these links will lead out of this /subpath.
Is there a know solution for this (to stay in subsection)?
Or it's normal to use custom code to manage such a subsection, e.g. create pages under /subpath with custom PHP code that will load CCK forms (drupal_get_form())?
Also, is it a tolerable solution to modify from "View links to node forms" to "View links to /subpath pages with programmatically created node forms"?
I'm not sure I completely understood your question - if I didn't and I'm off-topic, I apologize in advance.
Anyway:
Creating pages with code in them using PHP filter, is never accepted practice. There's a reason why the filter was moved to its own module in 6.x - so you can turn it off altogether.
You can go to Site building->URL aliases->Create alias and point the wanted system paths (say, node/add/mycontent) to your subsection path (say, mysection/add/mycontent). All the links to the system path should change to the new alias.
EDIT:
Also, check out pathauto and Sub-path URL Aliases for paths like node/1 and node/1/edit

Resources