function _potx_init_yaml_translation_patterns in Translation template extractor 7.2
Same name and namespace in other branches
- 8 potx.inc \_potx_init_yaml_translation_patterns()
- 6.3 potx.inc \_potx_init_yaml_translation_patterns()
- 7.3 potx.inc \_potx_init_yaml_translation_patterns()
Initialize the list of translation patterns for YAML files.
The patterns are loaded from a file named "yaml_translation_patterns.yml" in potx's root. Contrib projects can also include their own "yaml_translation_patterns.yml" file in their root folder to specify translatable strings in their own custom yaml files.
Parameters
string $path: The path to look for a custom "yaml_translation_patterns.yml" file.
3 calls to _potx_init_yaml_translation_patterns()
- PotxTestCase::testDrupal8CustomYml in tests/
potx.test - Test parsing of custom yaml files.
- _potx_explore_dir in ./
potx.inc - Collect a list of file names relevant for extraction, starting from the given path.
- _potx_parse_yaml_file in ./
potx.inc - Parse a YAML file for translatables. Drupal 8+.
File
- ./
potx.inc, line 1898 - Extraction API used by the web and command line interface.
Code
function _potx_init_yaml_translation_patterns($path = '') {
global $yaml_translation_patterns;
$yaml_translation_patterns = array();
$default_patterns = drupal_get_path('module', 'potx') . '/yaml_translation_patterns.yml';
_potx_load_yaml_translation_patterns($default_patterns);
$custom_patterns = $path . '/yaml_translation_patterns.yml';
if (!empty($path) && file_exists($custom_patterns)) {
_potx_load_yaml_translation_patterns($custom_patterns);
}
}