I have site wich has multiple languages and I need AddToAny custom link text to be translated. Any ways to do this?
Thanks.

CommentFileSizeAuthor
#5 addtoany-1591820-5.patch438 bytessk33lz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dshields’s picture

...?
Anyone else need this module in a multilingual set-up?

gejo’s picture

Version: 7.x-3.1 » 7.x-4.6
Issue summary: View changes

I've tried to translate it following this instructions:
https://www.addtoany.com/buttons/customize/drupal/translation_localization
... with no luck.

baso’s picture

I encountered the same problem. I solved it by adding variable support to the Link text field as follows:

1. To addtoany module directory add file 'addtoany.variable.inc' with following contents:

<?php
/**
 * @file
 * Variable module integration for the AddToAny module.
 */

/**
 * Implements hook_variable_info().
 */
function addtoany_variable_info($options = array()) {
  $variables['addtoany_link_text'] = array(
    'type' => 'string',
    'title' => t('AddToAny link text', array(), $options),
    'description' => t('Text of the AddToAny link.', array(), $options),
    'default' => 'Share',
    'localize' => TRUE,
  );
  return $variables;
}

2. Make this file known to the module by putting the following line in file 'addtoany.info':

files[] = addtoany.variable.inc

3. Clear cache.
4. Go to 'Home » Administration » Configuration » Regional and language » Multilingual settings » Variables' and in section 'Other' check option 'AddToAny link text'.
5. Go to 'Home » Administration » Configuration » System » AddToAny', and for each language that you want to have a translation for select this language in top section of screen and enter the desired translation value in field 'Link text' of section 'Universal Button'.

csc4’s picture

Thanks for #3 - works brilliantly. I'm still having problems though with persuading 'Share / Save' on the button to translate for those on a multi lingual whose browser locales aren't set to the language - I'd like to be able to set the language when they choose to see the page in a different language.

https://www.addtoany.com/buttons/customize/translation_localization suggests

You can force a certain pre-translated locale by specifying a supported language code (such as fr or fr-CA).

var a2a_config = a2a_config || {};
a2a_config.locale = "fr-CA";

can we use that or is it just not possible?

sk33lz’s picture

FileSize
438 bytes

I've rolled a patch against 7.x-4.x-dev for #3 as it works well for i18n translations.

micropat’s picture

Title: How to translate custom link text? » Translate AddToAny button link text
Category: Support request » Feature request
Status: Active » Patch (to be ported)

Committed to dev and tested with the i18n and variable modules.

  • micropat committed ff0018e on 7.x-4.x
    Add variable module support for translating universal button link text,...

    via sk33lz

  • micropat committed ff0018e on 8.x-1.x
    Add variable module support for translating universal button link text,...
micropat’s picture

Status: Patch (to be ported) » Closed (fixed)

Fixed in 7.x-4.9.