Translator Revolution Pro (PHP script)
Settings
Settings Reference
-
alignSets the alignment.
- possible values:
left
|right
. - default value:
left
.
- possible values:
-
all_languagesSets all the available languages. They will be used only if the
language
setting is set toall
, 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
.
- possible values: languages names, comma separated. For instance:
-
api_keySets the key for the SurStudio Translate API.
- possible values:
a valid api key
. - default value:
empty
.
-
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.
- possible values:
-
bar.from_defaultSets the "from" default language.
- possible values: a language name.
- default value:
English
.
-
bar.from_labelSets the "from" label.
- possible values: text and any valid HTML code.
- default value:
From:
.
-
bar.showSets whether the translator's bar should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
bar.show_flagsSets whether the languages flags in the bar should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
bar.show_fromSets 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 thebar.from_default
setting.
And if the webpage's language will always be the same, then it's recommended to set that language on thebar.from_default
setting.- possible values:
true
|false
. - default value:
true
.
- possible values:
-
bar.show_iconSets whether the bar icon should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
bar.show_namesSets whether the languages names in the bar should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
bar.show_swap_buttonSets whether the swap button in the bar should be displayed or not.
Usually, is set totrue
whenre_select_on_translation
is also set totrue
.- possible values:
true
|false
. - default value:
false
.
- possible values:
-
bar.show_translate_buttonSets 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
.
- possible values:
-
bar.swap_button_labelSets the swap button label.
- possible values: text and any valid HTML code.
- default value:
↔
.↔
is the HTML special character code for the left-right arrow (↔).
-
bar.templateSets 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
.
- possible values: a file name located in the
-
bar.template_itemSets 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
.
- possible values: a file name located in the
-
bar.to_defaultSets the "to" default language.
- possible values: a language name.
- default value:
Spanish
.
-
bar.to_labelSets the "to" label.
- possible values: text and any valid HTML code.
- default value:
To:
.
-
bar.translate_button_labelSets the translate button label.
- possible values: text and any valid HTML code.
- default value:
Go
.
-
clear_local_storageSets 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
.
- possible values:
-
cssSets the css file location. It'll be used only if the
manual_css
setting is set tofalse
. 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 samecss
setting, then only one will be loaded.- possible values: a front end CSS file path.
- default value:
translator/_styles/main.css
.
-
exclude_selectorsSets 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
.
- possible values: style names, comma separated. For instance:
-
flags_folderSets 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, theAll.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/
.
-
idSets the internal
id
unique value. If two or more translators are being placed in the same web page, and all have the sameid
, then theirids
will be renamed toid_<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
.
-
initializingSets the initializing message while loading the translator.
- possible values: text and any valid HTML code.
- default value:
Initializing translator, please wait a moment...
.
-
jsSets the main JavaScript file location.
- possible values: a front end JavaScript file path.
- default value:
translator/_javascript/translator.class.js
.
-
languagesSets 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 toall
.- possible values: languages names, comma separated. For instance:
Czech, Danish, Dutch, English, Estonian, Finnish, French
. - default values:
all
.
- possible values: languages names, comma separated. For instance:
-
local_storageSets 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
.
- possible values:
-
local_storage_expiresSets an expiration period for the stored translations, in days.
- possible values: a positive integer number.
- default value:
30
.
-
loadingSets the loading message when the translation takes place.
- possible values: text and any valid HTML code.
- default value:
Translating...
.
-
on_after_restore_translateSets a callback function that runs after a translated item has been restored by clicking the restore button. Receives two arguments:
item
andtranslator
.
The function must be defined before initializing the translator; thetry
andcatch
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
.
- possible values: a JavaScript function, for instance:
-
on_after_translateSets a callback function that runs after an item has been translated. Receives two arguments:
item
andtranslator
.
The function must be defined before initializing the translator; thetry
andcatch
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
.
- possible values: a JavaScript function, for instance:
-
on_before_restore_translateSets a callback function that runs before a translated item is restored by clicking the restore button. Receives two arguments:
item
andtranslator
.
The function must be defined before initializing the translator; thetry
andcatch
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
.
- possible values: a JavaScript function, for instance:
-
on_before_translateSets a callback function that runs before an item is translated. Receives two arguments:
item
andtranslator
.
The function must be defined before initializing the translator; thetry
andcatch
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
.
- possible values: a JavaScript function, for instance:
-
on_initializeSets a callback function that runs when the translator is being initialized. Receives one argument:
translator
.
The function must be defined before initializing the translator; thetry
andcatch
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
.
- possible values: a JavaScript function, for instance:
-
manual_cssSets how the translator's main css file should be loaded. If it's set to
true
, then thecss
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
.
- possible values:
-
translation_serviceSets translation service. ss: SurStudio, ma: Microsoft, gt: Google
- possible values:
ss
|ma
|gt
. - default value:
ss
.
- possible values:
-
rememberSets whether the selected languages should be remembered (in a cookie) after a page refresh or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
remember_auto_translateSets whether the translation should take place automatically or not. Only works if the
remember
setting is set totrue
and after the user has made at least one translation.- possible values:
true
|false
. - default value:
false
.
- possible values:
-
remember_cookie_from_nameSets 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_nameSets 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_persistencySets whether the
cookie
should be kept after the visitor's browser is closed or not.- possible values:
true
|false
. - default value:
true
.
- possible values:
-
re_select_on_translationSets 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
andexclude_selectors
settings.
Ifre_select_on_translation
is set tofalse
, then the elements to be translated will be selected once the page has been loaded.
Ifre_select_on_translation
is set totrue
, then the elements to be translated will be selected every time before a translation takes place.
Usually, it's set totrue
when the content targeted for translation is generated by an AJAX request, or whenbar.show_swap_button
is also set totrue
.
- possible values:
true
|false
. - default value:
false
.
- possible values:
-
requestsSets 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_labelSets 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_css3Sets 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
.
- possible values:
-
show_initializingSets whether the initializing message should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
show_loadingSets whether the loading message should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
show_restore_buttonSets 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 theremember
cookie too.- possible values:
true
|false
. - default value:
true
.
- possible values:
-
skinSets 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 theclassic_orange
skin is set, then theclassic_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
.
- possible values:
-
skins_css_folderSets the skins styles folder location.
- possible values: a front end folder path.
- default value:
translator/_styles/skins/
.
-
skins_image_folderSets the skins images folder location.
- possible values: a front end folder path.
- default value:
translator/_images/skins/
.
-
tab.auto_closeSets 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
.
- possible values:
-
tab.close_labelSets the tab close message.
- possible values: text and any valid HTML code.
- default value:
empty
.
-
tab.colsSets 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
.
- possible values: an integer number. If it's a negative integer, then
-
tab.draggableSets whether the tab is draggable or not. Since the draggable action spot is the title bar, only works if
tab.show_title
is set totrue
.- possible values:
true
|false
. - default value:
true
.
- possible values:
-
tab.hide_effectIf 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.rowsSets 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
.
- possible values: an integer number. If it's a negative integer, then
-
tab.show_closeSets whether the tab close button should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
tab.show_effectIf 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_flagsSets whether the languages flags in the tab should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
tab.show_namesSets whether the languages names in the tab should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
tab.show_titleSets whether the tab's title should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
tab.show_title_iconSets whether the round icon on the tab's title should be displayed or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
tab.templateSets 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
.
- possible values: a file name located in the
-
tab.template_itemSets 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
.
- possible values: a file name located in the
-
tab.title_labelSets title label in the tab.
- possible values: text and any valid HTML code.
- default value:
Pick a language
.
-
tab.x_offsetSets the horizontal offset to be used for the default tab positioning. This setting will be overridden if the
bar.show
setting is set tofalse
. 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_offsetSets the vertical offset to be used for the default tab positioning. This setting will be overridden if the
bar.show
setting is set tofalse
. 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_selectorsSets 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
.
- possible values: style names, comma separated. For instance:
-
templateSets 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
.
- possible values: a file name located in the
-
template_cssSets 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
.
- possible values: a file name located in the
-
template_jsSets 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
.
- possible values: a file name located in the
-
translate_buttonSets 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
.
- possible values:
-
translate_inputSets 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 there_select_on_translation
setting should be set totrue
.- possible values:
true
|false
. - default value:
false
.
- possible values:
-
translate_textSets whether the texts should be translated or not.
- possible values:
true
|false
. - default value:
true
.
- possible values:
-
translate_translatorSets 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
.
- possible values:
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
');
?>