Example #1
0
 public function getProgressByGroup($locale, $group = null)
 {
     list($namespace, $group) = explode('.', $group);
     if (is_null($namespace)) {
         $namespace = '*';
     }
     if ($locale != config('multilanguage.locale')) {
         $total = $this->getEntryModel()->where(config('multilanguage.locale_key'), $locale)->where('namespace', $namespace)->where('group', $group)->where('locked', static::LOCKED)->count();
     } else {
         $total = $this->getEntryModel()->where(config('multilanguage.locale_key'), $locale)->where('namespace', $namespace)->where('group', $group)->count();
     }
     if (!$total) {
         return 0;
     }
     $translations = $this->fileLoader->load(config('multilanguage.locale'), $group, $namespace);
     $total_rows = count(array_dot($translations, $group));
     if (!$total_rows) {
         return 0;
     }
     return round($total / $total_rows * 100, 2);
 }
Example #2
0
 /**
  * Load the messages strictly for the given locale.
  *
  * @param  Language  	$language
  * @param  string  		$group
  * @param  string  		$namespace
  * @return array
  */
 public function loadRawLocale($locale, $group, $namespace = null)
 {
     $namespace = $namespace ?: '*';
     return $this->array_merge($this->fileLoader->loadRawLocale($locale, $group, $namespace), $this->databaseLoader->loadRawLocale($locale, $group, $namespace));
 }