Internationalization allows to create translatable vocabularies and to translate terms. Where i18n is available, i think that only current language vocabularies terms should be displayed.
Here an example from the current version: i have 1 vocabulary with two terms "futari" (Italian and English). When filter is applied, the two definitions are displayed in the first two occurrences of the term. If i18n module is available, and when that term is translatable, it should be displayed only the current language version (using i18n_get_lang()).
I try with:
if(!module_exists('i18n')){
$result = db_query("SELECT t.name, t.description, t.tid, COUNT(tn.nid) as nodes FROM {term_data} t LEFT JOIN {term_node} tn USING(tid) WHERE t.vid=%d GROUP BY t.tid, t.name, t.description ORDER BY LENGTH(t.name) DESC", $vid);
}
else{
# get only current language terms if i18n module is available
$result = db_query('SELECT t.name, t.description, t.tid, COUNT(tn.nid) as nodes FROM {term_data} t LEFT JOIN {term_node} tn USING(tid) WHERE t.vid=%d AND t.language="%s" GROUP BY t.tid, t.name, t.description ORDER BY LENGTH(t.name) DESC', $vid,i18n_get_lang());
}
on _glossary_get_terms(), but it seems that cache display only English or Italian terms. Maybe a cache problem? Wrong inserted code? Any idea to make it works?
I have the same problem on the glossary page, but this time only first element appears. In this case, if the i18n module is enabled only current language terms should be displayed.
Combining taxonomy terms translation by i18n and language-based selection by glossary can lead to fully translatable glossaries.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | glossary_i18n.patch | 4.75 KB | nancydru |
| #3 | glossary_i18n.patch | 3.28 KB | nancydru |
Comments
Comment #1
nancydruIf I remember correctly from previous brushes with i18n, using a db_rewrite_sql would take care of this. I'll have to do some research because I am English-only and really don't understand all of this. I've opened a support request on i18n: http://drupal.org/node/233817
Comment #2
nancydruIn _glossary_get_terms, could you try changing the query to this, please:
Comment #3
nancydruActually, here's a more complete patch that changes all the queries that I think probably need the db_rewrite_sql. It should also get the glossary overview page, which might be the first good test. And, yes, any time you're trying to check out something like this, it is best to clear the cache frequently, but definitely before testing this patch.
Please let me know what, if anything, happens.
Comment #4
chirale commentedHi Nancy, thanks for your patch.
I try it but I get this SQL error:
It seems that "n" alias is somehow misplaced. I've tried to change some "n" alias occurrences but it seems a persistent problem. Any idea? Thanks.
Comment #5
nancydruOkay, it would be nice if I would learn to read. The APIs for "db_rewrite_sql" specify that I should use a primary table name. So let's try this version of the patch. BTW, you get a bonus sneak preview of the "abbr" feature.
The API doesn't mention "term_node" so I'm not sure what to do with those queries, but they do also hit "node" so they may work correctly.
Comment #6
nancydruforgot the status
Comment #7
nancydruFix committed to -dev versions.
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #9
AaronCollier commentedI am currently not getting i8n support. I have terms that exist in two languages, English and Czech. I have connected the terms with the translate option of the taxonomy. But I only see the English option even when the page's language is set to Czech. Terms that are only in Czech appear in Czech, but terms in both appear in English. It would be nice to be able to see only Czech things.
Comment #10
nancydruI would prefer that you had opened a new issue rather than reopening one that was fixed and closed.
Since I speak only English and don't have i18n, the fix for this is going to have to largely come from the user community, just as it did before. I know of other problems in this area that are still pointing back at i18n itself.
Comment #11
AaronCollier commentedSorry. I thought it was better form to build off of older patches. I'll open another issue.
Comment #12
nancydruThank you. What I would prefer to see in a case like this is that a new issue get opened and reference the old one. If I think it is better to reopen the old one, then I can do so and mark the new one as a duplicate. Just one of the quirks of Drupal's issue tracking system.