Follow up from #1670140: Translate replacement_value in sort options and in filter options which implemented i18n support for the exposed sort rewrite field. This model should be followed to allow translation of any BEF settings where text can be entered.

If this turns out to be a lot of work, this can become the meta issue. I'm hoping that the scope of this is small enough to make for one reasonably sized patch.

Marking #1852306: Text of the "Secondary options label" cannot be translated as related.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

heddn’s picture

Status: Active » Needs review
FileSize
2.58 KB

This does the trick. Turns out its a fairly small patch. To get translations to work, one simply has to mark the 'bef' option as translatable and provide an unpack_translatable callback that exports all the translatable values.

Status: Needs review » Needs work

The last submitted patch, 1: bef-allow_translations_for-2185077-1.patch, failed testing.

heddn’s picture

Status: Needs work » Needs review
FileSize
4.47 KB

Patch from #1 stores the data, but it doesn't retrieve it correctly. This hopefully fixes that. I'm also hoping that the test failures in #1 were from a bad testbot. There's no good reason for it to fail.

mikeker’s picture

Thanks for the patch! I will look at it as soon as I can when I'm back from vacation.

FYI: The testbot seems to fail randomly on this project and I've never had the time to investigate... As long as it's not a patch-failed-to-apply error, assume it's the testbot acting up.

heddn’s picture

Closing #2141547: Advanced Sort Options in BEF are untranslatable as duplicate. And seeing if we can get a good testbot run. This is a duplicate of #3.

  • mikeker committed 7edc13a on 7.x-3.x authored by heddn
    Issue #2185077 by heddn: Allow translations for all BEF settings
    
mikeker’s picture

@heddn: Thank you for the patch and my apologies for the delay in getting to it.

The code looks good and it passes the testbot (not sure why the d.o testbot isn't triggering tests on this project anymore, but it runs fine on simplytest.me). Anyhow, I have very little experience with translation, so I would appreciate any feedback from others if this does not give them the needed access to BEF settings for translation. Unless it's a "this doesn't work at all" complaint, please submit them in new issues.

mikeker’s picture

Status: Needs review » Fixed

Ooops...

heddn’s picture

To make this work, each of the filters is treated as a multi-line string.

#: Views BEF filter
#, fuzzy
msgid ""
"Release Date Asc|Oldest to Newest\n"
"Release Date Desc|Newest to Oldest"
msgstr ""
"Release Date Asc|Antiguo primero\n"
"Release Date Desc|Nuevo primero"

Can we get a new point release of BEF rolled out? This is a fairly significant feature that I feel warrants a release.

boyan.borisov’s picture

Hi,

I faced an issue using this patch with the latest dev version of 18nviews. I got the following notice:
Notice: Array to string conversion in i18nviews_plugin_localization_i18nstrings->stringid() (line 67 of /home/boyanb/projects/kkdk/www/sites/all/modules/contrib/i18nviews/includes/i18nviews_plugin_localization_i18nstrings.inc).

This is the function.

  /**
   * Get string id for i18n
   *
   * @param $keys
   *   Array of keys for the string to be translated.
   */
  function stringid($keys) {
    return 'views:' . implode(':', $keys);
  }

it seems that it expects flat array but the patch use multidimensional array. Not sure where is the problem exactly... but keys sound like something flat :)

mikeker’s picture

@boyan.borisov: Please open that is a new issue. Thanks!

@heddn: Will do as soon as I can. I need to clean up a few other issues in the BEF queue. Thanks again, for you for on this issue!

  • mikeker committed 093abc4 on 7.x-3.x
    Manual revert of issue #1670140. Using the approach in #2185077 instead.
    
mikeker’s picture

Note: started a handbook page on translations for BEF.

heddn’s picture

Looking good.

Status: Fixed » Closed (fixed)

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

Triumphent’s picture

Status: Closed (fixed) » Active

Sorry to reopen this but is there a chance that a patch that would allow the translation of the "Advanced options" string will ever come out? It does appear in the translate interface under "views" and "Built in interface" but when translated there, the translation does not show on the page. None of the existing patches fixed that issue. Thanks.

heddn’s picture

Status: Active » Closed (fixed)

Re #16: open a new issue and link it to here. But it is best to leave closed issues, as closed. Otherwise it messes with credits and makes the conversation for the issue confusing.