Skip to main content

Advanced GDN Rules

Disclaimer: The Advance GDN Rule editor is designed for developers who have in-depth knowledge of your source code, site design, and the Global Delivery Network. Changes made using this tool can break functions of your translated sites, and in some cases prevent the translated sites from functioning in entirety. We recommend that you instead mark up 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.

To Create an Advanced Rule

  1. From your GDN project, click the gear icon > Project Settings > Advanced GDN Rules

  2. Click the + New Rule button

  3. Choose your rule type from the dropdown menu

  4. Choose the domain and languages this should apply to

  5. Insert a rule condition, if applicable

  6. In the Rule text field, enter your rule parameter
    ​

    1. URL rules: Enter full URL path of the page to apply the rule. NOTE: Rules will execute on partial matches. For example, if you enter rule text "/products", your rule will apply to any page that contains /products in its URL.

    2. HTML Class or ID rules: Enter an HTML class or ID to apply the rule against. NOTE: If the HTML class or ID is not unique, your rule will be applied to every instance of the HTML element on your site.

  7. Add a comment

  8. Click Save to create your rule or Cancel to start over.

  9. In order for the newly added rule to take effect, you will need to reload the configuration by clicking the reload button.
    ​

    rule - reload.png

View Rule History

You can view the history of each rule by clicking the ellipses under Actions > View History. This shows the complete change history for a rule, including who made the changes and when. The history also shows the differences between the current and previous versions of the same rule.

Click the downward arrow of each history item to view the rule details.

Restore Rule

For each previous version of a rule, there is now a "Restore" button that allows you to bring back that iteration of the rule configuration. To restore an older rule, click the downward arrow > Restore

Advance Rule Library

Custom Rules

All rules listed are custom rules. Select either 'CUSTOM_RULE_LOCATION' from the Rule Type dropdown menu. Custom rules should always be terminated with a semicolon (;).

Regex

All regex for Smartling advanced rules should follow standard Java Regex format.

URIs

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

JavaScript

Rule

Description

Default

Syntax / Example

Include JavaScript

Forces processing of a given URL as JavaScript

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

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

rpsjs_types '[string]';

rpsjs_types 'application/x-javascript' 'application/x-type1';

Auto-detect HTML

Automatically detect HTML embedded in JS/JSON

Off

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

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

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

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

rps_auto_unescape_embedded_html [on/off];

rps_auto_unescape_embedded_html on;

JSON

Rule

Description

Default

Syntax / Example

Include JSON

Forces processing of a given URL as JSON. You must explicitly specify which keys to include for ingestion.

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).

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

rps_autoinclude_json_types '[string]';

rps_autoinclude_json_types 'application/x-json';

JSON path

Declares JSON paths that should be included for translation

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

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

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.

rps_json_html_keys '[uri]' '[keys]';

rps_json_html_keys '~(.*)\.json$' 'content';

XML

Rule

Description

Syntax / Example

Include XML

Forces processing of a given URL as XML

rps_include_xml_url '[uri]';

rps_include_xml_url '~(.*)\.xml$';

Include all XML tags

Includes all XML tags for translation by default. (Default: On)

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

rps_parse_escaped_html_in_xml_url '[uri]';

rps_parse_escaped_html_in_xml_url '~(.*)\.xml$';

Pseudo-Translation

Rule

Description

Default

Syntax /Example

Input

Output

Enable

Enables pseudo-translation

Off

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

[

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

]

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

~

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%

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%

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

Syntax / Example

Include name

A comma seperated list of meta tags to be included for translation

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

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

rps_split_meta_keywords '[character]';

rps_split_meta_keywords ',';

Split content

Splits content of specified meta names in to separate strings

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

rps_translate_meta_og_property '[string]';

rps_translate_meta_og_property 'og:title, og:description, og:type';

Did this answer your question?