|
|
@@ -30,8 +30,10 @@ class TranslatorAdmin |
|
|
|
{ |
|
|
|
if ($entityClass) { |
|
|
|
return $this->transEntityThenDefault( |
|
|
|
$this->buildTransIdFlash($type . '.' . $name, $entityClass), |
|
|
|
$this->buildTransIdFlash($type . '.' . $name, $entityClass, true) |
|
|
|
$this->buildTransIdFlash($type . '.' . $name, $entityClass), |
|
|
|
$this->buildTransIdFlash($type . '.' . $name, $entityClass, true), |
|
|
|
false, |
|
|
|
$params |
|
|
|
); |
|
|
|
} else { |
|
|
|
return $this->trans('flash_message.' . $name, $params); |
|
|
@@ -41,20 +43,20 @@ class TranslatorAdmin |
|
|
|
public function transField($fieldName, $entityClass): string |
|
|
|
{ |
|
|
|
return $this->transEntityThenDefault( |
|
|
|
$this->buildTransIdField($fieldName, $entityClass), |
|
|
|
$this->buildTransIdField($fieldName, $entityClass, true) |
|
|
|
$this->buildTransIdField($fieldName, $entityClass), |
|
|
|
$this->buildTransIdField($fieldName, $entityClass, true) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function transFieldIndex($fieldName, $entityClass): string |
|
|
|
{ |
|
|
|
$idTranslationFieldIndex = $this->buildTransIdField($fieldName.'Index', $entityClass); |
|
|
|
$idTranslationFieldIndex = $this->buildTransIdField($fieldName . 'Index', $entityClass); |
|
|
|
|
|
|
|
$translation = $this->trans($idTranslationFieldIndex); |
|
|
|
|
|
|
|
if ($translation == $idTranslationFieldIndex) { |
|
|
|
return $this->transField($fieldName, $entityClass); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return $translation; |
|
|
|
} |
|
|
|
} |
|
|
@@ -79,41 +81,41 @@ class TranslatorAdmin |
|
|
|
$fieldName = $fieldName . '_help'; |
|
|
|
|
|
|
|
return $this->transEntityThenDefault( |
|
|
|
$this->buildTransIdField($fieldName, $entityClass), |
|
|
|
$this->buildTransIdField($fieldName, $entityClass, true), |
|
|
|
true |
|
|
|
$this->buildTransIdField($fieldName, $entityClass), |
|
|
|
$this->buildTransIdField($fieldName, $entityClass, true), |
|
|
|
true |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function transPanel($panelName, $entityClass): string |
|
|
|
{ |
|
|
|
return $this->transEntityThenDefault( |
|
|
|
$this->buildTransIdPanel($panelName, $entityClass), |
|
|
|
$this->buildTransIdPanel($panelName, $entityClass, true) |
|
|
|
$this->buildTransIdPanel($panelName, $entityClass), |
|
|
|
$this->buildTransIdPanel($panelName, $entityClass, true) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function transModal($modalName, $entityClass): string |
|
|
|
{ |
|
|
|
return $this->transEntityThenDefault( |
|
|
|
$this->buildTransIdModal($modalName, $entityClass), |
|
|
|
$this->buildTransIdModal($modalName, $entityClass, true) |
|
|
|
$this->buildTransIdModal($modalName, $entityClass), |
|
|
|
$this->buildTransIdModal($modalName, $entityClass, true) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function transCard($cardName, $entityClass): string |
|
|
|
{ |
|
|
|
return $this->transEntityThenDefault( |
|
|
|
$this->buildTransIdCard($cardName, $entityClass), |
|
|
|
$this->buildTransIdCard($cardName, $entityClass, true) |
|
|
|
$this->buildTransIdCard($cardName, $entityClass), |
|
|
|
$this->buildTransIdCard($cardName, $entityClass, true) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function transBox($cardName, $entityClass): string |
|
|
|
{ |
|
|
|
return $this->transEntityThenDefault( |
|
|
|
$this->buildTransIdBox($cardName, $entityClass), |
|
|
|
$this->buildTransIdBox($cardName, $entityClass, true) |
|
|
|
$this->buildTransIdBox($cardName, $entityClass), |
|
|
|
$this->buildTransIdBox($cardName, $entityClass, true) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
@@ -126,8 +128,8 @@ class TranslatorAdmin |
|
|
|
if ($entityName) { |
|
|
|
$baseIdEntityLabel = 'entity.' . $entityName; |
|
|
|
$paramsTranslation = [ |
|
|
|
'%label%' => $this->trans($baseIdEntityLabel . '.label'), |
|
|
|
'%label_plurial%' => $this->trans($baseIdEntityLabel . '.label_plurial'), |
|
|
|
'%label%' => $this->trans($baseIdEntityLabel . '.label'), |
|
|
|
'%label_plurial%' => $this->trans($baseIdEntityLabel . '.label_plurial'), |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
@@ -136,17 +138,18 @@ class TranslatorAdmin |
|
|
|
} |
|
|
|
|
|
|
|
return $this->trans( |
|
|
|
'title.' . $pageName, |
|
|
|
$paramsTranslation |
|
|
|
'title.' . $pageName, |
|
|
|
$paramsTranslation |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
private function transEntityThenDefault($idTranslationEntity, $idTranslationDefault, $returnEmpty = false): string |
|
|
|
private function transEntityThenDefault($idTranslationEntity, $idTranslationDefault, $returnEmpty = false, $params = []): string |
|
|
|
{ |
|
|
|
$translation = $this->trans($idTranslationEntity); |
|
|
|
|
|
|
|
$translation = $this->trans($idTranslationEntity, $params); |
|
|
|
|
|
|
|
if ($translation == $idTranslationEntity) { |
|
|
|
$translation = $this->trans($idTranslationDefault); |
|
|
|
$translation = $this->trans($idTranslationDefault, $params); |
|
|
|
|
|
|
|
if ($translation == $idTranslationDefault) { |
|
|
|
if ($returnEmpty) { |