RainLab\Translate\Models\Locale::listAvailable PHP 메소드

listAvailable() 공개 정적인 메소드

Lists available locales, used on the back-end.
public static listAvailable ( ) : array
리턴 array
    public static function listAvailable()
    {
        if (self::$cacheListAvailable) {
            return self::$cacheListAvailable;
        }
        return self::$cacheListAvailable = self::lists('name', 'code');
    }

Usage Example

예제 #1
0
 /**
  * Removes localized content files from templates collection
  * @param \October\Rain\Database\Collection $templates
  * @return \October\Rain\Database\Collection
  */
 public function pruneTranslatedContentTemplates($templates)
 {
     $locales = LocaleModel::listAvailable();
     $extensions = array_map(function ($ext) {
         return '.' . $ext;
     }, array_keys($locales));
     return $templates->filter(function ($template) use($extensions) {
         return !Str::endsWith($template->getBaseFileName(), $extensions);
     });
 }
All Usage Examples Of RainLab\Translate\Models\Locale::listAvailable