'Afrikaans', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'hy' => 'Armenian', 'az' => 'Azerbaijani', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 'bs' => 'Bosnian', 'bg' => 'Bulgarian', 'ca' => 'Catalan', 'ceb' => 'Cebuano', 'ny' => 'Chichewa', 'zh-CN' => 'Chinese Simplified', 'zh-TW' => 'Chinese Traditional', 'co' => 'Corsican', 'hr' => 'Croatian', 'cs' => 'Czech', 'da' => 'Danish', 'nl' => 'Dutch', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'tl' => 'Filipino', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Frisian', 'gl' => 'Galician', 'ka' => 'Georgian', 'de' => 'German', 'el' => 'Greek', 'gu' => 'Gujarati', 'ht' => 'Haitian Creole', 'ha' => 'Hausa', 'haw' => 'Hawaiian', 'iw' => 'Hebrew', 'hi' => 'Hindi', 'hmn' => 'Hmong', 'hu' => 'Hungarian', 'is' => 'Icelandic', 'ig' => 'Igbo', 'id' => 'Indonesian', 'ga' => 'Irish', 'it' => 'Italian', 'ja' => 'Japanese', 'jw' => 'Javanese', 'kn' => 'Kannada', 'kk' => 'Kazakh', 'km' => 'Khmer', 'ko' => 'Korean', 'ku' => 'Kurdish', 'ky' => 'Kyrgyz', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish', 'mk' => 'Macedonian', 'mg' => 'Malagasy', 'ms' => 'Malay', 'ml' => 'Malayalam', 'mt' => 'Maltese', 'mi' => 'Maori', 'mr' => 'Marathi', 'mn' => 'Mongolian', 'my' => 'Myanmar', 'ne' => 'Nepali', 'no' => 'Norwegian', 'ps' => 'Pashto', 'fa' => 'Persian', 'pl' => 'Polish', 'pt' => 'Portuguese', 'pa' => 'Punjabi', 'ro' => 'Romanian', 'ru' => 'Russian', 'sm' => 'Samoan', 'gd' => 'Scots Gaelic', 'sr' => 'Serbian', 'st' => 'Sesotho', 'sn' => 'Shona', 'sd' => 'Sindhi', 'si' => 'Sinhala', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'so' => 'Somali', 'es' => 'Spanish', 'su' => 'Sundanese', 'sw' => 'Swahili', 'sv' => 'Swedish', 'tg' => 'Tajik', 'ta' => 'Tamil', 'te' => 'Telugu', 'th' => 'Thai', 'tr' => 'Turkish', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 'vi' => 'Vietnamese', 'cy' => 'Welsh', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'zu' => 'Zulu', ); // Constructor. function AckunaWidget() { // Add the full paths. $this->button_path = plugins_url('ackuna-language-translation-plugin'); $this->javascript_path = $this->button_path . $this->javascript_path; // Add functions to the content and excerpt. add_filter('the_content', array(&$this, 'codeToContent')); add_filter('get_the_excerpt', array(&$this, 'ackunaExcerptTrim')); add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'pluginSettingsLink')); // Initialize the plugin. add_action('admin_menu', array(&$this, '_init')); // Display the admin notification add_action('admin_notices', array($this, 'plugin_activation')); // Get the plugin options. $this->ackuna_src = get_option('ackuna_src', 'en'); $this->ackuna_id = get_option('ackuna_id', null); $this->ackuna_skip_jq = get_option('ackuna_skip_jq', false); $this->ackuna_first_save = get_option('ackuna_first_save', 0); $this->ackuna_trial_key = get_option('ackuna_trial_key', null); $this->ackuna_trial_expires = get_option('ackuna_trial_expires', null); $this->ackuna_show_branding = get_option('ackuna_show_branding', null); // Determine which "ackuna_id" value to use (free trial/registered). $ackuna_id_value = !empty($this->ackuna_id) ? (string)$this->ackuna_id : (string)$this->ackuna_trial_key; // Parameterize variables for script URL. $script_name = sprintf( '/e.js?src=%s&conveythis_id=%s&skip_jq=%d', (string)$this->ackuna_src, $ackuna_id_value, (int)$this->ackuna_skip_jq ); // Register our scripts. wp_register_script('ackuna_ackuna', $this->javascript_path . $script_name, 'jquery', '4.3.0', true); wp_register_script('ackuna_admin_trial_ajax', plugins_url('ackuna-language-translation-plugin') . '/admin-trial-ajax.js', 'jquery', '1.0.0', true); } function _init() { // Add the options page. add_options_page('Translate Settings', 'Translate', 'manage_options', 'ackuna', array(&$this, 'pluginOptions')); add_submenu_page(null, 'Reset Translate Settings', 'Reset Translate', 'manage_options', 'ackuna_reset', array(&$this, 'pluginReset')); // Register our plugin settings. register_setting('ackuna_options', 'ackuna_src', array(&$this, 'validateLanguage')); register_setting('ackuna_options', 'ackuna_id'); register_setting('ackuna_options', 'ackuna_skip_jq'); register_setting('ackuna_options', 'ackuna_first_save'); register_setting('ackuna_options', 'ackuna_trial_key'); register_setting('ackuna_options', 'ackuna_trial_expires'); register_setting('ackuna_options', 'ackuna_show_branding'); } function plugin_activation() { if (current_user_can('manage_options') && !$this->ackuna_first_save) { echo <<

Warning! Your Translate button is not set up yet!

Be sure to select your site's language and other options under Translate Settings!

EOL; } } // Print the dropdown, popup code in the footer. function ackunaFooter() { echo $this->getAckunaDropdown(); echo $this->getAckunaPopup(); } // Called whenever content is shown. function codeToContent($content) { // What we add depends on type. if (is_feed()) { // Add nothing to RSS feed. return $content; } else if (is_category()) { // Add nothing to categories. return $content; } else if (is_singular()) { // For singular pages we add the button to the content normally. wp_enqueue_script('jquery'); wp_enqueue_script('ackuna_ackuna'); add_action('wp_footer', array(&$this, 'ackunaFooter')); return $this->getAckunaCode() . $content; } else { // For everything else add nothing. return $content; } } // Get the actual button code. function getAckunaCode() { $ackuna_code = <<var ackuna_plugin_path = "{$this->button_path}"; EOL; return $ackuna_code; } // Get Ackuna dropdown. function getAckunaDropdown() { if ($this->ackuna_show_branding || is_null($this->ackuna_show_branding)) { $ackuna_dropdown_footer = << Get this free button at Ackuna
Powered by Translation Services USA EOL; } else { $ackuna_dropdown_footer = ''; } $ackuna_dropdown = <<
Select a target language
    $ackuna_dropdown_footer EOL; return $ackuna_dropdown; } // Get Ackuna popup. function getAckunaPopup() { if ($this->ackuna_show_branding || is_null($this->ackuna_show_branding)) { $ackuna_popup_header_branding = '

    Powered by Ackuna

    '; $ackuna_popup_body_class = ''; $ackuna_popup_footer = <<

    Get Your Own Free Translator

    Powered by Translation Services USA

    EOL; } else { $ackuna_popup_header_branding = ''; $ackuna_popup_footer = ''; $ackuna_popup_body_class = 'ackuna-unbranded'; } $ackuna_popup = <<

    Translate

    $ackuna_popup_header_branding

    Select a taget language:

    $ackuna_popup_footer
    EOL; return $ackuna_popup; } // Reset plugin options. function pluginReset() { if (!current_user_can('manage_options')) { wp_die('You do not have sufficient permissions to access this page.'); } ?>

    Reset Translate Options

    Click the "Reset Settings" button below to reset the plugin's options to their default settings:

    Option Default Setting
    jQuery version checking enabled
    Source language English
    Registered ConveyThis account none
    Free trial settings unset
    Cancel

    Translate Settings

    Update the language and other settings for the Translate plugin.

    ackuna_id)) { ?>

    Set this to whatever language your blog is written in. If your blog is in English, and you want visitors to be able to view it in Spanish, Russian, and Japanese, select "English."

    Use this only if you are having trouble getting the Translate button to work. This will force-skip jQuery detection by the plugin.

    Translate by Ackuna is not only free to use, it actually costs us money to support! Please help us out by allowing a small backlink to ackuna.com in the button's dropdown/pop-up footer so everyone knows where to get our plugin.

    ackuna_id) ? 'width="50%"' : 'colspan="2"'; ?> style="padding:10px;font-family:Verdana, Geneva, sans-serif;color:#666;border-bottom:1px dotted #ddd;">

    If you have a registered ConveyThis account, enter your username here to activate your account benefits for your WordPress blog (note: be sure to add your blog URL, "" to the approved domains list in your account settings).

    Registered users with a Google Translate API Key can translate their blog text directly on-page without redirecting through a separate frame. Read more at the ConveyThis help page.

    ackuna_trial_key)) { ?>

    Want to get a feel for how your blog will be translated with a registered ConveyThis account and Google Translate API Key? Just press the checkbox here to start your free trial!

    Your free trial information is below. Convinced? Register on ConveyThis.com!

    Note: if you are using any caching plugins, such as WP Super Cache, you will need to clear your cached pages after updating your Translate settings.
    Reset to Default Options

    Translate is a project by Ackuna. Get a free app, software, and website translation at Ackuna now!

    Settings'; array_unshift($links, $settings_link); return $links; } // Remove (what's left of) our button code from excerpts. function ackunaExcerptTrim($text) { /* $pattern = '/Translatevar ackuna_src = "(.*?)";/i'; $replacement = ''; return preg_replace($pattern, $replacement, $text); */ return $text; } // Sanitize plugin settings options. function validateLanguage($language = null) { $return = $this->ackuna_src; if (array_key_exists($language, $this->ackuna_languages)) { $return = $language; } return $return; } } $ackuna &= new AckunaWidget();