Closed (outdated)
Project:
Drupal core
Version:
9.4.x-dev
Component:
language system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Mar 2008 at 07:39 UTC
Updated:
7 Dec 2022 at 07:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Roxpace commentedThanks, this is most welcome, strange that not many else has reflected this huge problem,
Comment #2
jose reyero commentedThese patches work. However, by applying them I'm sure some other feature request like 'Seach in all languages' will pop up, which btw makes a lot of sense, as searches are text based thus search terms have some language by themselves.
So about the search form, I think we should try to add a language field to the search form that defaults to current language and that would be it.
Feedback/suggestions welcomed, and patches more welcomed yet :-)
Comment #3
andrew answer commentedAdded new version patch for blogs. Now 1) blogs with urls like blog\1 filtered too 2) RSS feeds language-specific too.
Comment #4
asw20pilot commentedThanks a lot for the node patch! I applied it and it seems to work fine.
I wonder how a bug like that (duplicate stories on the front page!) was allowed to pass through testing of drupal version 6.
Comment #5
andrew answer commentedDrupal 6.2 is out, so this is a new patches for core modules.
Comment #6
Roxpace commentedAre these patches working with D6.3 and is it now a part of the beta release of this module ?
Comment #7
qbicdesign commentedi have this patch installed in 6.3 and seems ok so far
in fact i just grabbed my patched files from 6.2 and overwrote the 6.3 original files - probably not recommended but seems to work ok.
I only did that cos i hate the drupal's patching method, which is not exactly simple.
Comment #8
Roxpace commentedYes, but what can you do when the Drupal core development team doesn't solve things that is important fast enough even with contributions from the community, a lot of patches are waiting to get added and never does.
Comment #9
nedjoYes, this should be done as a new 'language' search operand, but this is very difficult to do.
The issue is that it's not enough to add checkboxes to the search form and then read them in and turn that into hook_db_rewrite_sql() clauses. Full core search support requires that all search criteria be treated as operands that can be contained in the url of the search. So in this case we would need e.g. "language:en,fr" in the search string.
See #69595: Node search operands should be extsnsible and moved out of node.module for some of the problems involved in trying to add custom search operands to Drupal's core search. If we want to keep operand support, the approaches open to us are (in the order of what seems best):
* Solve #69595: Node search operands should be extsnsible and moved out of node.module
* Hard-code a new "language" operand into core's search, alongside the existing hard-coded operands
* Write an API contrib module for handling custom search operands
* Add a ton of code to i18n to handle custom search operands.
If we limit ourselves to what would amount to a partially broken search, we could just:
* Add checkboxes and check for the $_REQUEST and rewrite search sql without adding operand support.
Comment #10
jose reyero commentedMerging the thread in #316147: Multilingual Search for Multilanguage site
We should also add some content selection options specific for search if we find the way to add some fields to the search form.
Comment #11
hass commented+
Comment #12
azoho commentedsubscribing
Comment #13
andrew answer commentedDrupal 6.11 is out, so this is a new patches for core modules. Seems like nobody build multilingual sites without huge 18n module. I prefer little patch, and think what this language filter should be even integrated into core, because this is not break any functionality, only apply multilanguage feature in more logical way.
Comment #14
andrew answer commentedComment #15
hass commentedPlease provide unified patches, http://drupal.org/patch/create
Comment #16
jose reyero commentedAgain, we are not including core patches as part of i18n module. So this is still open till we find a module-only approach that needs no core patching.
Comment #17
boran commentedBut this patch does not change the search form, or the resulting listing?
The idea is to allow search for items in the current language, or all languages?
Comment #18
eloiguell commentedIn search form I had filter the duplicates in other languages when $url contents "node/" in module/search/search-result.tpl.php
It works for me.
Comment #19
andrew answer commentedOf course patch Drupal core is not very "right" solution, but it simple and works for me for years ) I fix only several SQL queries and get all what I need.
So, version 6.16 patched too.
Patching is easy under Linux, use "patch [file] [file].patch" command.
User eloiguell provide nice filter for search; but it's work ONLY if "pathauto" module set, so other-language results will have node/ URLs, but current-language results will be with content/ URLs, and we can use that filter. Other case, filter clear all search results (I think, not test without pathauto module).
I made patch from his code.
Comment #20
andrew answer commentedHere patch for search (use pathauto!).
Comment #21
andrew answer commentedDrupal 6.19 is out, so I update my site & patches too. One additional patch for "tracker" module added; it filter recent posts by language. So, when you apply the patches, you get two-language site with ability to translate some blog posts, site pages, book pages and other content, but FILTERED by language switcher anywhere: in tracker, search, blog, blog list and node list. Note: you should use "pathauto" module to enable search filtering, elsewhere DO NOT PATCH search.
You can see patched version in action at http://dev.answe.ru as RU and http://andrew.answer.name as EN site.
Comment #22
andrew answer commentedI pack patches to archive to avoid renaming.
Comment #23
andrew answer commentedtags fixed
Comment #24
fabianx commented@Andrew Answer:
That is nice, but could you use unified diffs? (diff -u)
They are much easier to read ...
Comment #25
andrew answer commentedComment #26
andrew answer commentedI decide to change issue description, because it now core fork more than only search results filter. By default, locale module + content translation allow good UI to translate nodes and create bilingual sites. But, because any user show nodes on all languages, this waste all functionality. I expect another behavior by default, and without i18n or any other additional module(s).
Here is the set of patches, which (I hope) can be tested automatically. When these patches applied to multilanguage site, it allow to filter blog and node entries, search results, recent posts list, RSS feeds by current site language.
I also need to check how these patches work with disabled content translation, or only with one language, or with 3 and more languages.
And, yes, don't forget to enable pathauto module to filtering search!
Comment #27
andrew answer commentedHere patches without D6 suffix because I don't know how add patches to test queue. So I test it :)
Comment #29
andrew answer commentedHope this way will work.
Comment #31
andrew answer commentedWhat's wrong? Anyone can help?
Comment #33
andrew answer commentedOuch! As I see here http://drupal.org/node/894166 testbot work ONLY with D7 patches!!!
But WHY don't filter issue patches for testbot by Version field??? It confused me and other developers.
Comment #34
andrew answer commentedI finally patch Drupal 6.19 core modules to disable link to itself on any page in language switcher. Also, if no translation was provided, no link will be in language switcher. This is behavior I expect from language switcher by default.
I made one patch from CVS and others from Drupal tar.
You can check how it work on http://dev.answe.ru and http://en.answe.ru
Comment #35
andrew answer commentedAlso, here some patches for pathauto-enabled users (human-readable URLs is a MUST for any site). What problem fixed here? When we use aliases for nodes, old URLs leaved in site structure, can be opened and indexed. This cause "duplicate content" SEO bug and confuse users too.
Next functions filter node/ URLs to show 404 page instead, and prevent search engines to index node/ URLs by patching robots.txt. filtering_D6 is a cumulative patch.
Comment #36
plachDrupal 6 and 7 are feature frozen. This can only be addressed in D8.
Comment #37
boran commentedI wonder if these patches could be integrated into a distribution like Pressflow (https://launchpad.net/pressflow), where they actually make core changes and ensure these work across drupal updates.?
Comment #38
egon.ojamaa commentedRepy to #34 Posted by Andrew Answer on December 7, 2010 at 8:06pm
I made a better fix for this issue.
No core hack.. just a module.
http://drupal.org/node/995500
Comment #39
andrew answer commentedFind what URL like /node/blog/add cause 404 error. I fix it, and finally remove custom_url_rewrite_inbound from bootstrap.inc. I suggest to include this function into settings.php by hand. Install: patch with easy command "patch -p0 <_filtering_D6.patch" from Drupal root. Uninstall: patch with "patch -p0 -R <_filtering_D6.patch" (of course you shouldn't change affected core modules).
Comment #40
andrew answer commentedFind what URL like /node/blog/add cause 404 error. I fix it, and finally remove custom_url_rewrite_inbound from bootstrap.inc. I suggest to include this function into settings.php by hand. Patch here.
Comment #41
terotik commentedSuper!! I spent too long time to find a non-patch solution to this, before giving this a try. Thank you, much appreciated.
One problem: this removes 'active' class from the language list.
Comment #42
andrew answer commentedDrupal 6.20 is out, so there is a new patch.
Comment #43
nedjoAny such patch would be for Drupal 8.
Comment #44
andrew answer commentedIf this patch for 8.x then it need to be rewritten to support new codebase. Same time this patch fully work for D6.20 and I think what this relation should be leaved. What do you suggest to do for it?
Comment #45
Dret commentedSorry but egon.ojamaa's module ( http://drupal.org/node/995500 ) works very fine in Drupal 6.19 but break translation system in 6.20.
Waiting for an update!
Comment #46
egon.ojamaa commentedFixed my module.. happy using
http://drupal.org/node/995500
Comment #47
fabianx commentedHi,
This absolute is a needs work.
Sorry @ Andrew Answer: While I see your need for those changes the approach taken to patch core is wrong, because all that you do can be done in a custom module.
Every query you changed has db_rewrite_sql and that for a reason.
So that modules can alter the behavior. So if you want to change all those queries, please use code like this:
This essentially does the same as your code, but without patching.
As for the language switcher:
@Egon: I looked at your module and while your approach is working, you don't need to add a new language switcher block.
You can just implement (to change the language switcher):
This can be written even shorter as:
I have not yet understood the problem with the tnid - though. So I leave you one item for patching now :-).
I hope this helps solve these issues without having to patch core.
Best Wishes,
Fabian
Comment #48
plachDuplicate issue at #211831: Multilanguage dependent listings are not supported at all.
Comment #49
klonos...coming from #316147: Multilingual Search for Multilanguage site which was closed as a duplicate of this one here.
Can we please have an updated issue summary with status and available patches/solutions for drupal 6, 7 & 8? I am looking for a solution to D7 multilingual site search. Anything available for testing?
Comment #50
sami_20031 commentedblog.module.patch queued for re-testing.
Comment #51
klonosAre these dupes???:
#1335832: The Drupal core "Who's new" block in a multilingual site always displays the users' real names in the site's default language.
#1331724: All translations of forum topics are displayed - no matter what language the site is switched to.
Comment #52
foripepe commentedIn Drupal 7 there isn't hook_db_rewrite_sql() any more. But you can use hook_query_alter().
Example (needs review):
Comment #66
quietone commentedI think this is outdated. I have been testing multilingual functionality on Drupal 9 and Drupal 10 for some time for the Bug Smash Initiative. I haven't experienced the problem in the Issue Summary.