1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

Aggioramento delle traduzioni

Miglioramento della gestione delle traduzioni, con bugfix e inizializzazione della traduzione in inglese.
This commit is contained in:
Thomas Zilio
2017-09-04 12:59:03 +02:00
parent 548639673a
commit 90e7a23852
23 changed files with 5433 additions and 211 deletions

1
.gitignore vendored
View File

@@ -71,7 +71,6 @@ vendor/
###################### ######################
*.new *.new
*.old *.old
*.mo
.couscous/ .couscous/
assets/dist/ assets/dist/
backup/* backup/*

View File

@@ -176,7 +176,7 @@ if (!empty($module_query) && $module_query != 'menu' && $module_query != 'custom
} }
// Icona // Icona
elseif (preg_match('/^icontr(.+?)$/', trim($field), $m)) { elseif (preg_match('/^icon_(.+?)$/', trim($field), $m)) {
$value = '<i class="'.$r[$field].'"></i> <small>'.$r['icon_title_'.$m[1]].'</small>'; $value = '<i class="'.$r[$field].'"></i> <small>'.$r['icon_title_'.$m[1]].'</small>';
} }

View File

@@ -111,9 +111,10 @@ Translator::setLocaleFormatter($formatter);
// Istanziamento del gestore delle traduzioni del progetto // Istanziamento del gestore delle traduzioni del progetto
$lang = !empty($lang) ? $lang : 'it'; $lang = !empty($lang) ? $lang : 'it';
$translator = new Translator($lang); $translator = Translator::getInstance();
$translator->addLocalePath($docroot.'/locale'); $translator->addLocalePath($docroot.'/locale');
$translator->addLocalePath($docroot.'/modules/*/locale'); $translator->addLocalePath($docroot.'/modules/*/locale');
$translator->setLocale($lang);
// Individuazione di versione e revisione del progetto // Individuazione di versione e revisione del progetto
$version = Update::getVersion(); $version = Update::getVersion();

View File

@@ -22,7 +22,7 @@ class FileLoader extends \Symfony\Component\Translation\Loader\FileLoader
$result = []; $result = [];
$extension = strtolower(pathinfo($resource, PATHINFO_EXTENSION)); $extension = strtolower(pathinfo($resource, PATHINFO_EXTENSION));
if (!empty($extension) && !empty($this->getLoader($extension))) { if (!empty($extension) && $extension != 'po' && !empty($this->getLoader($extension))) {
$result = $this->getLoader($extension)->loadResource($resource); $result = $this->getLoader($extension)->loadResource($resource);
if (!empty($this->include_filename)) { if (!empty($this->include_filename)) {

View File

@@ -60,7 +60,7 @@ class Translator extends Util\Singleton
*/ */
protected function addLocales($path) protected function addLocales($path)
{ {
if (!empty($this->$translator)) { if (!empty($this->translator)) {
// Individua i linguaggi disponibili // Individua i linguaggi disponibili
$dirs = glob($path.DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR); $dirs = glob($path.DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR);
foreach ($dirs as $dir) { foreach ($dirs as $dir) {
@@ -126,7 +126,7 @@ class Translator extends Util\Singleton
{ {
if (!empty($locale) && $this->isLocaleAvailable($locale)) { if (!empty($locale) && $this->isLocaleAvailable($locale)) {
if (!empty($this->translator)) { if (!empty($this->translator)) {
self::$translator->setLocale($locale); $this->translator->setLocale($locale);
} }
$this->locale = $locale; $this->locale = $locale;
} }

BIN
locale/en/en.mo Normal file

Binary file not shown.

5386
locale/en/en.po Normal file

File diff suppressed because it is too large Load Diff

BIN
locale/it/it.mo Normal file

Binary file not shown.

View File

@@ -21,13 +21,3 @@
</table> </table>
<br/> <br/>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table>
<tr><td style="font-size:7pt; color:#999;">
Stampato con OpenSTAManager
</td></tr>
</table>
</page_footer>

View File

@@ -25,16 +25,3 @@
</table> </table>
<br/> <br/>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table style="width:200mm; font-size:7pt; color:#999;">
<tr><td style="width:100mm;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table>
</page_footer>

View File

@@ -41,18 +41,3 @@
</table> </table>
<br/> <br/>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
|footer|
<table border="0" style="width:200mm; font-size:7pt; color:#999; border: 0px solid red;">
<tr><td style="width:100mm;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table>
</page_footer>

View File

@@ -7,16 +7,3 @@
</table> </table>
<br/> <br/>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table style="width:200mm; font-size:7pt; color:#999;">
<tr><td style="width:100mm;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table>
</page_footer>

View File

@@ -33,21 +33,12 @@
<!-- Footer --> <!-- Footer -->
<page_footer> <page_footer>
<table border="0" style="width:200mm; font-size:7pt; color:#999; border: 0px solid red;"> <table border="0" style="width:200mm; font-size:7pt; color:#999; border: 0px solid red;">
<tr> <tr><td style="text-align:center;">
<td colspan="2" style="text-align:center;"> $dicitura_fissa_fattura$
Ai sensi del D.Lgs. 196/2003 Vi informiamo che i Vs. dati saranno utilizzati esclusivamente per i fini connessi ai rapporti commerciali tra di noi in essere.<br/>
Contributo CONAI assolto ove dovuto - Vi preghiamo di controllare i Vs. dati anagrafici, la P. IVA e il Cod. Fiscale. Non ci riteniamo responsabili di eventuali errori.<br/><br/>
</td>
</tr>
<tr><td style="width:100mm;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr> </td></tr>
</table> </table>
<br>
$pagination$
</page_footer> </page_footer>

View File

@@ -44,18 +44,12 @@
<page_footer> <page_footer>
|footer| |footer|
<table border="0" style="width:200mm; font-size:7pt; color:#999; border: 0px solid red;"> <table border="0" style="width:200mm; font-size:7pt; color:#999; border: 0px solid red;">
<tr><td colspan="2" style="text-align:center;"> <tr><td style="text-align:center;">
Ai sensi del D.Lgs. 196/2003 Vi informiamo che i Vs. dati saranno utilizzati esclusivamente per i fini connessi ai rapporti commerciali tra di noi in essere.<br/> $dicitura_fissa_fattura$
Vi preghiamo di controllare i Vs. dati anagrafici, la P. IVA e il Cod. Fiscale. Non ci riteniamo responsabili di eventuali errori.<br/><br/>
</td></tr> </td></tr>
<tr><td style="width:100mm;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table> </table>
<br>
$pagination$
</page_footer> </page_footer>

View File

@@ -7,16 +7,3 @@
</table> </table>
<br/> <br/>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table style="width:200mm; font-size:7pt; color:#999;">
<tr><td style="width:100mm;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table>
</page_footer>

View File

@@ -25,17 +25,3 @@
</table> </table>
<br/> <br/>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table border="0" style="width:200mm; font-size:7pt; color:#999; border: 0px solid red;">
<tr><td style="width:100mm;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table>
</page_footer>

View File

@@ -21,16 +21,3 @@
</td></tr> </td></tr>
</table> </table>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table>
<tr><td style="width:100mm; color:#888;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right; color:#888;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table>
</page_footer>

View File

@@ -105,25 +105,19 @@ foreach ($replace as $prefix => $values) {
$report = str_replace(array_keys($values), array_values($values), $report); $report = str_replace(array_keys($values), array_values($values), $report);
} }
// Valori aggiuntivi per la sostituzione
$values = [
'dicitura_fissa_fattura' => get_var('Dicitura fissa fattura'),
];
foreach ($values as $key => $value) {
$values['$'.$key.'$'] = empty($value) ? $value : $value.'<br/>';
unset($values[$key]);
}
// Sostituisce alle variabili del template i valori
$body = str_replace(array_keys($values), array_values($values), $body);
$report = str_replace(array_keys($values), array_values($values), $report);
// Aggiunta del footer standard // Aggiunta del footer standard
if (!str_contains($body, '<page_footer>') && !str_contains($report, '<page_footer>')) { if (!str_contains($body, '<page_footer>') && !str_contains($report, '<page_footer>')) {
$report .= ' $report .= '
<!-- Footer --> <!-- Footer -->
<page_footer> <page_footer>
$pagination$
</page_footer>';
}
// Valori aggiuntivi per la sostituzione
$values = [
'dicitura_fissa_fattura' => get_var('Dicitura fissa fattura'),
'pagination' => '
<table style="color:#aaa; font-size:10px;"> <table style="color:#aaa; font-size:10px;">
<tr> <tr>
<td align="left" style="width:97mm;"> <td align="left" style="width:97mm;">
@@ -134,6 +128,14 @@ if (!str_contains($body, '<page_footer>') && !str_contains($report, '<page_foote
'.str_replace(['_PAGE_', '_TOTAL_'], ['[[page_cu]]', '[[page_nb]]'], tr('Pagina _PAGE_ di _TOTAL_')).' '.str_replace(['_PAGE_', '_TOTAL_'], ['[[page_cu]]', '[[page_nb]]'], tr('Pagina _PAGE_ di _TOTAL_')).'
</td> </td>
</tr> </tr>
</table> </table>',
</page_footer>'; ];
foreach ($values as $key => $value) {
$values['$'.$key.'$'] = empty($value) ? $value : $value.'<br/>';
unset($values[$key]);
} }
// Sostituisce alle variabili del template i valori
$body = str_replace(array_keys($values), array_values($values), $body);
$report = str_replace(array_keys($values), array_values($values), $report);

View File

@@ -21,17 +21,3 @@
</table> </table>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table style="width:200mm; font-size:7pt; color:#999;">
<tr><td style="width:100mm;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table>
</page_footer>

View File

@@ -25,16 +25,3 @@
</table> </table>
<br/> <br/>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table style="width:200mm; font-size:7pt; color:#999;">
<tr><td style="width:100mm;">
Stampato con OpenSTAManager
</td>
<td style="width:100mm; text-align:right;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table>
</page_footer>

View File

@@ -25,13 +25,3 @@
</table> </table>
<br/> <br/>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table>
<tr><td style="font-size:7pt; color:#999;">
Stampato con OpenSTAManager
</td></tr>
</table>
</page_footer>

View File

@@ -25,16 +25,3 @@
</table> </table>
<br/> <br/>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table>
<tr><td style="font-size:7pt; color:#999;">
Stampato con OpenSTAManager
</td>
<td style="width:160mm; text-align:right; font-size:7pt; color:#999;">
Pagina [[page_cu]] di [[page_nb]]
</td></tr>
</table>
</page_footer>

View File

@@ -1,13 +1,3 @@
<page_header> <page_header>
</page_header> </page_header>
<!-- Footer -->
<page_footer>
<table>
<tr><td style="font-size:7pt; color:#999;">
Stampato con OpenSTAManager
</td></tr>
</table>
</page_footer>