Hey,
-- Chris, let me know if this is not an appropriate place to post this, I hope others will benefit from the announcement.

I just pushed some code to a sandbox containing a start at providing multilingual facet items. It currently only supports taxonomy-based facets but the system can be extended to support other sources.
The code is based on a suggestion from cpliakas here: http://drupal.org/node/1210730#comment-4701718.
It uses the i18n module i18n_taxonomy to retrieve translations and *should* support both localized taxonomy terms an separate language specific terms (I have only tested localized terms).

It is still a little rough around the edges and the translation handler class in particular may be a little overkill. I would greatly appreciate some feedback from those who are more familiar with both the facetapi and i18n projects.

The sandbox can be found here http://drupal.org/sandbox/thegreat/1276796.

Thanks,
Tom

Comments

cpliakas’s picture

Excellent!!! Definitely the right place to post, and I am glad someone is working on this. My i18n chops are definitely not where they should be, so please post back if the API prevents you from doing what needs to be done. Thanks for the work on this!

~Chris

das-peter’s picture

subscribe

zambrey’s picture

+1

aroq’s picture

Component: Code » Code (functionality)

subscribe

cpliakas’s picture

Status: Active » Fixed

Closing as "fixed" for lack of a better option. Progress of this task should be followed at the Facetapi i18n project.

tnightingale’s picture

Just a follow up, the patch here: http://drupal.org/node/1340858#comment-5259368 solves this problem for facetapi and elsewhere. The i18n_translate module probably isn't necessary anymore.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

guillaumev’s picture

Component: Code (functionality) » Code
Status: Closed (fixed) » Needs review
StatusFileSize
new446 bytes

I'd like to reopen this issue because, even if, it's true, the patch for the i18n module does 99% of the work, facetapi does not call the entity_label function for taxonomy terms, and still uses $term->name, resulting in taxonomy terms not being translated in facets. Here is a patch which fixes this...

cpliakas’s picture

Category: feature » bug

guillaumev,

Thanks for the patch. Logic makes sense to me. I'll apply and RTBC within the next few days.

Thanks again,
Chris

cpliakas’s picture

Status: Needs review » Reviewed & tested by the community

Dropped off my radar. Marking as RTBC.

cpliakas’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x versions of Facet API.

Congrats on becoming the 23rd code contributor to Facet API!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

martijn houtman’s picture

Somehow, entity_label() does not translate my term labels, they still show up in the source language. Rather, I have to use i18n_taxonomy_term_name() in order to show the translated label.

Please note that I am using localized terms, not translated. Might that be the issue?

finex’s picture

I'm using a "Localized" vocabulary with Facet API -dev (2012-11-02): terms are not translated on faceted search blocks.

@Martijn Houtman: where did you use i18n_taxonomy_term_name() ?

P.S: this issue affects "Search API" too ( http://drupal.org/node/1775678 )

gaëlg’s picture

Localized terms problem is addressed at #1340858: Language in entity_label()

martijn houtman’s picture

I edited facetapi/facetapi.callbacks.inc like this:


/**
 * Map callback for taxonomy terms.
 */
function facetapi_map_taxonomy_terms(array $values) {
  $map = array();
  $terms = taxonomy_term_load_multiple($values);
  foreach ($terms as $term) {
    if (module_exists('i18n_taxonomy'))
        $map[$term->tid] = i18n_taxonomy_term_name($term);
    else
        $map[$term->tid] = entity_label('taxonomy_term', $term);
  }
  return $map;
}

pirex360’s picture

I tried to apply #16...but i dont see my taxonomy terms translated ? I must do something more ?

facetapi support taxonomy translation, out of the box ?

cossimo’s picture

@pirex360 -- Don't know if you've solved this problem yet, but per http://drupal.org/node/1865604, updating to the latest dev of the Title module solved this problem for me.

martijn houtman’s picture

Cossimo, nice catch, it was indeed the title module interfering. My code in #16 is no longer needed.

pcoucke’s picture

Status: Closed (fixed) » Needs work

I still needed the fix from #16 in order to have translated terms. I don't have the Title module installed.

brainHax’s picture

Issue summary: View changes

Do you still have to translate each terms from translate interface?

joinso’s picture

Hi!

I confirm that #16 works.

Regards,
JOINSO