Problem:
The i18n module allows us to define term translations within a vocabulary that is language-independent (e.g. languages are assigned to terms belonging to a common vocabulary, and no language is assigned to that vocabulary). The vocabulary being language-independent, it has a single language-independent name. Thus, there is no way to translate the vocabulary's name when it shows up on a page. And if instead we define separate vocabularies for each language, it is fine for localizing the vocabulary names, but then there is no way to define term translations (because the current interface does not allow to define term translations across vocabularies).
Suggestions:
- Add a mechanism to translate the names of language-independant vocabularies (sounds strange).
OR
- Change the interface to allow cross-vocabulary term translations (sounds more sound, I guess).
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | vocabulary.patch | 985 bytes | mfb |
| #4 | vocab_term_patches.tar.gz | 3.98 KB | mgifford |
Comments
Comment #1
david lesieur commentedI've been thinking about this (for a brief moment, that is). If I follow my second suggestion, the logical result could be:
Comment #2
jozef commentedI have used the locale module to translate the name of the vocabulary, and display it with t($vocabulary->name). If all modules would display the name this way (e.g. taxonomy_menu does it), then there is no need for a new database table i18n_vocabulary. (?)
Comment #3
david lesieur commentedYou are right, this solution works pretty well to translate vocabulary names.
A drawback I see is that renaming a vocabulary will break the translations, something that would not happen if various vocabularies where linked with a translation id (trid) in the same way terms are linked. This may not be a major drawback, though, as I guess most people do not rename vocabularies very frequently...
However, I think most modules do not use t() when displaying vocabulary names because the locale module was not really meant to translate database content, but was meant to translate a site's interface. There must be some reasons for this, otherwise why not using t() to translate terms as well?
My initial issue was in fact two rolled into one (translating terms across vocabularies _and_ translating vocabulary names), so I just posted a new issue for the former problem only (http://drupal.org/node/34113).
Comment #4
mgiffordBoth $vocabulary->name & $term->name need to be patched in a number of modules. Taxonomy is a pretty critical part of Drupal.
In anycase, I've bundled together at least some changes which will use the translation t() solution which was discussed here.
I'd really like to see some better way to handle this in the future. Training folks to do this is going to be a real pain. Also, it can't be good to just keep making that array bigger and bigger.
Mike
Comment #5
sungkhum commentedWill this work in 4.7.0?
Thanks,
Nathan
Comment #6
jose reyero commentedThis version is not supported anymore, we'll consider this for versions 5.x or 6.x...
Comment #7
halfiranian commentedI'm also having issues translating vocabulary names.
Can I just confirm (not quite clear) that you can only translate vocabulary *names* if you set to localize terms? I don't want to translate terms, just the vocabulary name.
I've changed this to version 6.x because that's what I'm using.
Thanks
Comment #8
mfbHere's a start on vocabulary name translation on the node/add pages.
Comment #9
jose reyero commentedCommitted a similar one #494576: Translate tags vocabulary name on node form?
Thanks
(Btw, the module is ready for a new release, some quick testing welcomed)
Comment #10
drupalfan81 commentedCan someone tell me if this is why my website refuses to show the translated vocabulary names in faceted search on my multilingual site? All the terms are being translated as they should and the rest of the site has been translated using translate strings and the translate node interface. The last thing I have left to translate, which is very important, is the vocabulary names which appear in the faceted search and inform the user of what they are searching for. Without this being in the user's local language, it's a bit useless.
Comment #11
drupalfan81 commentedCan someone help me with this. I can't tell where the bug is. I am using the latest version of internationalization. I am using "translate" method on all of my vocabularies and they are working properly, however the vocabulary name itself is NOT translating. I am trying to use this module along with Faceted search module. The faceted search module is displaying the translated terms properly and that all works, but the Vocabulary name themselves are NOT being translated. I looked at the faceted search and I believe it should be displaying the vocabulary name's in their translated values. Here is the code I copied out of the Faceted Search module. ..
/**
* Localize a vocabulary by replacing its name attribute with its localized
* version for the current language.
*/
function _taxonomy_facets_localize_vocabulary(&$vocabulary) {
// If this vocabulary supports localization.
if (module_exists('i18ntaxonomy') && i18ntaxonomy_vocabulary($vocabulary->vid) == I18N_TAXONOMY_LOCALIZE) {
$vocabulary->name = tt("taxonomy:vocabulary:$vocabulary->vid:name", $vocabulary->name);
}
}
Shouldn't this work? Is the bug with the Internationalization module or the faceted search module? Someone please help, I cannot launch this site to production until I get this sorted out. Thanks!
Comment #12
drupalfan81 commentedChanging the category and priority. Sorry I didn't save this initially.
Comment #13
drupalfan81 commentedUpdated title.
Comment #14
jose reyero commented@drupalfan81,
Then it seems your issue is with the Faceted search module.
Comment #15
mgiffordWouldn't it have been better to have just moved it to the Faceted search module?
It's marked a duplicate, but not sure what it's a duplicate of.
Comment #16
drupalfan81 commentedHi Jose,
I thought I would reopen to see what you thought. Here is a separate thread (http://drupal.org/comment/reply/1786506) from another group of users that have logged the issue with subscription module. They are all experiencing the same thing. It definitely seems to be an issue with internationalization as the problem is appearing on multiple sites using internationalization with different modules.
Also, the term is NOT being translated within the site outside of just the faceted search, so it's not limited to just this.
I can provide you access to my dev site to see what is happening, I don't have a problem giving you admin access. I really really just need this to work. It has brought my development to a complete stop. Please help.
Comment #17
jose reyero commented@mgifford,
Well, maybe, though I don't think it's the same issue, nor they deserve to read past comments. Feel free though.
See #9
Comment #18
drupalfan81 commentedJose,
Agreed on the reading through comments. I have created a new issue here: http://drupal.org/node/1815054. Please everyone go to this page to continue with this issue. I'm hoping we can get this resolved soon.
#9 isn't the solution as the problem is different. I am not using free tagging vocabulary terms. This applies to all vocabulary names regardless of what type is selected. I tested on both per language terms and translate. Any ideas?
Thanks!