getLocales() public method

public getLocales ( )
 public function flushLocales()
 {
     $locales = array_keys($this->locales->getLocales());
     foreach ($locales as $locale) {
         $this->getLocaleCompiler($locale)->flush();
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  *
  * @return ClientView
  */
 public function render(Request $request, array $routeParams = [])
 {
     $actor = app('flarum.actor');
     $assets = $this->getAssets();
     $locale = $this->getLocale($actor, $request);
     $localeCompiler = $this->getLocaleCompiler($locale);
     $view = new ClientView($this->apiClient, $request, $actor, $assets, $localeCompiler, $this->layout);
     $view->setVariable('locales', $this->locales->getLocales());
     $view->setVariable('locale', $locale);
     // Now that we've set up the ClientView instance, we can fire an event
     // to give extensions the opportunity to add their own assets and
     // translations. We will pass an array to the event which specifies
     // which translations should be included in the locale file. Afterwards,
     // we will filter all of the translations for the actor's locale and
     // compile only the ones we need.
     $translations = $this->locales->getTranslations($locale);
     $keys = $this->translationKeys;
     event(new BuildClientView($this, $view, $keys));
     $translations = $this->filterTranslations($translations, $keys);
     $localeCompiler->setTranslations($translations);
     return $view;
 }
Example #3
0
 public function flushLocaleCss()
 {
     foreach ($this->locales->getLocales() as $locale => $info) {
         $this->getLocaleCss($locale)->flush();
     }
 }
Example #4
0
 protected function buildPayload(Request $request, $forum)
 {
     $data = $this->getDataFromDocument($forum);
     if ($request->getAttribute('actor')->exists) {
         $user = $this->getUserDocument($request);
         $data = array_merge($data, $this->getDataFromDocument($user));
     }
     $payload = ['resources' => $data, 'session' => $this->buildSession($request), 'document' => $this->document, 'locales' => $this->locales->getLocales(), 'locale' => $this->locales->getLocale()];
     return array_merge($payload, $this->variables);
 }