If configurations are stored in the database they are able to be translated. However, if default configurations are being read from code then they are not. We need to find some way to get string defined in default configurations into the translation table.

Comments

merilainen’s picture

I noticed this also, but after excluding the current search block from a feature, I still cannot translate the string I have defined in the block settings. Clearing caches and refreshing translatable string don't seem to help at all.

daniel kulbe’s picture

Are there any suggestions how to fix it?

brunorios1’s picture

Priority: Normal » Critical

Cannot refresh strings for Facet API.
Cannot refresh strings for Current Search Blocks.

cpliakas’s picture

Priority: Critical » Normal

brunorios1,

need a little more info before you bump this up to a crit.

Thanks,
Chris

aschiwi’s picture

I have this too. Someone with a commerce kickstarter installation is telling me he experiences the same there. Basically if you have your facet settings in a Feature, you cannot translate the strings. I haven't seen this module working because what I have here is all Features and I haven't tried to build from scratch in a clean installation.

What other info do you need?

I have tried to edit my search index and saved the facet settings again, which should make it be in the database, but still, no luck.

aschiwi’s picture

Also, like #3 says, when trying to refresh strings at admin/config/regional/translate/i18n_strings, the message is "Cannot refresh strings for Facet API."

aschiwi’s picture

we fixed this with a patch to i18n, please see http://drupal.org/node/1787124

dawehner’s picture

As far as I understand i18n you would have to implement hook_i18n_object_info() with a list callback.
This hook can explain i18n how to find all instances of this object type.

Just as example current_search would have a 'list callback' which wraps ctools_export_crud_load_all('current_search');
In theory the object defined in hook_i18n_object_info() could then figure out, with the loaded instance of the current_search code, which strings are actually translatable.

I guess the same could be done with facetapi as well, though this might be more complicated, as it could be hard to figure out the available strings.

See http://drupalcode.org/project/i18n.git/blob/refs/heads/7.x-1.x:/i18n_tax... as example.
On top of that, there could be even a nice translation UI for these blocks, lots of possibilities.

pianomansam’s picture

Status: Active » Closed (works as designed)

The approach that the patch aschiwi mentioned in #7 is already being used by this module. What dawehner mentions in #8 is unnecessary. All I had to do to get this working was visit the settings page for the facets, save the configuration, and visit/save the configuration for my content type facet. This kicks off the submit handlers that get the appropriate configurations for this module in place.

cpliakas’s picture

Status: Closed (works as designed) » Active

Marking as active again, because although there is a workaround it prevents an ideal configuration management workflow. Generally people don;t want their production site to rely on overridden configuration files as it prevents promoting changes via code and also breaks the translations if the configurations are reverted for any reason.

jhedstrom’s picture

Version: 7.x-1.0-beta1 » 7.x-1.0-beta2

I may be missing something, but saving exported facets through the UI and then refreshing i18n strings is still resulting in the "Cannot refresh strings for Facet API" message, and none of the facet values appear in the translation interface.

Edit: These are all allowed-value field facets, not node type or taxonomy facets.

damien_dd’s picture

search api 7.x-1.7
Facet API Translation 7.x-1.0-beta2

I still got 'Cannot refresh strings for Facet API.' any news or related issue ?

joel_osc’s picture

Issue summary: View changes
StatusFileSize
new572 bytes

I have run across this too where the strings cannot be translated - the following patch will add them to the Current Search Block text group and seems to fix the issue.

kopeboy’s picture

Priority: Normal » Major

Will this be included in a release anytime soon?

Cannot translate the default option text of a Facet. This is Major for this module IMHO.

heyyo’s picture

#13 is working for me for current search block.
But I still didn't figure it out how to translate my facet block title, coming from a feature.

merilainen’s picture

have you tried the i18n_block module? It will expose the block title as translatable string.

donquixote’s picture

@aschiwi (#7):

we fixed this with a patch to i18n, please see http://drupal.org/node/1787124

The patch there does something for taxonomy_vocabulary in i18n_taxonomy_entity_info_alter(). I don't see how this could be related.

@joel_osc (#13):
I still see the "Cannot refresh strings for Facet API." / "[..] Current Search Blocks." / "[..] Blocks.".
But it seems the strings are now found, e.g. "Search found [facetapi_results:result-count] items".

So in practice this is a win.
In theory it is still weird.

goz’s picture

I still see the "Cannot refresh strings for Facet API." / "[..] Current Search Blocks." / "[..] Blocks.".

This is fixed with #2466099: Enable "Refresh strings" for Facetapi

I have to refresh manually strings or launch the refresh in hook_update.

/**
 * Refresh current_search block strings.
 */
function hook_update_N() {
  $groups = array('current_search' => 'current_search');
  module_load_include('inc', 'i18n_string', 'i18n_string.admin');
  $batch = i18n_string_refresh_batch($groups, 1);
  batch_set($batch);

  return 'Current_search block strings have been refreshed.';
}

If you have custom items, don't forget to define them so they can be translated :

/**
 * Implements hook_facetapi_i18n_translatable_settings().
 */
function hook_facetapi_i18n_translatable_settings() {
  return array(
    'current_search' => array(
      'reset_filters' => array(
        'text',
        'text_plural',
      ),
    ),
  );
}
braindrift’s picture

StatusFileSize
new905 bytes

I think the translations shold not be removed when the configuration is reverted.

braindrift’s picture

Status: Active » Needs review