original_string: public function getText(string $id): ?string
      {
          $getText = function(string $id, string $locale) {
              if (isset($this->defaultLocales[$locale]) && $this->defaultLocales[$locale] === 0) {
                  $app = App::get();
                  $context = $app->contexts->get(__FILE__);
                  $this->defaultLocales[$locale] = 1;
                  $filename = $context->dir . '/locales/' . $locale . '.php';
                  if (is_file($filename)) {
                      $data = include $filename;
                      if (is_array($data)) {
                          $this->addDictionary($locale, $data);
                      }
                  }
              }
              if (isset($this->dictionaries[$locale])) {
                  foreach ($this->dictionaries[$locale] as $i => $dictionary) {
                      if (is_callable($dictionary)) {
                          $dictionary = call_user_func($dictionary);
                          $this->dictionaries[$locale][$i] = $dictionary;
                      }
                      if (is_array($dictionary)) {
                          foreach ($dictionary as $_id => $text) {
                              if ($id === $_id) {
                                  return (string) $text;
                              }
                          }
                      }
                  }
              }
              return null;
          };
          $text = $getText($id, $this->locale);
          if ($text === null || !isset($text[0])) {
              $text = $getText($id, $this->backupLocale);
          }
          return $text;
      }
code: public function getText(string $id): ?string
      {
          $getText = function(string $id, string $locale) {
              if (isset($this->defaultLocales[$locale]) && $this->defaultLocales[$locale] === 0) {
                  $app = App::get();
                  $context = $app->contexts->get(__FILE__);
                  $this->defaultLocales[$locale] = 1;
                  $filename = $context->dir . '/locales/' . $locale . '.php';
                  if (is_file($filename)) {
                      $data = include $filename;
                      if (is_array($data)) {
                          $this->addDictionary($locale, $data);
                      }
                  }
              }
              if (isset($this->dictionaries[$locale])) {
                  foreach ($this->dictionaries[$locale] as $i => $dictionary) {
                      if (is_callable($dictionary)) {
                          $dictionary = call_user_func($dictionary);
                          $this->dictionaries[$locale][$i] = $dictionary;
                      }
                      if (is_array($dictionary)) {
                          foreach ($dictionary as $_id => $text) {
                              if ($id === $_id) {
                                  return (string) $text;
                              }
                          }
                      }
                  }
              }
              return null;
          };
          $text = $getText($id, $this->locale);
          if ($text === null || !isset($text[0])) {
              $text = $getText($id, $this->backupLocale);
          }
          return $text;
      }
code_tokens: public function getText ( string $ id ) : ? string { $ getText = function ( string $ id , string $ locale ) { if ( isset ( $ this -> defaultLocales [ $ locale ] ) && $ this -> defaultLocales [ $ locale ] === 0 ) { $ app = App :: get ( ) ; $ context = $ app -> contexts -> get ( __FILE__ ) ; $ this -> defaultLocales [ $ locale ] = 1 ; $ filename = $ context -> dir . '/locales/' . $ locale . '.php' ; if ( is_file ( $ filename ) ) { $ data = include $ filename ; if ( is_array ( $ data ) ) { $ this -> addDictionary ( $ locale , $ data ) ; } } } if ( isset ( $ this -> dictionaries [ $ locale ] ) ) { foreach ( $ this -> dictionaries [ $ locale ] as $ i => $ dictionary ) { if ( is_callable ( $ dictionary ) ) { $ dictionary = call_user_func ( $ dictionary ) ; $ this -> dictionaries [ $ locale ] [ $ i ] = $ dictionary ; } if ( is_array ( $ dictionary ) ) { foreach ( $ dictionary as $ _id => $ text ) { if ( $ id === $ _id ) { return ( string ) $ text ; } } } } } return null ; } ; $ text = $ getText ( $ id , $ this -> locale ) ; if ( $ text === null || ! isset ( $ text [ 0 ] ) ) { $ text = $ getText ( $ id , $ this -> backupLocale ) ; } return $ text ; }
docstring: Returns a text from the dictionary for the current locale.
  @param string $id The ID of the text.
  @return string A text from the dictionary for the current locale. Returns null if no text is found.
docstring_tokens: Returns a text from the dictionary for the current locale .