Skip to content

Commit

Permalink
// documented why tabs from the default language should not be export…
Browse files Browse the repository at this point in the history
…ed (see PSCSX-2436)
  • Loading branch information
djfm committed Jul 29, 2014
1 parent fefd7ab commit 77c80cd
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion controllers/admin/AdminTranslationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,26 @@ public function exportTabs()
$content = "<?php\n\n\$tabs = array();";
if (!empty($tabs))
foreach ($tabs as $tab)
{
/**
* We don't export tab translations that are identical to the default
* tab translations to avoid a problem that would occur in the followin scenario:
*
* 1) install PrestaShop in, say, Spanish => tabs are by default in Spanish
* 2) create a new language, say, Klingon => tabs are populated using the default, Spanish, tabs
* 3) export the Klingon language pack
*
* => Since you have not yet translated the tabs into Klingon,
* without the condition below, you would get tabs exported, but in Spanish.
* This would lead to a Klingon pack actually containing Spanish.
*
* This has caused many issues in the past, so, as a precaution, tabs from
* the default language are not exported.
*
*/
if ($tabs_default[$tab['class_name']] != pSQL($tab['name']))
$content .= "\n\$tabs['".$tab['class_name']."'] = '".pSQL($tab['name'])."';";
$content .= "\n\$tabs['".$tab['class_name']."'] = '".pSQL($tab['name'])."';";
}
$content .= "\n\nreturn \$tabs;";

$dir = _PS_TRANSLATIONS_DIR_.$this->lang_selected->iso_code.DIRECTORY_SEPARATOR;
Expand Down

0 comments on commit 77c80cd

Please sign in to comment.