Skip to content

Test a translation rule

applyTranslationRule applies a translation rule to a number and returns the result, without changing anything. Use it to validate a rule before you save it on an object; the panel calls it to check every translation rule field when you save a form. It works for the CLD and CLI translation rules of accounts, account classes, authentication rules of accounts and DIDs, and connections. The rule syntax is explained in number translation.

Name Type Required Description
rule string yes The translation rule, for example s/^00/+/
number string no The number to translate. Default: empty string
Name Type Description
result string OK: the rule has a correct syntax
number string The number after translation

A rule with a syntax error returns a fault.

request
call("applyTranslationRule", {"rule": "s/^00//;s/^/+/", "number": "00442071234567"})
response
{"result": "OK", "number": "+442071234567"}