From 558e76b6af13010e314f876293f01ef1c32e5dd1 Mon Sep 17 00:00:00 2001 From: Jeremy Trojan Date: Mon, 13 Jun 2011 02:50:56 -0700 Subject: Added language support. --- fblikebutton.admin.inc | 13 +++++++++++++ fblikebutton.install | 2 ++ fblikebutton.module | 12 +++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/fblikebutton.admin.inc b/fblikebutton.admin.inc index 104a93f..fd1a259 100644 --- a/fblikebutton.admin.inc +++ b/fblikebutton.admin.inc @@ -93,10 +93,17 @@ function fblikebutton_admin_settings() { $form['fblikebutton_weight'] = array( '#type' => 'select', '#title' => t('Weight'), + // Note to self: THIS has GOT to change... '#options' => array('-50' => '-50', '-49' => '-49', '-48' => '-48', '-47' => '-47', '-46' => '-46', '-45' => '-45', '-44' => '-44', '-43' => '-43', '-42' => '-42', '-41' => '-41', '-40' => '-40', '-39' => '-39', '-38' => '-38', '-37' => '-37', '-36' => '-36', '-35' => '-35', '-34' => '-34', '-33' => '-33', '-32' => '-32', '-31' => '-31', '-30' => '-30', '-29' => '-29', '-28' => '-28', '-27' => '-27', '-26' => '-26', '-25' => '-25', '-24' => '-24', '-23' => '-23', '-22' => '-22', '-21' => '-21', '-20' => '-20', '-19' => '-19', '-18' => '-18', '-17' => '-17', '-16' => '-16', '-15' => '-15', '-14' => '-14', '-13' => '-13', '-12' => '-12', '-11' => '-11', '-10' => '-10', '-9' => '-9', '-8' => '-8', '-7' => '-7', '-6' => '-6', '-5' => '-5', '-4' => '-4', '-3' => '-3', '-2' => '-2', '-1' => '-1', '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25', '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30', '31' => '31', '32' => '32', '33' => '33', '34' => '34', '35' => '35', '36' => '36', '37' => '37', '38' => '38', '39' => '39', '40' => '40', '41' => '41', '42' => '42', '43' => '43', '44' => '44', '45' => '45', '46' => '46', '47' => '47', '48' => '48', '49' => '49', '50' => '50'), '#default_value' => variable_get('fblikebutton_weight', '50'), '#description' => t('The weight determines where on a node the like button will appear. The larger the weight, the lower it will appear on the node. For example, if you want the button to appear more toward the top of the node, choose -40 as opposed to -39, -38, 0, 1, or 50, etc.'), ); + $form['fblikebutton_language'] = array( + '#type' => 'textfield', + '#title' => t('Language'), + '#default_value' => variable_get('fblikebutton_language', 'en_US'), + '#description' => t('Specific language to use. Default is English. Examples:
French (France): fr_FR
French (Canada): fr_CA'), + ); return system_settings_form($form); } @@ -173,6 +180,12 @@ function fblikebutton_block_settings() { '#default_value' => variable_get('fblikebutton_bl_iframe_css', ''), '#description' => t('Extra css attributes needed to make the iframe behave for your specific requirements. Will not necessarily overwrite existing styling. To alter the dimensions of the iframe, use the height and width fields found above.
Example: float: right; padding: 5px;'), ); + $form['fblikebutton_block']['fblikebutton_bl_language'] = array( + '#type' => 'textfield', + '#title' => t('Language'), + '#default_value' => variable_get('fblikebutton_language', 'en_US'), + '#description' => t('Specific language to use. Default is English. Examples:
French (France): fr_FR
French (Canada): fr_CA'), + ); return system_settings_form($form); } \ No newline at end of file diff --git a/fblikebutton.install b/fblikebutton.install index f11c08b..478edf9 100644 --- a/fblikebutton.install +++ b/fblikebutton.install @@ -19,6 +19,7 @@ function fblikebutton_uninstall() { variable_del('fblikebutton_iframe_height'); variable_del('fblikebutton_iframe_width'); variable_del('fblikebutton_iframe_css'); + variable_del('fblikebutton_language'); variable_del('fblikebutton_displaysend'); variable_del('fblikebutton_font'); variable_del('fblikebutton_weight'); @@ -34,4 +35,5 @@ function fblikebutton_uninstall() { variable_del('fblikebutton_bl_iframe_width'); variable_del('fblikebutton_bl_iframe_height'); variable_del('fblikebutton_bl_iframe_css'); + variable_del('fblikebutton_bl_language'); } diff --git a/fblikebutton.module b/fblikebutton.module index 09ffa44..0992cb4 100644 --- a/fblikebutton.module +++ b/fblikebutton.module @@ -68,6 +68,7 @@ function fblikebutton_node_view($node, $view_mode) { 'width' => variable_get('fblikebutton_iframe_width', '450'), 'send' => variable_get('fblikebutton_send', 'true'), 'other_css' => variable_get('fblikebutton_iframe_css', ''), + 'language' => variable_get('fblikebutton_language', 'en_US'), ); if ($show) { if ($showonteasers == 0) { @@ -200,6 +201,12 @@ function fblikebutton_block_configure($delta = '') { '#default_value' => variable_get('fblikebutton_bl_iframe_css', ''), '#description' => t('Extra css attributes needed to make the iframe behave for your specific requirements. Will not necessarily overwrite existing styling. To alter the dimensions of the iframe, use the height and width fields found above.
Example: float: right; padding: 5px;'), ); + $form['block']['fblikebutton_bl_language'] = array( + '#type' => 'textfield', + '#title' => t('Language'), + '#default_value' => variable_get('fblikebutton_language', 'en_US'), + '#description' => t('Specific language to use. Default is English. Examples:
French (France): fr_FR
French (Canada): fr_CA'), + ); } return $form; } @@ -218,6 +225,7 @@ function fblikebutton_block_save($delta = '', $edit = array()) { variable_set('fblikebutton_bl_iframe_width', $edit['fblikebutton_bl_iframe_width']); variable_set('fblikebutton_bl_iframe_height', $edit['fblikebutton_bl_iframe_height']); variable_set('fblikebutton_bl_iframe_css', $edit['fblikebutton_bl_iframe_css']); + variable_set('fblikebutton_bl_language', $edit['fblikebutton_bl_language']); } } @@ -240,6 +248,7 @@ function fblikebutton_block_view($delta = '') { 'height' => variable_get('fblikebutton_bl_iframe_height', '80'), 'width' => variable_get('fblikebutton_bl_iframe_width', '450'), 'other_css' => variable_get('fblikebutton_bl_iframe_css', ''), + 'language' => variable_get('fblikebutton_bl_language', 'en_US'), ); $block['content'] = _fblikebutton_field($addr, $conf); } @@ -257,7 +266,8 @@ function _fblikebutton_field($webpage_to_like, $conf) { $font = $conf['font']; // $send = $conf['send']; $other_css = $conf['other_css']; - $params = "href={$webpage_to_like}&layout={$layout}&show_faces={$show_faces}&width={$width}px&font={$font}&height={$height}px&action={$action}&colorscheme={$colorscheme}"; + $language = $conf['language']; + $params = "href={$webpage_to_like}&layout={$layout}&show_faces={$show_faces}&width={$width}px&font={$font}&height={$height}px&action={$action}&colorscheme={$colorscheme}&locale={$language}"; $src = htmlentities($params); $output = ''; return $output; -- cgit v1.2.3