Function __global->content_lang_string_translation
Definitions
sources/lang2.php
- API to do content translation programatically.This function is intended for programmers, writing upgrade scripts for a custom site (dev>staging>live).
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $lang_from | LANGUAGE_NAME | No | No | required parameter | N/A | N/A | From language |
| $lang_to | LANGUAGE_NAME | No | No | required parameter | N/A | N/A | To language |
| $content_lang_string_changes | array | No | No | required parameter | N/A | N/A | Mapping of strings to change (from => to); if 'to' is null it should be the same as 'from' |
| $test_run | boolean | No | No | False | N/A | N/A | Whether this is only a test run, don't change anything |
| $allow_multiple_matches | boolean | No | No | True | N/A | N/A | Allow multiple matches of source strings (false if we'll require exactly one match) |
Returns
- A List of error message strings, problems that happened
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* API to do content translation programatically.This function is intended for programmers, writing upgrade scripts for a custom site (dev>staging>live).
*
* @param LANGUAGE_NAME $lang_from From language
* @param LANGUAGE_NAME $lang_to To language
* @param array $content_lang_string_changes Mapping of strings to change (from => to); if 'to' is null it should be the same as 'from'
* @param boolean $test_run Whether this is only a test run, don't change anything
* @param boolean $allow_multiple_matches Allow multiple matches of source strings (false if we'll require exactly one match)
* @return array A List of error message strings, problems that happened
*/
function content_lang_string_translation(string $lang_from, string $lang_to, array $content_lang_string_changes, bool $test_run = false, bool $allow_multiple_matches = true) : array
* API to do content translation programatically.This function is intended for programmers, writing upgrade scripts for a custom site (dev>staging>live).
*
* @param LANGUAGE_NAME $lang_from From language
* @param LANGUAGE_NAME $lang_to To language
* @param array $content_lang_string_changes Mapping of strings to change (from => to); if 'to' is null it should be the same as 'from'
* @param boolean $test_run Whether this is only a test run, don't change anything
* @param boolean $allow_multiple_matches Allow multiple matches of source strings (false if we'll require exactly one match)
* @return array A List of error message strings, problems that happened
*/
function content_lang_string_translation(string $lang_from, string $lang_to, array $content_lang_string_changes, bool $test_run = false, bool $allow_multiple_matches = true) : array

