Returns the where part for the audience targeting.

@param string $targetGroupId
@param string $locale

@return string
498929
private function buildAudienceTargeting($targetGroupId, $locale)
    {
        if (!$targetGroupId) {
            return;
        }

        $structure = $this->structureManager->getStructure('excerpt');

        $property = new TranslatedProperty(
            $structure->getProperty('audience_targeting_groups'),
            $locale,
            $this->languageNamespace,
            'excerpt'
        );

        return 'page.[' . $property->getName() . '] = ' . $targetGroupId;
    }
1009765
public function load($locale, $group, $namespace = null)
	{
		if (is_null($namespace) || $namespace == '*')
		{
			return $this->loadPath($this->path, $locale, $group);
		}
		else
		{
			return $this->loadNamespaced($locale, $group, $namespace);
		}
	}
299724
public function findFooter(string $locale): ICollection
	{
		return $this->findMain(true)
			->findBy([
				'this->views->id' => PagesViewsMapper::FOOTER,
				'this->locale->name' => $locale
			]);
	}
1075766
protected function getFallbackLocale($locale)
    {
        if ($position = strpos($locale, '-')) {
            $target = substr($locale, 0, $position);
            $available = $this->getLocaleOptions();
            if (isset($available[$target])) {
                return $target;
            }
        }

        return Config::get('app.fallback_locale');
    }
1290148
public function findMenu(string $locale): ICollection
	{
		return $this->findMain(true)
			->findBy([
				'this->views->id' => PagesViewsMapper::MENU,
				'this->locale->name' => $locale
			]);
	}
797950
public function getLocalization($locale)
    {
        $dataCollection = $this->getLocalizations();
        $data = $dataCollection->get($locale);

        return $data;
    }
753763
public static function getByLocale($locale)
    {
        if (!$locale) {
            return null;
        }

        if ($locale instanceof Locale) {
            return $locale;
        }

        if (!static::$locales_by_title) {
            static::$locales_by_title = [];
            foreach (Locale::getCached() as $localeObj) {
                static::$locales_by_title[$localeObj->Locale] = $localeObj;
            }
        }

        // Get filtered locale
        return isset(static::$locales_by_title[$locale]) ? static::$locales_by_title[$locale] : null;
    }
1184964
public function getLocaleAccess($locale, $user = 'current')
    {
        $result = self::NONE;
        $user = $this->getUser($user);
        if ($user === null) {
            $result = self::NOT_LOGGED_IN;
        } else {
            $result = self::NONE;
            if ($user->getUserID() == USER_SUPER_ID) {
                $result = self::GLOBAL_ADMIN;
            } elseif ($user->inGroup($this->groups->getGlobalAdministrators())) {
                $result = self::GLOBAL_ADMIN;
            } else {
                $locale = $this->getLocale($locale);
                if ($locale !== null) {
                    if ($user->inGroup($this->groups->getAdministrators($locale))) {
                        $result = self::ADMIN;
                    } elseif ($user->inGroup($this->groups->getTranslators($locale))) {
                        $result = self::TRANSLATE;
                    } elseif ($user->inGroup($this->groups->getAspiringTranslators($locale))) {
                        $result = self::ASPRIRING;
                    }
                }
            }
        }

        return $result;
    }
327768
public function addTargetGroup(TargetGroupInterface $targetGroup)
    {
        $fileVersion = $this->getFileVersion();
        $fileVersion->addTargetGroup($targetGroup);

        return $this;
    }
1276616
public function getGroups($area, $locale)
    {
        return $this->model->where('area', $area)->whereHas('language', function($query) use($locale) {
                            $query->where('code', $locale);
                        })->groupBy('group')->orderBy('group', 'desc')
                        ->get();
    }
306138
private function retrieveTargetGroupById($id)
    {
        /** @var TargetGroupInterface $targetGroup */
        $targetGroup = $this->getTargetGroupRepository()->find($id);

        if (!$targetGroup) {
            throw new EntityNotFoundException($this->getTargetGroupRepository()->getClassName(), $id);
        }

        return $targetGroup;
    }
290922
public function getPreviewURL($locale = null)
    {
        $token = app()->make(TokenManager::class)
            ->makeNewToken('preview_nodes');

        $url = $this->getSiteURL($locale);

        return $url . '?preview_nodes=' . $token;
    }
224848
public static function fetchByGroup( $groupID, $limit = false, $offset = false )
    {
        return self::fetchByConditions( array( "ezcobj_state_group.id=$groupID" ), $limit, $offset );
    }
1001772
public function get($key, $locale = null) {
        $segments = $this->parseKey($key);
        $group = $segments[0];
        $item = $segments[1];

        if ("" == $group) {
            return "";
        }

        $localeArray = $this->parseLocale($locale);
        foreach ($localeArray as $locale) {
            $this->load($group, $locale);

            if (isset($this->loaded[$group][$locale])) {
                if (null == $item) {
                    return $this->loaded[$group][$locale];
                } elseif (isset($this->loaded[$group][$locale][$item])) {
                    return $this->loaded[$group][$locale][$item];
                }
            }
        }

        return "";
    }
744768
public function getParentPagesChoices($locale, $id = null)
    {
        $qb = $this->getParentPagesQuery($locale, $id);

        return $qb->getQuery()->execute();
    }
142008
public function getItems($locale, $namespace, $group)
    {
        return $this->model
            ->whereLocale($locale)
            ->whereNamespace($namespace)
            ->whereGroup($group)
            ->get()
            ->toArray();
    }
649677
public function getCategories($id, $locale)
    {
        $groups    = $this->getGroups($id, $locale)->toArray();
        $available = antares('memory')->get('extensions.available');
        $list      = ['all' => 'All', 'foundation' => trans('Core')];

        array_walk($groups, function($item) use($available, &$list) {
            $group = str_replace('antares/', '', $item['group']);
            foreach ($available as $extension) {
                if ($group == $extension['name']) {
                    $list[$group] = $extension['full_name'];
                }
            }
        });
        $return = [
            'all'           => 'All',
            'core'          => [
                'label'      => trans('antares/translations::messages.group.core'),
                'extensions' => []
            ],
            'configuration' => [
                'label'      => trans('antares/translations::messages.group.configuration'),
                'extensions' => []
            ],
        ];
        foreach ($list as $name => $value) {
            if (in_array($name, ['foundation', 'widgets', 'search', 'control'])) {
                $return['core']['extensions'][$name] = $value;
            } elseif (in_array($name, ['two_factor_auth', 'api'])) {
                $return['configuration']['extensions'][$name] = $value;
            } else {
                $return[$name] = $value;
            }
        }
        return $return;
    }