Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

i18n_get_all_translations()

Description

Return an array of all available language strings for the given id, with the language code as the key

Parameters

ColumnTypeDefaultDescription
$langid: string
$langid string The identifier of the lang string

Return

array *

Location

include/language_functions.php lines 690 to 721

Definition

 
function i18n_get_all_translations(string $langid): array
    {
    global 
$lang;
    
$savedlang $lang;
    
$alltranslations = [];
    foreach(
$GLOBALS["languages"] as $langcode=>$availlanguage)
        {
        if (
$langcode!="en")
            {
            if (
substr($langcode21)!='-')
                {
                
$langcode substr($langcode02);
                }
            
            
$use_error_exception_cache $GLOBALS["use_error_exception"]??false;
            
$GLOBALS["use_error_exception"] = true;
            try
                {
                include 
dirname(__FILE__)."/../languages/" safe_file_name($langcode) . ".php";
                }
            catch (
Exception $e)
                {
                
debug("Unable to include language file $langcode.php" $e->getMessage());
                }
            
$GLOBALS["use_error_exception"] = $use_error_exception_cache;
            }
        
$alltranslations[$langcode] =$lang[$langid];
        }
    
// Revert to original
    
$lang $savedlang;
    return 
$alltranslations;
    }

This article was last updated 27th April 2024 07:35 Europe/London time based on the source file dated 17th April 2024 14:35 Europe/London time.