I added support:
-i18n_taxonomy in callbacks,
-i18n_node in callbacks
-translated language in callback

Comments

cpliakas’s picture

Status: Needs review » Needs work

Thanks for the post and patch. Marking as "needs work for a couple of reasons.

It looks like facetapi_map_language() passes the language variable through t(), which is against best practices. See http://drupal.org/node/322729, specifically the passage below:

Using dynamic values, such as t($type). Whenever you use dynamic strings to call the above functions, make sure that all possible values are already in the code elsewhere in literal form using the API. Do not translate user provided content.

Are we sure that these strings have already been passed through t()? This is an area I am not too familiar with, so any clarification or confirmation would be helpful.

Also, based off of comments on the Facetapi i18n project, the patch to i18n_taxonomy at http://drupal.org/node/1340858#comment-5259368 apparently resolves the taxonomy issue.

Thanks,
Chris

benys’s picture

I checked how are implemented translation language names for example on /admin/config/regional/language/add page - handler locale_languages_predefined_form(). In function _locale_prepare_predefined_list() t() is used to translate language name:-).

cpliakas’s picture

Great! Thanks for pointing that out and confirming.

benys’s picture

What should I do now?

cpliakas’s picture

I think based on thegreat's commets in his sandbox project we can skip the changes to the facetapi_map_taxonomy_terms() callback since the i18n module is being worked on to support this without any changes to Facet API. Based on your feedback, the change to the facetapi_map_language() callback is valid and I think would be a great addition to the module.

In terms of the facetapi_map_bundle(), I am hesitant to start committing code with module_exists() calls. In addition, there is work going on at #1338350: Extend facetapi_map_bundle() to all entity types which make this callback generic to all entities which would effect the proposed logic in the patch. I am thinking that this might be a good candidate for a project like Facetapi i18n where you could implement hook_facetapi_facet_info_alter() to modify the appropriate map callback keys to point to a custom callback with the i18n code you posted.

benys’s picture

StatusFileSize
new519 bytes

I created task in i18n #1371610: Node types Facetapi integration.
I attached only patch with translation languages.

cpliakas’s picture

Status: Needs work » Reviewed & tested by the community

This is great. Thanks for opening the issue against i18n as well. Let's see what comes out of that and we can revisit in Facet API if necessary / once the facetapi_map_bundle() function gets re-worked.

cpliakas’s picture

Title: Support i18n translations » Support i18n translations in the bundle mapping callback

Changing title to focus it down to what the patch accomplishes.

cpliakas’s picture

Status: Reviewed & tested by the community » Fixed

Committed at http://drupalcode.org/project/facetapi.git/commit/8004a76.

Congrats on becoming the 16th committer to Facet API!

benys’s picture

Thank you but...

i18n's staffs don't like our ticket :-(. They won't apply patch:-(
What can we do with this?

cpliakas’s picture

As a quick solution you can always alter the facet info in a custom module and implement your own mapping callbacks. I have to do some research to figure out a consistent i18n strategy for the entire module. The new current search functionality introduces a whole new set of issues, so I want to make sure we are consistent in our approach.

cpliakas’s picture

Title: Support i18n translations in the bundle mapping callback » Support i18n translations in the language mapping callback

Changing title for transparency as to what was done.

cpliakas’s picture

Note that the Facet API Translation module now provides the content type mapping capability.

Thanks,
Chris

janchojnacki’s picture

StatusFileSize
new1.38 KB

Benys, thank you for your patch. I saw one error in if($i18n_taxonomy_on) { condition. Adding working patch for me.

cpliakas’s picture

Status: Fixed » Closed (fixed)

Closing this issue, as the only supported translation method moving forward will be the Facet API Translation module.

Thanks,
Chris