$xls->getDefaultStyle()->getProtection()->setLocked(false);
$worksheet->setCellValueByColumnAndRow(1, 1, 'ID');
- $worksheet->setCellValueByColumnAndRow(2, 1, 'Reference string');
- $worksheet->setCellValueByColumnAndRow(3, 1, 'Reference translation');
- $worksheet->setCellValueByColumnAndRow(4, 1, 'Translation');
+ $worksheet->setCellValueByColumnAndRow(2, 1, 'Reference string (text in the code)');
+ $worksheet->setCellValueByColumnAndRow(3, 1, 'Reference translation (translation in the reference language ' . $ref . ')');
+ $worksheet->setCellValueByColumnAndRow(4, 1, 'Translation (edit this column)');
for ($i = 2; $i <= 4; $i++) {
$style = $worksheet->getStyleByColumnAndRow($i, 1);
$style->getAlignment()->setWrapText(true);
}
}
$res = [];
+
+
foreach ($data as $k => $v) {
if ($k === 'k') {
continue;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\RichText\RichText;
use Prologue\Alerts\Facades\Alert;
+
// __('!! Traduction de l\'interface fluidbook')
trait ExcelImportOperation
{
$file = $_FILES['file'];
if ($file['error']) {
- Alert::warning('No file were imported')->flash();
+ Alert::warning(__('Aucun fichier chargé'))->flash();
return;
}
}
$v = $sheet->getCellByColumnAndRow(4, $ri)->getValue();
- if($v instanceof RichText){
- $v=$v->getPlainText();
+ if ($v instanceof RichText) {
+ $v = $v->getPlainText();
}
if (!isset($existingTranslation[$k]['translation']) || $v != $existingTranslation[$k]['translation']) {
if (!$count) {
- Alert::warning('No translation were find')->flash();
+ Alert::warning(__('Aucune traduction n\'a été trouvée dans le fichier'))->flash();
} elseif (!$updated) {
- Alert::warning('No translation were updated')->flash();
+ Alert::warning(__('Aucune traduction n\'a été mise à jour'))->flash();
} else {
$class::updateTranslation($locale, $translations);
- Alert::success('<b>' . $updated . ' translations</b> were updated (' . $count . ' total)')->flash();
+ Alert::success(__(':nb traductions ont été mises à jour (sur un total de :total) pour la langue :locale', ['nb' => $updated, 'total' => $count, 'locale' => $locale]))->flash();
}
- return redirect($this->crud->route . '/1/edit/?locale=' . $locale);
+ return redirect($this->crud->route . '/1/edit?_locale=' . $locale);
}
}
public static function getAllTranslations($force = true)
{
if (null === static::$_allTranslations) {
+
+
$cacheKey = static::_getCacheKey();
if ($force) {
Cache::forget($cacheKey);
foreach ($json as $code => $tr) {
$res[$code] = [];
foreach ($tr as $k => $v) {
-
$res[$code][$k] = ['str' => static::keyToStr($k), 'translation' => $v];
}
}
{{-- __('!! Traduction des fluidbooks') --}}
@push("after_form")
-<form method="post" style="visibility: hidden;width: 0;height: 0;" enctype="multipart/form-data" action="{{$crud->route}}/excel/import/{{request()->get('locale',app()->getLocale())}}"
- style="visibility:hidden;height:1px;position:absolute;top:0;" id="uploadimportform">
- @csrf
- <input type="file" name="file" id="uploadimport"
- accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
-</form>
+ <form method="post" style="visibility: hidden;width: 0;height: 0;" enctype="multipart/form-data"
+ action="{{$crud->route}}/excel/import/{{request()->get('_locale',app()->getLocale())}}"
+ style="visibility:hidden;height:1px;position:absolute;top:0;" id="uploadimportform">
+ @csrf
+ <input type="file" name="file" id="uploadimport"
+ accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
+ </form>
@endpush
<button class="btn btn-outline-notice" id="uploadimportbutton"><span