I'm migrating a website which is almost exclusively in English, but has some content in other languages (translation of important documents, etc), so it's not truly a multilingual website, only an English one with some pages in other languages.
My setup is the following: I'm using the Locale and i18n modules and set them up to use "no language negotiation" system (no path prefix or subdomain), and to display "All content. No language conditions apply.". This way, a node in another language than English is always visible, and shares the same URL scheme.
My problem is that although the "non-English" node is visible, and everyone is able to access it using Drupal's internal URL (node/123), the custom URL (like "content/page-title") is not working, returning a "Page not found" error message.
Basically, if one's default language is set to English :
- one create a node in "Language neutral" -> the URL alias works
- one create a node in English -> the URL alias works
- one create a node in English then translate it to another language -> the URL alias works only for the English version
- one create a node in another language than English and with no translation, or one is trying to access a translation in another language than English -> the URL alias doesn't work
URL aliases that don't work are still displayed in the URL alias list (admin/build/path/list) and in the url_alias database table.
Is it something that can be a bug in the Path module, or a problem more related to the way the i18n or Locale modules are restricting access to localized content?
| Comment | File | Size | Author |
|---|---|---|---|
| #45 | i18n.gif | 8.67 KB | eriksson-1 |
Comments
Comment #1
damien tournoud commentedI'll classify this as a support request for now.
My understanding of this is that aliases are per-language and per-node. Because translations are independent nodes, the alias created for the original node doesn't apply to the translation.
Comment #2
mdupontIt's not exactly this. I don't want translations to share the same alias than the source, I want them to have a working unique alias.
To sum up as much as possible :
I have several languages and configured Drupal to show all content in all languages all the time. I use no path prefix or subdomain to separate languages. It does show all pages but URL aliases are working only for English and Language neutral content. Each page and each translation has an unique URL alias. I can access any English or Language Neutral page by typing http://mysite.tld/my/url-alias ; I can't access any page in another language this way. I consider this as a bug.
In the database table url_alias I can see the src NID (node/%), the dst alias (content/page-title), and the alias' language ("en", or "fr", etc). It seems that in my particular configuration, aliases whose language is different from English (the current/default one used on my site) and Language Neutral will simply be ignored by Drupal.
================
Test 1:
After typing "http://mysite.tld/content/a-nice-page" I land on my English page with the title "A nice page". Therefore I expect that after typing "http://mysite.tld/content/une-jolie-page" I'll land on my page in French with the title "Une jolie page". But no, it doesn't work, I get a "Page not found". The only way to access it is to type "http://mysite.tld/node/35"
================
Test 2:
================
Test 3:
================
I hope I explain the issue well enough, it's not easy to explain it in a clear and concise way.
Comment #3
Wesley Tanaka commentedI agree with mdupont that the current behavior seems broken.
Also: subscribing.
Comment #5
mdupontInfo: My content types' multilingual settings ("Workflow settings" --> "Multilingual support" when I edit one of the content types) are set to "Enabled, with translation". Could it be the i18n modules that messes my aliases up?
Comment #6
mdupontFYI, it seems to be kind of related to http://drupal.org/node/348942 ("Aliased pages not found (404) on language-bound domains") and http://drupal.org/node/262090#comment-1037115 ("redirect by URL alias")
Quoting the above :
Can someone confirm this? Why is it this way and how to work around the problem?
Comment #7
damien tournoud commentedAs I told you above, aliases are per-language:
If French has a "fr" prefix, you will have to use: "http://mysite.tld/fr/content/une-jolie-page", because aliases are per-language.
Idem, that will be http://mysite.tld/es/content/ejemplo if the prefix for Spanish is "es".
Of course, in that case English pages will be accessible as http://mysite.tld/en/content/ejemplo if you set the prefix for English to be "en" (and would probably not be accessible at all if you keep the default empty prefix).
Comment #8
mdupontThanks. I thought Drupal wasn't going to care about alias languages since I wanted to display content in all languages without language negotiation. So I assume there is no way to have the Path module working that way?
Either it is by design ("Aliases' language is always evaluated and it won't change"), or it is a bug ("It should work but it doesn't").
Comment #9
mdupontSo is it won't fix or is it a bug because path aliases should work in any situation?
Comment #10
nico059 commentedmdupont, I have the same problem in my site.
Default language = french
other language: english
The alias (in english) seems to be ok (it's show in the URL alias page, and when I edit this node it's ok in the URL path settings), but I've got a "page not found" when I try to access this page.
Just by changing the default language to english, the page with this alias is accessible. .... but the french page become inaccessible ....
I will investigate what happen's ... in the alias code ... and let you know ... for me I consider this a bug ...
Comment #11
nico059 commentedMy workaround for now ...
I know it's never a good idea to patch the core .... I will see later how to better handle this problem. But here is my patch for now:
By using the devel module, I located the SQL statement in error.
In my case it's:
in includes/path.inc function drupal_lookup_path
SELECT src FROM url_alias WHERE dst = 'MYALIAS' AND language IN('fr', '') ORDER BY language DESC
and the pb in the table url_alias, is that the language flaged for my alias is "en" ... so the sql statement return nothing ..... so I got a "page not found"
I modify this line to "force" acheck in english every time (more time consuming, hard coded .... it's just a workaround for now .......):
on line 80 on includes/path.inc, function drupal_lookup_path
if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', 'en', '') ORDER BY language DESC", $path, $path_language))) {
I also made the same modif in line 69 of this file to be sure ...
And my alias now work even when not in the default language of the site.
I hope this can help you, I will look forward to find a GOOD way to correct this problem ... (by modifing the core, It'a pain when you need to upgrade to the next version of the core .... you sould always rememebr to re-apply your modif ...)
Regards.
Comment #12
gallandv commentedMy site (drupal 6.6) is default english but also has a spanish version. In order to keep the same aliases for both languages:
that is: example.com/node/4
should be: example.com/es/products and example.com/en/products and example.com/products
all i did was go to URL aliases list and edit every alias I had set up in order to set its "Language" setting to "All languages", and everything is fine now
Comment #13
mdupontThanks for the tip. I have about 2000 nodes, yet I think a SQL query can be made to automate the process. But what about newly created nodes? Do one will have to edit each new url alias?
Comment #14
avpavlov commentedHi nico059!
Your changes won't work for languages which are before English by alphabetical order (so after English in revers order), for example Chinese :)
In addition to your modification I did next (in both places!):
... AND language IN('%s' ,'en', '') ORDER BY case language when '%s' then 255 when 'en' then 1 else 0 end DESC", $path, $path_language, $path_language)
Best regards, Alexander Pavlov.
Comment #15
avpavlov commentedHi gallandv.
You choosen wrong way :) When you updated your page which linked to URL then URL alias's language will be switched from "All languages" to page language again - so you have to change URL aliases again and again.
If you will change page language to "Language neutral" it will solve URL aliases problem but translation management will be much harder because from Drupal's point of view neutral pages do not need translation so there will be no "Translate" tab, these pages will be excluded from "Translation overview" report.
Looks like nico059's solution is most appropriate at the moment.
Comment #16
damien tournoud commentedAliases are per language, each node has a language or is language neutral, so this really looks to be by design. Closing.
Comment #17
avpavlov commentedHi Damien!
I disagree with your decision.
URL aliases operate using "language" and "language neutral" terms while translation sequence operate using "language", "default language" and "language neutral". As result, URLs and pages resolving are de-synchronized.
It should be solved and solution is very easy, see nico059's post and my improvements. However, when changing core 'en' contant should be replaced with real default language which can be obtained from variables.
Comment #18
damien tournoud commentedComment #19
pasqualleCan you test the attached module in comment #262090-4: redirect by url alias?
I plan to release that module (make it a d.o project) this Sunday.
Comment #20
avpavlov commentedHi Pasqualle.
I have analysed i18nredirect.module.txt and found it is not suitable for generic use.
This patch takes any language if current/neutral not found.
I expect current->default->neutral resolving (or current->neutral->default if it is easier).
For example, I have site with 5 languages, English is default. So, in some cases this module may show Chinese version if I use Russian version and Russian/English pages are missed - it is not what I expect :)
I'm not in touch with Drupal (and even with PHP :) ) so not able to write my own module. I can modify your module to look for default language page (instead of any language ordered by weight) but do not know how to obtain default language - looks like "languages" table does not contain these details and it is stored in variables table in non-readable format.
Comment #21
pasqualleI am not sure about the language neutral pages (I will have to check that), but the default->any language order can be easily achieved if the default language weight is above other languages (which should be).. The current language can't be checked as the visitor may come from an outside link. If I try to get a language which was on the previous page, that could really mess things up. The language is only checked from the url, with that the module guarantees the current->default->any language order..
I don't want to remove the any language option as it was part of D5+i18n..
Comment #22
avpavlov commentedYou can enable/disable it via module settings!
Also, nico059 suggested to fix url->alias and alias->url mappings. Your module fixes just one mapping. Is it ok? Are you sure it does not lead to some side effects?
Comment #23
pasqualleI think if I disable the redirect to any language then there is nothing to do as:
default language does not have a language prefix
language neutral page does not have a language prefix
redirecting to the current language in not an option
so there is nothing where an url could be redirected other than any language..
can you give me an example. I don't understand this request.
in the problem described in #10 nico059 worked with a non multilingual node or did not used the language prefix to access the page, otherwise the page should be accessible.. nico used the same technique (as in my module) to be able to access the page without the lang prefix..
Comment #24
avpavlov commentedIt does
Yes, but Nico fixed in two places - where Drupal resolve URL alias to node URL, and where Drupal resolve node URL to URL alias. Your patch fixes just one mapping and I'm just asking - is it ok? :)
For example, there are
a) English as default language
b) English page node/21 mapped to /translatedpage alias
c) page translated to Russian - node/22 mapped to the same alias /translatedpage
When I switch language switcher, menu link to /translatedpage is NOT replaced with /ru/translatedpagee but disappears.
With nico's fix when I switch language switcher, menu link to /translatedpage is replaced to /ru/translatedpagee.
Note, I do not use menu item section on translated page because I prefer to have ONE menu with translated labels.
Comment #25
pasqualleok I should be more clear about this:
default language does not have a language prefix displayed in the URL
This is not a bug, as (by design) you need to create a new menu items (or new links) for different nodes. And also (by design) every menu item which links to a node in different language (or links to a not accessible page) is hidden by default.
This is an absolutely different feature request, which could be solved without hacking core. You can alter the links in the template.php file.
I have an example here: #302905-6: Language independant reference to nodes
Comment #26
avpavlov commentedNo, I do not need, because Drupal (or i18n module?) allows to have single menu for all languages instead of one menu per language. One menu per language is useful when I need to have completly different menu structures. In my case I prefer to have single menu structure and translate it via "Translate interface" page because it allows to
a) mix up translated and not translated pages - very useful, because sometimes translation is not available along with source page
b) have /ru/page link working even if there is no /page in Russian - it will show English page. Once translation is completed then no URLs will be changed on site - /ru/page will show translated content.
Thank you for another example - I will investigate it to ensure it covers my needs.
Comment #27
avpavlov commentedSmall example (language switcher is not positioned yet so ignore)
See "Further information" menu at http://zamfer.texunatech.com/
and "Доп. информация" at http://zamfer.texunatech.com/ru
- Brazil - page and menu item are translated
- Peru - menu item translated but page did not
- Uruguay - menu item and page are not translated
Regardless of the differences above, menu structure for Russian version is not broken, all /ru/* links work as expected - if there is translation then user sees translated page, if there is no translation - then English. Unfortunately, the only way to achieve such behaviour is perform nico's changes (thx nico!).
Magic words "it is not bug, it is by design" mean nothing for me and other developers who have requirements to make it working as on my example site :)
Comment #28
pasqualleI am without a new argument but I would like to repeat myself: In Drupal 6 core you need to create new menu items (or new links) for different nodes. So there is no bug, it works as it was designed.
In i18n package, you have a i18nmenu module which claims that you can create one menu item for translated nodes (one menu item for one translation group). I am sorry but I am not really familiar with that module, so I can't provide further information about it. I tried it once, and it does not worked for me as I expected it should be working..
Making the i18nmenu module work as we would like to, with breaking the functional design of Drupal 6 core is not an acceptable solution.
So the only advice I can give is to check the issue queue for i18n, especially the issues with i18nmenu. You can ask support questions (report bugs) if it does not work for you as it should be, if it does not work as it is written in the module documentation. Maybe it works perfectly but you need to set up a special value somewhere, I have no idea.
Comment #29
jackalope commentedI'm having the same problem as the original poster. I've got a similar site - almost the entirety of the site is in English, with some nodes translated into Spanish. The interface is never translated into Spanish.
I think that I can deal with my problem by manually adding aliases for the nodes in Spanish, instead of creating the aliases while creating or editing the nodes. Drupal only resets the language of URL aliases that are set directly within the node itself, not ones that are set through Site building > URL aliases > Add alias.
I don't think this is a long-term solution, though. It would be great if Drupal didn't automatically reset the language of URL aliases or if there was some option to stop that behavior.
Pasqualle, I tried your i18nredirect module but it didn't work; when I tried to go to one of the problem URLs (the URL alias of a page written in Spanish & current site language being English) Firefox returned a Redirect Loop error.
Comment #30
keesje commentedProblem confirmed for 6.9.
I do not agree with "by design".
Like having your electrician saying: OK, here is the switch, there is the bulb, but "by design" the wires are not connected.
The option is there to generate an alias for any node, whether or not a translation. The alias is generated but not working at all. This is not how it is meant to be.
I don't buy that, sorry :-).
Comment #31
pasqualle@kees@qrios: please write your example which alias is not working..
You need to use the language prefix for content not in the default language.. That is by design, that is how it meant to be working, and that won't be changed for Drupal 6.
Comment #32
keesje commented@Pasqualle
Thanks for reply.
Ive a simple multilingual setup, EN = default, some pages have a NL translation.
i18n is not necessary for this, core locale will do fine, exept for the URL issue.
My point is, if I generate a translation (EN -> NL), the NL node can have a URL alias (by hand or pathauto). The alias is generated without any warning the way one should expect it to be. Except for the alias isn't working nor used because you have to call it with a language prefix somehow.
I have a simple, custom language switcher using the l() API to generate aliassed links.
1) Why is it designed like this anyway? Why can't it just work? This is so not - intuitive. Nico + avpalov prove it's simple to fix. I don't need the language prefix for projects like this.
2) If this is by design, why isn't the language prefix applied in core API functions like l()? Or make at least possible to pass the language to these API's (would be an API change, I know) to return the correct aliassed path.
It could be that I'm overlooking something quite simple, please fill me in :-).
Comment #33
damien tournoud commentedl() accepts a 'language' parameter in its $options argument. Strangely, this is not documented.
Comment #34
pasqualleone reason:
in D6 you can use the same alias for different languages.
if you have a "drupal" alias for three languages, then you have pages like
/drupal
/nl/drupal
/de/drupal
if you remove the language prefix then it is not clear which page you want to see
Comment #35
jose reyero commentedI think we have a huge mess here, when an alias has a language it will work only for that language. So still I don't see where the bug is.
Till we find out, changing to 'support' and priority to 'minor' at least for i18n sprint.
Comment #36
eriksson-1 commentedI to have the same problem.
Swedish is my default language, english as an option with prefix only for english.
My primary links (aliases) only work in the default language, swedish.
Example: I manually navigate to an English page say "www.mysite.com/en/about-us".
Then click on a primary link (contact us).
The address becomes "www.mysite.com/en/node/xx" but it should be "www.mysite.com/en/contact-us".
The aliases exist but don't get used, does anyone know why?
How do you guys go about using two languages on your drupal site?
I'm using i18n and pathauto.
Comment #37
pasqualle@eriksson: that is a quite different problem
is the contact-us node a multilingual node? if not, then the problem is a duplicate of #311158: default node language
solution:
(a) change the node language to "Language neutral" or (b) create (a new node) a translation of that contact-us node.
Comment #38
eriksson-1 commentedHello Pasqualle thanks for answering.
I've already setup things as you suggested in B.
This is how i go about creating my translated content:
Note: the english node is accessible via it's alias if i type the url address manually in the location bar in the browser.
Any ideas? Do you guys not translate content this way using i18n?
Best regards,
Eriksson
Comment #39
pasqualleRe #38:
The problem is that the original menu item is displayed when you switch to English. That is against the rule that any menu item which links to a node in different language should not be displayed..
Possible causes
1. wrong display of the primary menu within the theme files
2. using the i18nmenu module
try this:
1. create a new menu (admin/build/menu/add)
2. place that menu to the right (or left) region (admin/build/block)
3. create a contact-us node in Swedish, set the (Swedish) alias, fill in the (Swedish) menu title and set your new menu as parent item
4. use node/x/translate
5. create a contact-us node in English, set the (English) alias, fill in the (English) menu title and set your new menu as parent item
you have now 2 menu items in your menu, but only the menu item for the active language is displayed and the menu link should use the correct alias, not the system path.
tips:
Create menu items at node creation.
Do not translate menu items linking to multilingual nodes. It is useless, as the menu item will not be displayed with a different language..
You can use these steps with 2 menus (one for Swedish, one for English) therefore the menu items will not be mixed, you will have different menus for different languages.
You can use the i18nblocks module to completely hide the whole menu if its language is different than the active language..
Comment #40
eriksson-1 commentedWhen i select swedish i have 1 menu item with correct alias.
When i select english i have 2 menu items:
- english node link is shown with correct alias
- swedish node link is also shown with incorrect alias
If i disable i18n menu i can't set a language when creating/saving a menu item.
I'm sorry, i just don't understand.
By "multilingual nodes" you mean a node set to "language neutral" instead of one language say "swedish"?
I wish i could have two primary menus, one for swedish and one for english but in doing this i see all the menus at the same time. Should i perhaps disable i18n all together? Can one even have two sets of primary links (see admin/build/menu/settings).
Best regards,
Eriksson
Comment #41
pasqualleset the language for the node not for the menu item. You do not need a language for menu item..
multilingual node = enabling "Multilingual support" for that node type like: admin/content/node-type/page under "Workflow settings" enable "Multilingual support"
and setting the node language when you create the node..
For this basic functionality (for the steps I wrote) you do not need anything from the i18n module.
yes: http://drupal.org/node/313302 but you should first get it working with a simple menu displayed in a block, and then experiment further..
Comment #42
eriksson-1 commentedOk some progess.
By disabling i18n i have url alias working for swedish and english nodes. However, the menu i created shows both menu items (swedish and english) all the time. What exactly do I set to only show swedish menu items when swedish language is selected and so forth?
Summary of what i did to follow your instructions:
The menu settings for the swedish node:
Title: testar
Parent item: menu test
The menu settings for the english node:
Title: testing
Parent item: menu test
Regards,
Eriksson
Comment #43
eriksson-1 commentedIs it "easier" to have the same URL alias BUT different prefixes instead? like http://www.ctac.ca ?
How do u think http://www.ctac.ca has things setup?
I'd be happy if I could manage that setup.
Best regards,
Eriksson
Comment #44
pasqualleok, I tried to reproduce your problem:
actually I was wrong, you need to enable the i18n module to show menu items from the actual language only. But only the i18n, you do not need the i18nmenu module.
So just enable the module and your menu will work as expected..
Comment #45
eriksson-1 commentedWell Pasqualle, I've done what you're said by-the-book but I'm still seeing both menu items at the same time. Do you think I need to change my settings in "admin/settings/language/i18n"? (see attachment). Can't find any good info. on what to select under "content selection mode".
It's hard to believe how difficult this is, such a simple task. I'm beginning to get the same feelings about "Drupal 6" as I do about "Microsoft Windows Vista". But I'm learning also, maybe I'm very close without even knowing it ;)
Comment #46
pasqualleIt is really easy, the problem is that most users enable every possible module and change most of the settings without knowing what they are doing. They don't realize that they don't need the module and it can be done with Drupal core..
change Content selection mode back to default "Current language and language neutral."
if it does not help I would suggest reset everything to default: disabling i18n, uninstall i18n (on admin/build/modules/uninstall page), and enable i18n..
Comment #47
eriksson-1 commentedPasqualle thank you so much for your patience.
Your input showed me the way! I came to realise that something was very very wrong with my setup since I was doing exactly what you said without any results. So, I added the following code to settings.php and followed your instructions (disabled i18n-menu, set "current language and language neutral")
And the result; bingo baby!
Thank god for some progress this has been ... well I almost threw my computer out the window!
Cheers Pasqualle!
P.s. Why the hell isn't this added to settings.php automatically upon installing i18n!!!
Comment #48
eriksson-1 commentedForgot to reply, made a new entry by mistake sorry.
Comment #49
Gauss1777 commentedI'm not even using i18n module and this is in minor priority?
I don't get why the path module is not working as it should be. For what I read the problem is not with the pathauto module as I first thought that was my problem.
The path module should be "redesigned" to work as it should be. I cannot beleive that for Drupal 6 one of the main features in core are the multilingual support and there are things that still does not work.
I have the same problem, aliases are not working for other language different to the default one. +1 for what kees@qrios said at #30.
Suscribing.
Comment #50
pasqualleThe path module works as it should be. I don't have any problems with URL aliases for any language..
@Gauss1777: If you tell me what does not work as it should be, then I will answer you what is wrong with your method. The only problem is that users do not understand all the problems with aliasing and why it works as it works.
the problem in this issue is that the poster did not used the language prefix in the URL, what is required for any non default language..
why is it required? because you can use the same alias for different languages..
how would you distinguish between these two different pages, if you do not tell the language?
mysite.com/myalias
mysite.com/de/myalias
Comment #51
Gauss1777 commentedGood question and here's a good answer Pasquelle:
Pathauto module assigsn an alias to something like "content/title-of-node" to any recently created node by default. I modified the pathauto rules so that when my page it's english, then that alias format is "content/title-of-node" but added a new rule so that when the page it's spanish, then the created alias is something like: "contenido/título-del-nodo". Then I don't see any reason why the prefix should be used.
Now what I'm going to try is activate the prefix and see if I can have one alias for an english page called: "en/home" and a translation to spanish for the same page (but different node due to the way Drupal works) with the alias: "es/inicio" and NOT "es/home", I hope this works and tell you. Thanks Pasquelle.
Comment #52
Gauss1777 commentedWell, didn't work.
However I used what avpavlov said at #14. Everything works nice now.
English aliases as "content/title-of-node" and spanish aliases as "contenido/título-del-nodo". Translations links and tabs working and all. :)
Comment #53
pasqualle@Gauss1777: you should use "es/contenido/título-del-nodo", that is the only one correct path to your Spanish page..
The prefix should be used because in Drupal 6 you have an option to use the same alias for different languages..
#14 is a dirty hack and you may have other problems when using it.
When you apply #14, are you sure that the active language is changed to Spanish on the "contenido/título-del-nodo" page? Because if it is not changed then you can't use language aware blocks for example..
Why do you order your aliases by language name, when there is a language weight value?
What happens when you have two pages with the same alias like "Drupal", which page will be displayed? and why?
using quick hacks in Drupal is always a bad solution..
Comment #54
cesar.brod@gmail.com commentedWell, I am basically having the same problems people are describing here. URLs aliases are being properly created, they show up in the database and still I cannot access them - Error 404. The hack described on #14 works, but it messes up my whole book structure so I cannot use it. I heavily rely on aliases once I use sections. #47 has no effect whatsoever. I am pretty much lost here but I will find the time to perform any tests you may suggest.
Thanks!
Comment #55
pasqualleyou can't access the page with using
http://mysite.com/lang_prefix/alias?Comment #56
keesje commentedIts been a while since I've been here :-)
#33 and #34 do clear up a bunch for me.
Be carefull when you change default language in an exising D6 site with multilingual content, because URL's are about to change for all content becoming the default language or leaving it.
To be short:
1) Use a decent language switcher, like provided by the i18n module that take care of the lang prefixes.
2) Use the 'language' parameter in its $options argument of l() generated links like Damian (thanks) explains in #33.
Comment #57
avpavlov commentedHi Pasqualle!
> Why do you order your aliases by language name, when there is a language weight value
To be honest, there is filter which passes requested, default or neutral language aliases only. I do not think there are reasons to use weights to resolve what to use. Obviously, requested language has higher priority. Choosing from default and neuter I decided default has higher priority than neuter - it is ok for dirty hack :)
Also, in 17th post I mentioned that it is better to use real default language instead of 'en' but I do not know how to obtain it as have little experience with Drupal.
Comment #58
pasqualleI do not really understand what do you mean by "there is filter which passes requested, default or neutral language aliases only"
ok, so example
1. default language English
2. alias "drupal" does not exists for English
3. alias "drupal" exists for German and French
paths:
/drupal -> not found
/de/drupal -> ok
/fr/drupal -> ok
so what do you want to show on /drupal and why?
Comment #59
litelus commentedI've read this thread and tried very hard to make Drupal with 2 languages work, Romanian and English.
What seemed to happen on my site, was that the alias only worked correct when English was the default language.
I've enabled "Content translation" and installed i18n module and enabled only "Internalization".
on admin/settings/language/configure i selected "Path prefix only".
I am using the "Pathauto" module
I was testing with two pages:
test_en
test_ro
If romanian was the default language:
test_ro: worked
test_en: an alias for test_en was created but didn't work. All the internal links Drupal used pointed to node/2 instead of en/test_en and they worked, but if you manually typed /test_en or /en/test_en it gave page not found.
Then i tried with English as the default language, redid the pages and everything worked fine.
test_en: worked
test_ro: for the Romanian page drupal was using ro/test_ro (which was ok with me) , and it worked.
So the aliases with i18n only work correct when English is the first language?
I also deactivated "pathauto" and used manual aliases, but the behavior still appeared.
Comment #60
pasquallethe aliases work correctly with any default language
@litelus: make sure you have the "Path prefix" set for the English language (admin/settings/language/edit/en)
Comment #61
litelus commented@litelus: make sure you have the "Path prefix" set for the English language (admin/settings/language/edit/en)
that fixed it
so when you switch to another base language you also have to add "en" as a "path prefix" in "admin/settings/language/edit/en"
thx
Comment #62
gagarine commentedNobody can understand if you create an alias:
"about" -> "node/3"and after on your page the link is "node/3" instead of "about". Why by default create alias for "All language" instead of translate theme. Pathauto seem to provide this feature soon #321848: How to make pathalias enable alias for all languages?
For me an alias is an alias and basically point on a resource. Because translations are always a new node, we need different alias for different translation as we need different alias for different node.
I think it's easier to see alias language as part of a node. You can translated it like the body or the title because every translation is a new node and so can have a new alias. But alias don't need itself a language dependency.
So what append if we want two translations with the same alias? You CAN NOT because it's two different node.
EDIT related #541802: Let path_nodeapi reuse the current path alias language on update
Comment #63
webel commentedsubscribe: perhaps related: #785080: URL path alias for non-English default language pages only working for some web browsers
Comment #64
d.cox commentedThis fixed the issue for me as well. English is my default language but my paths, in menus, where showing as node/# until I added the prefix for English. Now everything works.Thanks!
After clicking around on my site the menus started show the en/node/## path again so this did not fix the issue after all.
Comment #65
ajay1kumar1 commentedIf you're trying to allow users to select different languages in their user settings, you've got more than one language installed, are using Drupal 6 and it isn't working.
Go into Administer -> Site configuration -> Languages and change Language negotiation to Path prefix with language fallback.
Hope this will help!!! Cheers Netlink software group.
ajay1kumar1
Comment #66
alby111 commentedHi mdupont,
I was able to find a solution doing the following steps:
in site configuration, select: language - - configure--- language ----language negotiation
and select the option: Path prefix with language fallback.
Then go to site building - URL Aliases and select the tab: authomates alias settings, and in the "Pattern for all Page paths in English":
don´t put the prefix en , only put [title-raw]
and in the Pattern for all Page paths in "your language": don´t any the prefix , only put [title-raw].
and voila it worked for me!
thanks to all the kool people that are involved with this project , Acquia , lullabot, four kitchen , development seed , mustardseedmedia.com , Merlin of Chaos, modules builders, others
Comment #67
mdupontThanks alby111 for providing a workaround, even if this is an old issue.
Comment #68
Magicthought commentedHi everybody,
I'm having an issue with this, I've tried several times to make this work but still it doesn't.
I have a 3 language site and I let users choose their language upon login.
The problem is that if I create any node in a language that is not the default one i can't access it's alias (i've tried both at /myalias and /lanugage-prefix/myalias) It seems that all the solutions above is working only if you enable the path prefix in language negotiation which creates some problems in viewing comments.
Any tips?
Comment #69
nplowman commentedFor anyone else stumbling into this thread:
There's actually a module that helps solve this problem quite elegantly:
https://www.drupal.org/project/neutral_paths