Changeset 8448


Ignore:
Timestamp:
Jan 2, 2011, 11:39:49 PM (10 years ago)
Author:
rub
Message:

Replace language by locale

Location:
extensions/FacebookPlug/Plugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/FacebookPlug/Plugin/include/header.inc.php

    r8440 r8448  
    2424}
    2525
    26 function fbp_get_fb_language()
     26function fbp_get_fb_locale()
    2727{
    2828  global $user;
    2929
    3030  // Array compute by plugins/FacebookPlug/tools/check_language.php script
    31   $valid_fb_languages = array ( 0 => 'ca_ES', 1 => 'cs_CZ', 2 => 'da_DK', 3 => 'de_DE', 4 => 'es_ES', 5 => 'fa_IR', 6 => 'fr_CA', 7 => 'fr_FR', 8 => 'he_IL', 9 => 'hr_HR', 10 => 'hu_HU', 11 => 'it_IT', 12 => 'ja_JP', 13 => 'ka_GE', 14 => 'lv_LV', 15 => 'mk_MK', 16 => 'nl_NL', 17 => 'pl_PL', 18 => 'pt_BR', 19 => 'pt_PT', 20 => 'ro_RO', 21 => 'ru_RU', 22 => 'sk_SK', 23 => 'sr_RS', 24 => 'sv_SE', 25 => 'tr_TR', 26 => 'vi_VN', 27 => 'zh_CN', );
     31  $valid_fb_locales = array ( 0 => 'ca_ES', 1 => 'cs_CZ', 2 => 'da_DK', 3 => 'de_DE', 4 => 'es_ES', 5 => 'fa_IR', 6 => 'fr_CA', 7 => 'fr_FR', 8 => 'he_IL', 9 => 'hr_HR', 10 => 'hu_HU', 11 => 'it_IT', 12 => 'ja_JP', 13 => 'ka_GE', 14 => 'lv_LV', 15 => 'mk_MK', 16 => 'nl_NL', 17 => 'pl_PL', 18 => 'pt_BR', 19 => 'pt_PT', 20 => 'ro_RO', 21 => 'ru_RU', 22 => 'sk_SK', 23 => 'sr_RS', 24 => 'sv_SE', 25 => 'tr_TR', 26 => 'vi_VN', 27 => 'zh_CN', );
    3232
    3333  // User language
    3434  $language = $user['language'];
    35   if (! in_array($language, $valid_fb_languages))
     35  if (! in_array($language, $valid_fb_locales))
    3636  {
    3737    $code_lang = substr($language, 0, 2);
    3838    // Compose a language
    3939    $language = $code_lang.'_'.strtoupper($code_lang);
    40     if (! in_array($language, $valid_fb_languages))
     40    if (! in_array($language, $valid_fb_locales))
    4141    {
    4242      // Search a language
    43       foreach ($valid_fb_languages as $valid_fb_language)
     43      foreach ($valid_fb_locales as $valid_fb_locale)
    4444      {
    45         if ($code_lang == substr($valid_fb_language, 0, 2))
     45        if ($code_lang == substr($valid_fb_locale, 0, 2))
    4646        {
    47           return $valid_fb_language;
     47          return $valid_fb_locale;
    4848        }
    4949      }
     
    8484    $template->assign('FACEBOOK_APP_ID', (is_numeric($conf['fbp']['facebook_app_id']) ? $conf['fbp']['facebook_app_id'] : FACEBOOK_APP_ID));
    8585    // define language
    86     $template->assign('FACEBOOK_LANGUAGE', fbp_get_fb_language());
     86    $template->assign('FACEBOOK_LOCALE', fbp_get_fb_locale());
    8787    $template->assign('FBP_PATH', FBP_PATH);
    8888    $template->assign('FBP_SCRIPT_BASENAME', script_basename());
  • extensions/FacebookPlug/Plugin/tpl/init.fb.tpl

    r8440 r8448  
    3838  (function() {ldelim}
    3939    var e = document.createElement(script);
    40     e.src = document.location.protocol + //connect.facebook.net/{$FACEBOOK_LANGUAGE}/all.js#appId={$FACEBOOK_APP_ID}&xfbml=1;
     40    e.src = document.location.protocol + //connect.facebook.net/{$FACEBOOK_LOCALE}/all.js#appId={$FACEBOOK_APP_ID}&xfbml=1;
    4141    e.async = true;
    4242    document.getElementById(fb-root).appendChild(e);
     
    4545{else}
    4646<div id="fb-root"></div>
    47 <script src="http://connect.facebook.net/{$FACEBOOK_LANGUAGE}/all.js#appId={$FACEBOOK_APP_ID}&amp;xfbml=1"></script>
     47<script src="http://connect.facebook.net/{$FACEBOOK_LOCALE}/all.js#appId={$FACEBOOK_APP_ID}&amp;xfbml=1"></script>
    4848<script>
    4949  FB.init({ldelim}
Note: See TracChangeset for help on using the changeset viewer.