Hi all

Thanks for the module it is great and i use it :-)

Is it possible to assume that when i change my WebSite language the fblikebutton also changes?

Best regards
ArchGalileu

www.gasparsantos.eu
www.quartetodouro.eu
www.cameratanovnorte.eu

Comments

jerdiggity’s picture

Component: Code » Miscellaneous
Assigned: Unassigned » jerdiggity

Thanks!

Anyway, the answer to your question is, "No... It won't change automatically." The default language that the button will be displayed in is U.S. English (aka en_US), but this is completely customizable through the admin interface by navigating to www.example.com/admin/config/fblikebutton/general and, toward the bottom, setting the Language accordingly. (Incidentally I looked at one of the links you provided, and from what I can tell the language code that you would probably want to use would be pt_PT as opposed to the default en_US.)

I should also note that the language code set under General settings is completely separate from the language code used for the site-wide block. Both default to English, however they can be set to two entirely different settings if you prefer.

Hope that helps... :)

j

jerdiggity’s picture

Status: Active » Fixed
tommychris’s picture

Status: Fixed » Active

Is there any chance to create a behavior, to the button appear used the current user's language, not the site-wide global language or the language setted the admin page?

Anonymous’s picture

Hi jerdiggity

Yes i made the changes of language.

but with multi-language i can't set for each, on ech page, well i think...

is there a way or could be one?

Best regards
ArchGalileu

tommychris’s picture

I'm created a solution, where the code detects the current language, and tries to use it. If FB like button not available for the current language, it uses English.

THe code works for only the like button, not the block. for the like button, it omits the admin settings.

The best solution maybe the next:
The admin site uses a drop down list for all avilable languages. And a checkbox. If the checkbox ticked, all FB script uses the language setted in drop down. If the checkbox is unticked, the script tries to use the current language, if available. If not, uses the selected value - as a default value.

One problem, which I don't know how Drupal handle it: Some language used more than one territory (like 'en', and 'en_GB', 'en_US', etc...). I use Drupal with english and hungarian language, and not installed more.

I don't know how to make a .patch, so the modified lines are below (all in fblikebutton.module):

-  $language = $conf['language'];
+  $language = _fblikebutton_get_language_code();

Add the code below to the end of the file


function _fblikebutton_get_language_code()
{
  $language_codes = _fblikebutton_get_language_codes(); // Get available languages
  global $language; // Get global language
  $current_language = $language->language;  // Current language
  
  $languages = array();
  // Get available language codes
  if (array_key_exists($current_language, $language_codes))
    $languages = $language_codes[$current_language];
  else
    $languages = $language_codes['en'];
    
  // Get the first elements key, for the available language codes.
  reset($languages);
  return key($languages);  
}

function _fblikebutton_get_language_codes()
{
  // Get from: http://drupal.org/files/issues/fbconnect-i18n.6-1--1-0-BETA9.patch
  return array(
    'af' => array('af_ZA' => 'Afrikaans'),
    'ar' => array('ar_AR' => 'Arabic'),
    'ay' => array('ay_BO' => 'Aymara'),
    'az' => array('az_AZ' => 'Azeri'),
    'be' => array('be_BY' => 'Belarusian'),
    'bg' => array('bg_BG' => 'Bulgarian'),
    'bn' => array('bn_IN' => 'Bengali'),
    'bs' => array('bs_BA' => 'Bosnian'),
    'ca' => array('ca_ES' => 'Catalan'),
    'ck' => array('ck_US' => 'Cherokee'),
    'cs' => array('cs_CZ' => 'Czech'),
    'cy' => array('cy_GB' => 'Welsh'),
    'da' => array('da_DK' => 'Danish'),
    'de' => array('de_DE' => 'German'),
    'el' => array('el_GR' => 'Greek'),
    'en' => array('en_GB' => 'English (UK)', 'en_PI' => 'English (Pirate)', 'en_UD' => 'English (Upside Down)', 'en_US' => 'English (US)'),
    'eo' => array('eo_EO' => 'Esperanto'),
    'es' => array('es_LA' => 'Spanish', 'es_CL' => 'Spanish (Chile)', 'es_CO' => 'Spanish (Colombia)', 'es_MX' => 'Spanish (Mexico)', 'es_VE' => 'Spanish (Venezuela)'),
    'et' => array('et_EE' => 'Estonian'),
    'eu' => array('eu_ES' => 'Basque'),
    'fa' => array('fa_IR' => 'Persian'),
    'fb' => array('fb_FI' => 'Finnish (test)', 'fb_LT' => 'Leet Speak'),
    'fi' => array('fi_FI' => 'Finnish'),
    'fo' => array('fo_FO' => 'Faroese'),
    'fr' => array('fr_FR' => 'French (France)', 'fr_CA' => 'French (Canada)'),
    'ga' => array('ga_IE' => 'Irish'),
    'gl' => array('gl_ES' => 'Galician'),
    'gn' => array('gn_PY' => 'Guaraní'),
    'gu' => array('gu_IN' => 'Gujarati'),
    'he' => array('he_IL' => 'Hebrew'),
    'hi' => array('hi_IN' => 'Hindi'),
    'hr' => array('hr_HR' => 'Croatian'),
    'hu' => array('hu_HU' => 'Hungarian'),
    'hy' => array('hy_AM' => 'Armenian'),
    'id' => array('id_ID' => 'Indonesian'),
    'is' => array('is_IS' => 'Icelandic'),
    'it' => array('it_IT' => 'Italian'),
    'ja' => array('ja_JP' => 'Japanese'),
    'jv' => array('jv_ID' => 'Javanese'),
    'ka' => array('ka_GE' => 'Georgian'),
    'kk' => array('kk_KZ' => 'Kazakh'),
    'km' => array('km_KH' => 'Khmer'),
    'kn' => array('kn_IN' => 'Kannada'),
    'ko' => array('ko_KR' => 'Korean'),
    'ku' => array('ku_TR' => 'Kurdish'),
    'la' => array('la_VA' => 'Latin'),
    'li' => array('li_NL' => 'Limburgish'),
    'lt' => array('lt_LT' => 'Lithuanian'),
    'lv' => array('lv_LV' => 'Latvian'),
    'mg' => array('mg_MG' => 'Malagasy'),
    'mk' => array('mk_MK' => 'Macedonian'),
    'ml' => array('ml_IN' => 'Malayalam'),
    'mn' => array('mn_MN' => 'Mongolian'),
    'mr' => array('mr_IN' => 'Marathi'),
    'ms' => array('ms_MY' => 'Malay'),
    'mt' => array('mt_MT' => 'Maltese'),
    'nb' => array('nb_NO' => 'Norwegian (bokmal)'),
    'ne' => array('ne_NP' => 'Nepali'),
    'nl' => array('nl_NL' => 'Dutch', 'nl_BE' => 'Dutch (België)'),
    'nn' => array('nn_NO' => 'Norwegian (nynorsk)'),
    'pa' => array('pa_IN' => 'Punjabi'),
    'pl' => array('pl_PL' => 'Polish'),
    'ps' => array('ps_AF' => 'Pashto'),
    'pt' => array('pt_BR' => 'Portuguese (Brazil)'),
    'pt' => array('pt_PT' => 'Portuguese (Portugal)'),
    'qu' => array('qu_PE' => 'Quechua'),
    'rm' => array('rm_CH' => 'Romansh'),
    'ro' => array('ro_RO' => 'Romanian'),
    'ru' => array('ru_RU' => 'Russian'),
    'sa' => array('sa_IN' => 'Sanskrit'),
    'se' => array('se_NO' => 'Northern Sámi'),
    'sk' => array('sk_SK' => 'Slovak'),
    'sl' => array('sl_SI' => 'Slovenian'),
    'so' => array('so_SO' => 'Somali'),
    'sq' => array('sq_AL' => 'Albanian'),
    'sr' => array('sr_RS' => 'Serbian'),
    'sv' => array('sv_SE' => 'Swedish'),
    'sw' => array('sw_KE' => 'Swahili'),
    'sy' => array('sy_SY' => 'Syriac'),
    'ta' => array('ta_IN' => 'Tamil'),
    'te' => array('te_IN' => 'Telugu'),
    'tg' => array('tg_TJ' => 'Tajik'),
    'th' => array('th_TH' => 'Thai'),
    'tl' => array('tl_PH' => 'Filipino', 'tl_ST' => 'Klingon'),
    'tr' => array('tr_TR' => 'Turkish'),
    'tt' => array('tt_RU' => 'Tatar'),
    'uk' => array('uk_UA' => 'Ukrainian'),
    'ur' => array('ur_PK' => 'Urdu'),
    'uz' => array('uz_UZ' => 'Uzbek'),
    'vi' => array('vi_VN' => 'Vietnamese'),
    'xh' => array('xh_ZA' => 'Xhosa'),
    'yi' => array('yi_DE' => 'Yiddish'),
    'zh' => array('zh_CN' => 'Simplified Chinese (China)', 'zh_HK' => 'Traditional Chinese (Hong Kong)', 'zh_TW' => 'Traditional Chinese (Taiwan)'),
    'zu' => array('zu_ZA' => 'Zulu')
    );
}
bmunslow’s picture

StatusFileSize
new379 bytes

Hi,

I think a more elegant solution would be to use the Variable module.

If you are using i18n, simply unzip this file and upload it into the module's folder and now you can set a different language setting for each setting.

When you enter the admin settings of the module you will see a message with the right links to translate the field.

lliss’s picture

Assigned: jerdiggity » lliss

In response to #6, I'm not thrilled about adding a dependency for this. Plus we know all of Drupal's language options and we know all of Facebook's language options so we just need to make a mapping of one to the other and provide a few options to use it.

I'll like what's going on in #2 generally but I want to provide the option to use a different language than is defined on the site overall. I'll work on a combination of ideas and see what I can do with it.

selinav’s picture

Issue summary: View changes

2 years after, what is the best solution (drupal 7) to translate it ?

selinav’s picture

>> #7 Iliss, I have tried your solution but it doesn't works I can't "translate" it for the different language, I've not the "multilingual variable" message.

I've flush the cache. What should I do ?

selinav’s picture

Sorry I've found, It should also enable multilanguage variable on Administration> Settings> Regional and language> Multilingual settings page (variable tabs).

pankajsachdeva’s picture

Issue summary: View changes
lasseitorp’s picture

#6 worked like a charm! Just what I needed, Thanks!

iamfredrik’s picture

StatusFileSize
new5.79 KB

Made a patch based on code in #5.

leducdubleuet’s picture

Status: Active » Reviewed & tested by the community

The patch in #13 works like a charm and applies cleanly to current version 2.6.

Thank you very much, this is must for the next release in my opinion!

astonvictor’s picture

Status: Reviewed & tested by the community » Closed (outdated)

D7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.