function _potx_find_language_names in Translation template extractor 8
Same name and namespace in other branches
- 5.2 potx.inc \_potx_find_language_names()
- 5 potx.inc \_potx_find_language_names()
- 6.3 potx.inc \_potx_find_language_names()
- 6 potx.inc \_potx_find_language_names()
- 6.2 potx.inc \_potx_find_language_names()
- 7.3 potx.inc \_potx_find_language_names()
- 7 potx.inc \_potx_find_language_names()
- 7.2 potx.inc \_potx_find_language_names()
Get languages names from Drupal's locale.inc.
Parameters
string $file: Full path name of file parsed.
string $save_callback: Callback function used to save strings.
int $api_version: Drupal API version to work with.
1 call to _potx_find_language_names()
- _potx_parse_php_file in ./
potx.inc - Parse a PHP file for translatables.
File
- ./
potx.inc, line 1633 - Extraction API used by the web and command line interface.
Code
function _potx_find_language_names($file, $save_callback, $api_version = POTX_API_CURRENT) {
global $_potx_tokens, $_potx_lookup;
if ($api_version > POTX_API_7) {
$key = 'getStandardLanguageList';
}
elseif ($api_version > POTX_API_5) {
$key = '_locale_get_predefined_list';
}
else {
$key = '_locale_get_iso639_list';
}
foreach ($_potx_lookup[$key] as $ti) {
// Search for the definition of _locale_get_predefined_list(), not where it
// is called.
if ($_potx_tokens[$ti - 1][0] == T_FUNCTION) {
break;
}
}
$end = _potx_find_end_of_function($ti);
// Function name, (, ), {, return, array, (.
$ti += 7;
while ($ti < $end) {
while ($_potx_tokens[$ti][0] != T_ARRAY) {
if (!is_array($_potx_tokens[$ti]) && $_potx_tokens[$ti] == ';') {
// We passed the end of the list, break out to function level
// to prevent an infinite loop.
break 2;
}
$ti++;
}
// array, (.
$ti += 2;
// Language names are context-less.
$save_callback(_potx_format_quoted_string($_potx_tokens[$ti][1]), POTX_CONTEXT_NONE, $file, $_potx_tokens[$ti][2]);
}
}