Translator Revolution Pro (PHP script)

 

Provides documentation for the customization options.

All these settings are in the translator/_classes/config.class.php file. They can be modified there, or changed them on the fly during the initialization process, for instance:

<?php
require_once dirname(__FILE__) . '/translator/main.class.php';
TranslatorManager::initialize('
    re_select_on_translation = true
    bar.show_swap_button = true
    tab.title_label = Translate this page
');
?>

 

Settings Reference

 

  • align
    Sets the alignment.
    • possible values: left | right.
    • default value: left.
  • all_languages
    Sets all the available languages. They will be used only if the language setting is set to all, and they will be rendered in the same order as they are written.
    • possible values: languages names, comma separated. For instance: Czech, Danish, Dutch, English, Estonian, Finnish, French.
    • default values: all the languages available in the SurStudio Translate API: Arabic, Bulgarian, Catalan, Chinese Simplified, Chinese Traditional, Czech, Danish, Dutch, English, Estonian, Finnish, French, German, Greek, Haitian Creole, Hebrew, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean, Latvian, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Slovenian, Spanish, Swedish, Thai, Turkish, Ukrainian, Vietnamese.
  • api_key
    Sets the key for the SurStudio Translate API.
    • possible values: a valid api key.
    • default value: empty.
    In order to get an API Key, follow the steps:
    • Get the Item Purchase Code.
    • Go to http://codecanyon.net/user/SurStudio/
    • On the lower right side there's the following email form:
    • Send a message with the purchase info. The following sample message could be used as template (highlighted is the required info):

      Hello there,

      here I'm attaching the required info to get a key to use the translation service.

      Name: John Doe
      Email: john.doe@emaildomain.com
      Product: Ajax Translator Revolution Wordpress Plugin
      Item Purchase Code: f4b3ae24-d23f-42a3-80a6-41c37ced6961
      Website's base URL(s): mydomain.com, sales.mydomain.com, mysubdomain.mydomain.com
      Website's source language(s): English, Spanish


    • An email will be sent back shortly, with the API Key.
  • bar.from_default
    Sets the "from" default language.
    • possible values: a language name.
    • default value: English.
  • bar.from_label
    Sets the "from" label.
    • possible values: text and any valid HTML code.
    • default value: From:.
  • bar.show
    Sets whether the translator's bar should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • bar.show_flags
    Sets whether the languages flags in the bar should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • bar.show_from
    Sets whether the "from" option in the bar should be displayed or not. If it's set to false, then the source language will be the one set on the bar.from_default setting.
    And if the webpage's language will always be the same, then it's recommended to set that language on the bar.from_default setting.
    • possible values: true | false.
    • default value: true.
  • bar.show_icon
    Sets whether the bar icon should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • bar.show_names
    Sets whether the languages names in the bar should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • bar.show_swap_button
    Sets whether the swap button in the bar should be displayed or not.
    Usually, is set to true when re_select_on_translation is also set to true.
    • possible values: true | false.
    • default value: false.
  • bar.show_translate_button
    Sets whether the translate button should be displayed or not. If it's set to false, then the translation will take place right after a language in the translator's tab has been selected.
    • possible values: true | false.
    • default value: true.
  • bar.swap_button_label
    Sets the swap button label.
    • possible values: text and any valid HTML code.
    • default value: &harr;. &harr; is the HTML special character code for the left-right arrow (↔).
  • bar.template
    Sets the bar template. It contains: the "from" and "to" labels and buttons, and the swap languages button too. New templates can be created if the provided one doesn't fit the web page requirements. Requires good HTML and CSS knowledge.
    • possible values: a file name located in the translator/_templates folder.
    • default value: bar_default.tpl.
  • bar.template_item
    Sets the bar item template. It contains: the language name and flag image spot. New templates can be created if the provided one doesn't fit the web page requirements. Requires good HTML and CSS knowledge.
    • possible values: a file name located in the translator/_templates folder.
    • default value: bar_item_default.tpl.
  • bar.to_default
    Sets the "to" default language.
    • possible values: a language name.
    • default value: Spanish.
  • bar.to_label
    Sets the "to" label.
    • possible values: text and any valid HTML code.
    • default value: To:.
  • bar.translate_button_label
    Sets the translate button label.
    • possible values: text and any valid HTML code.
    • default value: Go.
  • clear_local_storage
    Sets whether to force the visitor's browser to clear up the stored translations and retrieve them again from the server, or not. This setting is useful when writing custom translations.
    • possible values: true | false.
    • default value: false.
  • css
    Sets the css file location. It'll be used only if the manual_css setting is set to false. If two or more translators are being placed in the same web page, the styles can be placed in different files.
    If there are more than one translator with the same css setting, then only one will be loaded.
    • possible values: a front end CSS file path.
    • default value: translator/_styles/main.css.
  • exclude_selectors
    Sets the style classes used to select those elements to NOT be translated. This setting has priority over the target_selectors setting.
    • possible values: style names, comma separated. For instance: do_not_translate_me, dont_translate.
    • default values: do_not_translate_me.
  • flags_folder
    Sets the flags folder location. This folder contains a set of images for the languages.
    In order to reduce the number of requests and to speed up the loading times, the All.gif image contains all the flags.
    However, the folder also contains the single languages images for Internet Explorer 6 compatibility.
    • possible values: a front end folder path.
    • default value: translator/_images/flags/.
  • id
    Sets the internal id unique value. If two or more translators are being placed in the same web page, and all have the same id, then their ids will be renamed to id_<translators count>.
    It's also could be used for custom styling purposes, since the translator will be placed in a div:
    <div id="translator_container_id">
    • possible values: a string without spaces.
    • default value: my_translator.
  • initializing
    Sets the initializing message while loading the translator.
    • possible values: text and any valid HTML code.
    • default value: Initializing translator, please wait a moment....
  • js
    Sets the main JavaScript file location.
    • possible values: a front end JavaScript file path.
    • default value: translator/_javascript/translator.class.js.
  • languages
    Sets the available languages. They will be rendered in the same order as they are written. This setting will override the all_languages setting if it is not set to all.
    • possible values: languages names, comma separated. For instance: Czech, Danish, Dutch, English, Estonian, Finnish, French.
    • default values: all.
  • local_storage
    Sets whether the translations should be stored in the visitor's browser to speed up the plugin, or not. This feature is available on modern browsers only, it won't cause any impact on old browsers. However, it forces the visitor's browser to use an extra amount of memory, therefore, it might slow it down depending on how many translations are being stored.
    • possible values: true | false.
    • default value: false.
  • local_storage_expires
    Sets an expiration period for the stored translations, in days.
    • possible values: a positive integer number.
    • default value: 30.
  • loading
    Sets the loading message when the translation takes place.
    • possible values: text and any valid HTML code.
    • default value: Translating....
  • on_after_restore_translate
    Sets a callback function that runs after a translated item has been restored by clicking the restore button. Receives two arguments: item and translator.
    The function must be defined before initializing the translator; the try and catch statements can be used as shown in the following example.
    • possible values: a JavaScript function, for instance: function(_item, _translator) { try { onAfterRestoreTranslate(_item, _translator); } catch(e) {} } or just: onAfterRestoreTranslate.
    • default value: null.
  • on_after_translate
    Sets a callback function that runs after an item has been translated. Receives two arguments: item and translator.
    The function must be defined before initializing the translator; the try and catch statements can be used as shown in the following example.
    • possible values: a JavaScript function, for instance: function(_item, _translator) { try { onAfterTranslate(_item, _translator); } catch(e) {} } or just: onAfterTranslate.
    • default value: null.
  • on_before_restore_translate
    Sets a callback function that runs before a translated item is restored by clicking the restore button. Receives two arguments: item and translator.
    The function must be defined before initializing the translator; the try and catch statements can be used as shown in the following example.
    • possible values: a JavaScript function, for instance: function(_item, _translator) { try { onBeforeRestoreTranslate(_item, _translator); } catch(e) {} } or just: onBeforeRestoreTranslate.
    • default value: null.
  • on_before_translate
    Sets a callback function that runs before an item is translated. Receives two arguments: item and translator.
    The function must be defined before initializing the translator; the try and catch statements can be used as shown in the following example.
    • possible values: a JavaScript function, for instance: function(_item, _translator) { try { onBeforeTranslate(_item, _translator); } catch(e) {} } or just: onBeforeTranslate.
    • default value: null.
  • on_initialize
    Sets a callback function that runs when the translator is being initialized. Receives one argument: translator.
    The function must be defined before initializing the translator; the try and catch statements can be used as shown in the following example.
    • possible values: a JavaScript function, for instance: function(_translator) { try { onInitialize(_translator); } catch(e) {} } or just: onInitialize.
    • default value: null.
  • manual_css
    Sets how the translator's main css file should be loaded. If it's set to true, then the css setting will be overridden and the translator's styles should be manually loaded or included in another css file.
    • possible values: true | false.
    • default value: false.
  • translation_service
    Sets translation service. ss: SurStudio, ma: Microsoft, gt: Google
    • possible values: ss | ma | gt.
    • default value: ss.
  • remember
    Sets whether the selected languages should be remembered (in a cookie) after a page refresh or not.
    • possible values: true | false.
    • default value: true.
  • remember_auto_translate
    Sets whether the translation should take place automatically or not. Only works if the remember setting is set to true and after the user has made at least one translation.
    • possible values: true | false.
    • default value: false.
  • remember_cookie_from_name
    Sets the cookie name to store the language selected in the from option. Cookie's final name will be: remember_cookie_from_name_id.
    • possible values: a string without spaces.
    • default value: translator_from.
  • remember_cookie_to_name
    Sets the cookie name to store the language selected in the to option. Cookie's final name will be: remember_cookie_from_name_id.
    • possible values: a string without spaces.
    • default value: translator_to.
  • remember_persistency
    Sets whether the cookie should be kept after the visitor's browser is closed or not.
    • possible values: true | false.
    • default value: true.
  • re_select_on_translation
    Sets whether the content to be translated should be selected only once, or every time the translation takes place. The translator selects and excludes elements based on the target_selectors and exclude_selectors settings.
    If re_select_on_translation is set to false, then the elements to be translated will be selected once the page has been loaded.
    If re_select_on_translation is set to true, then the elements to be translated will be selected every time before a translation takes place.
    Usually, it's set to true when the content targeted for translation is generated by an AJAX request, or when bar.show_swap_button is also set to true.
    • possible values: true | false.
    • default value: false.
  • requests
    Sets the maximum number of requests sent to the API at the same time. A high number of requests will translate the page faster, but might hang or even crash the internet browser.
    • possible values: a positive integer number.
    • default value: 25.
  • restore_button_label
    Sets the restore button label. After a translation is completed, a button will be displayed to display the original texts.
    • possible values: text and any valid HTML code.
    • default value: Restore.
  • show_css3
    Sets whether the CSS3 styles should be displayed or not. CSS3 is available in modern browsers only. If the browser doesn't support CSS3, the translator will be displayed with the basic styles. In order to customize the CSS3 styles, please see the skin CSS file, and search for: CSS3 Decorations.
    • possible values: true | false.
    • default value: false.
  • show_initializing
    Sets whether the initializing message should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • show_loading
    Sets whether the loading message should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • show_restore_button
    Sets whether the restore button should be displayed or not. By clicking the restore button, all the selected text will be restored to their original content, and will clear the remember cookie too.
    • possible values: true | false.
    • default value: true.
  • skin
    Sets the translator's skin.
    Skins use transparent background images to achieve the rounded corners effect. Since Internet Explorer 6 doesn't support positioning transparent images, a set of squared skins are also available.
    If the translator detects Internet Explorer 6, then it will render the squared skin.
    For instance, if the classic_orange skin is set, then the classic_orange_squared skin will be rendered.
    Find screenshots of the available skins in the skins reference.
    • possible values: none | blue_classic | blue_classic_squared | blue_classic_compressed | blue_classic_compressed_squared | blue_thin | blue_thin_squared | blue_thin_compressed | blue_thin_compressed_squared | brown_classic | brown_classic_squared | brown_classic_compressed | brown_classic_compressed_squared | brown_thin | brown_thin_squared | brown_thin_compressed | brown_thin_compressed_squared | cyan_classic | cyan_classic_squared | cyan_classic_compressed | cyan_classic_compressed_squared | cyan_thin | cyan_thin_squared | cyan_thin_compressed | cyan_thin_compressed_squared | green_classic | green_classic_squared | green_classic_compressed | green_classic_compressed_squared | green_thin | green_thin_squared | green_thin_compressed | green_thin_compressed_squared | grey_classic | grey_classic_squared | grey_classic_compressed | grey_classic_compressed_squared | grey_thin | grey_thin_squared | grey_thin_compressed | grey_thin_compressed_squared | orange_classic | orange_classic_squared | orange_classic_compressed | orange_classic_compressed_squared | orange_thin | orange_thin_squared | orange_thin_compressed | orange_thin_compressed_squared | purple_classic | purple_classic_squared | purple_classic_compressed | purple_classic_compressed_squared | purple_thin | purple_thin_squared | purple_thin_compressed | purple_thin_compressed_squared | red_classic | red_classic_squared | red_classic_compressed | red_classic_compressed_squared | red_thin | red_thin_squared | red_thin_compressed | red_thin_compressed_squared | violet_classic | violet_classic_squared | violet_classic_compressed | violet_classic_compressed_squared | violet_thin | violet_thin_squared | violet_thin_compressed | violet_thin_compressed_squared | yellow_classic | yellow_classic_squared | yellow_classic_compressed | yellow_classic_compressed_squared | yellow_thin | yellow_thin_squared | yellow_thin_compressed | yellow_thin_compressed_squared.
    • default value: classic_orange.
  • skins_css_folder
    Sets the skins styles folder location.
    • possible values: a front end folder path.
    • default value: translator/_styles/skins/.
  • skins_image_folder
    Sets the skins images folder location.
    • possible values: a front end folder path.
    • default value: translator/_images/skins/.
  • tab.auto_close
    Sets whether the tab should be closed when a mouse click event is captured outside its boundaries or not.
    • possible values: true | false.
    • default value: false.
  • tab.close_label
    Sets the tab close message.
    • possible values: text and any valid HTML code.
    • default value: empty.
  • tab.cols
    Sets the quantity of columns to build the languages tabs table. Rows will be automatically adjusted.
    • possible values: an integer number. If it's a negative integer, then tab.cols should be a positive integer.
    • default value: 6.
  • tab.draggable
    Sets whether the tab is draggable or not. Since the draggable action spot is the title bar, only works if tab.show_title is set to true.
    • possible values: true | false.
    • default value: true.
  • tab.hide_effect
    If the web site is already using a JavaScript framework like jQuery, its effects can be used to hide the translator's tab.

    This script doesn't use nor include any framework; the above setting will use jQuery if it is available. It will fade the tab out, in 150 milliseconds. If the framework isn't loaded or there's a problem with the entered setting, then the tab will be displayed using the standard simple procedure. Leave it empty if no effect is desired.
    • possible values: a JavaScript string .
    • default value: jQuery({{ target }}).fadeOut(150).
      {{ target }} will be replaced with the tab's reference object, therefore it should be always included in the setting.
  • tab.rows
    Sets the quantity of rows to build the languages tabs table. Columns will be automatically adjusted.
    • possible values: an integer number. If it's a negative integer, then tab.cols should be a positive integer.
    • default value: -1.
  • tab.show_close
    Sets whether the tab close button should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • tab.show_effect
    If the web site is already using a JavaScript framework like jQuery, its effects can be used to display the translator's tab.

    This script doesn't use nor include any framework; the above setting will use jQuery if it is available. It will fade the tab in, in 250 milliseconds. If the framework isn't loaded or there's a problem with the entered setting, then the tab will be displayed using the standard simple procedure. Leave it empty if no effect is desired.
    • possible values: a JavaScript string .
    • default value: jQuery({{ target }}).fadeIn(250).
      {{ target }} will be replaced with the tab's reference object, therefore it should be always included in the setting.
  • tab.show_flags
    Sets whether the languages flags in the tab should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • tab.show_names
    Sets whether the languages names in the tab should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • tab.show_title
    Sets whether the tab's title should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • tab.show_title_icon
    Sets whether the round icon on the tab's title should be displayed or not.
    • possible values: true | false.
    • default value: true.
  • tab.template
    Sets the tab template. It contains: the title, the main languages table and the close button. New templates can be created if the provided one doesn't fit the web page requirements. Requires good HTML and CSS knowledge.
    • possible values: a file name located in the translator/_templates folder.
    • default value: tab_default.tpl.
  • tab.template_item
    Sets the language item template in the tab. It contains: the language name and flag image spot. New templates can be created if the provided one doesn't fit the web page requirements. Requires good HTML and CSS knowledge.
    • possible values: a file name located in the translator/_templates folder.
    • default value: tab_item_default.tpl.
  • tab.title_label
    Sets title label in the tab.
    • possible values: text and any valid HTML code.
    • default value: Pick a language.
  • tab.x_offset
    Sets the horizontal offset to be used for the default tab positioning. This setting will be overridden if the bar.show setting is set to false. The tab will be positioned relatively to their bar "from" and "to" buttons, using this setting as offset. Allows positive and negative integers.
    • possible values: an integer number. Positive or negative.
    • default value: 0.
  • tab.y_offset
    Sets the vertical offset to be used for the default tab positioning. This setting will be overridden if the bar.show setting is set to false. The tab will be positioned relatively to their bar "from" and "to" buttons, using this setting as offset. Allows positive and negative integers.
    • possible values: an integer number. Positive or negative.
    • default value: 5.
  • target_selectors
    Sets the style classes used to select those elements to be translated.
    • possible values: style names, comma separated. For instance: translate_me, do_translate.
    • default values: translate_me.
  • template
    Sets the main template. It contains: the bar, the tab, the restore button, the loading message and the JavaScript initialization routine. New templates can be created if the provided one doesn't fit the web page requirements. Requires good HTML and CSS knowledge.
    • possible values: a file name located in the translator/_templates folder.
    • default value: translator_default.tpl.
  • template_css
    Sets the css template. It contains JavaScript code. New templates can be created if the provided one doesn't fit the web page requirements. Requires HTML and JavaScript knowledge.
    • possible values: a file name located in the translator/_templates folder.
    • default value: css_default.tpl.
  • template_js
    Sets the javascript template. It contains HTML code. New templates can be created if the provided one doesn't fit the web page requirements. Requires HTML and JavaScript knowledge.
    • possible values: a file name located in the translator/_templates folder.
    • default value: js_default.tpl.
  • translate_button
    Sets whether the buttons should be translated or not. Buttons refers to the following HTML tags: <button>, <input type="button"> and <input type="submit">.
    • possible values: true | false.
    • default value: true.
  • translate_input
    Sets whether the input fields should be translated or not. Input fields refer to the following HTML tags: <input type="text"> and <textarea>.
    If the purpose is to translate user input data, then the re_select_on_translation setting should be set to true.
    • possible values: true | false.
    • default value: false.
  • translate_text
    Sets whether the texts should be translated or not.
    • possible values: true | false.
    • default value: true.
  • translate_translator
    Sets whether the translator itself should be translated or not, if it is contained in an element selected for translation.
    • possible values: true | false.
    • default value: false.