Advanced Integration

Advanced Rule Library

Disclaimer: The Advanced GDN Rule editor is designed for developers who have an in-depth knowledge of your source code, site design, and the Global Delivery Network. Changes made using this tool have the ability to break functions of your translated sites, and in some cases prevent the translated sites from functioning in entirety. We recommend that you instead markup your source code using our GDN integration tags or configuration rules. If there are cases where this is not possible, contact your Customer Success Manager to discuss if this tool is right for you. 

Custom Rules

Select either 'CUSTOM_RULE_LOCATION' from the Rule Type drop down menu. Custom rules should always be terminated with a semicolon (;).

Regex

All regex for Smartling advanced rules should follow standard PCRE regex format.

URIs

All URIs used as a parameter are exact matches by default. To enabled regex pattern processing, prefix the URL with a tilde (~).

JavaScript

Rule Description Default Custom Rule Syntax Example
Include JavaScript Forces processing of a given URL as JavaScript   Y rps_include_js_url '[uri]'; rps_include_js_url '~(.*)\.js$';
Autoinclude JavaScript Declares content types to be automatically included for translation as JavaScript application/x-javascript, application/javascript, text/x-javascript, text/javascript Y rps_autoinclude_js_types '[string]'; rps_autoinclude_js_types 'text/jscript';
Include Content Types Declares content types that should be treated as JavaScript, including custom or non-standard types. Multiple content types can be defined by including space separated parameters. application/x-javascript Y rpsjs_types '[string]'; rpsjs_types 'application/x-javascript' 'application/x-type1';
Auto-detect HTML Automatically detect HTML embedded in JS/JSON off Y rps_auto_detect_embedded_html [on/off]; rps_auto_detect_embedded_html on;
Parse JS as HTML Declares script types that should be parsed as HTML   Y rps_parse_script_type_as_html '[string]'; rps_parse_script_type_as_html 'html/template';
Parse HTML with angle brackets Declares parsing of JS templates containing angle brackets such as: <% variable name %> off Y rps_parse_js_template_with_angle_bracket '[on/off]'; rps_parse_js_template_with_angle_bracket on;
Escape HTML Automatically escapes embedded HTML in JS/JSON. First argument is a regex URL parameter, second argument is the escaper. off Y rps_escape_embedded_html '[uri]' '[string]'; rps_escape_embedded_html '~/.*' new_line;
Unescape HTML Automatically unescapes embedded HTML in JS/JSON (if no rps_escape_embedded_html rule is defined for current request) off Y rps_auto_unescape_embedded_html [on/off]; rps_auto_unescape_embedded_html on;

JSON

Rule Description Default Custom Rule Syntax Example
Include JSON Forces processing of a given URL as JSON. You must explicitly specify which keys to include for ingestion.   Y rps_include_json_url '[uri]' '[keys]'; rps_include_json_url '~(.*)\.json$' 'title, body';
Include Generic JSON Forces processing of a given URL as JSON. Unlike rps_include_json_url, this rule will process both valid JSON and JSON-like data (JSON keys without quotes).   Y rps_include_generic_json_url '[uri]' '[keys]'; rps_include_generic_json_url '~(.*)\.json$' 'title, body';
Autoinclude JSON Declares content types to be automatically included for translation as JSON application/json, text/x-json, text/json Y rps_autoinclude_json_types '[string]'; rps_autoinclude_json_types 'application/x-json';
JSON path Declares JSON paths that should be included for translation   Y rps_json_path_url '[uri]' '[string]'; rps_json_path_url '~(.*)\.json$' 'store/book/0/category, store/book/name, store/bicycle/+';
Translate lists Process values stored in lists within JSON off Y rps_json_translate_lists [on/off]; rps_json_translate_lists on;
JSON delimiter Declares a space separated list of delimiters to be used for tokenizing plain text in JSON off Y rps_json_delimiter '[string]' '[uri(optional)]'; rps_json_delimiter '| ,' '~(.*)\.json$';
Parse JSON as HTML Used to parse JSON values as HTML. You must first include JSON (rps_include_json_url) before applying this rule.   Y rps_json_html_keys '[uri]' '[keys]'; rps_json_html_keys '~(.*)\.json$' 'content';

XML

Rule Description Custom Rule Syntax Example
Include XML Forces processing of a given URL as XML Y rps_include_xml_url '[uri]'; rps_include_xml_url '~(.*)\.xml$';
Include all XML tags Includes all XML tags for translation by default. (Default: On) Y rps_xml_extract_all [on/off]; rps_xml_extract_all off;
Parse escaped HTML Enables parsing of escaped HTML within XML for a given URL Y rps_parse_escaped_html_in_xml_url '[uri]'; rps_parse_escaped_html_in_xml_url '~(.*)\.xml$';

Pseudo-Translation

Rule Description Default Custom Rule Syntax Example Input Output
Enable Enables pseudo-translation Off Y rps_pseudo_translate_enabled [on/off]; rps_pseudo_translate_enabled on; Hello World [H~élló Wó~rld~]
Prefix Changes the prefix used in pseudo-translation [ Y rps_pseudo_translate_part_prefix '[character]'; rps_pseudo_translate_part_prefix '?'; [H~élló Wó~rld~] ?H~élló Wó~rld~]
Suffix Changes the suffix used in pseudo-translation ] Y rps_pseudo_translate_part_suffix '[character]'; rps_pseudo_translate_part_suffix '?'; [H~élló Wó~rld~] [H~élló Wó~rld~?
Inflation Character Changes the character used to inflate pseudo-translation ~ Y rps_pseudo_translate_inflater_str '[character]'; rps_pseudo_translate_inflater_str '?'; [H~élló Wó~rld~] [H?élló Wó?rld?]
Inflation Rate Changes the rate of string inflation as a percentage 25% Y rps_pseudo_translate_inflate_percents [integer]; rps_pseudo_translate_inflate_percents 100; [H~élló Wó~rld~] [H~é~l~l~ó~ ~W~ó~r~l~d~]
Inflation Limit Limits the amount inflation (as a percentage) that can occur for any single string 200% Y rps_pseudo_translate_max_inflatable [integer]; rps_pseudo_translate_max_inflatable 25; [H~é~l~l~ó~ ~W~ó~r~l~d~] [H~élló Wó~rld~]

Metadata

Rule Description Custom Rule Syntax Example
Include name A comma seperated list of meta tags to be included for translation Y rps_include_meta_name '[string]' '[url(optional)]'; rps_include_meta_name 'name:title, name:description';
Include attribute A comma seperated list of meta attributes to be included for translation Y rps_include_meta_attr '[string]' '[url(optional)]'; rps_include_meta_attr 'name t:title, g:description';
Split keywords Separates multiple keywords within a single meta tag description so they can be translated individually Y rps_split_meta_keywords '[character]'; rps_split_meta_keywords ',';
Split content Splits content of specified meta names in to separate strings Y rps_split_meta_content '[string]' '[character]'; rps_split_meta_content 'description' '|';
Open Graph Tags A comma separated list of Facebook Open Graph meta tags to be included for translation Y rps_translate_meta_og_property '[string]'; rps_translate_meta_og_property 'og:title, og:description, og:type';
Was this article helpful?