diff --git a/.gitignore b/.gitignore index b8a6681..3cba497 100755 --- a/.gitignore +++ b/.gitignore @@ -9,10 +9,11 @@ Thumbs.db .build/ .idea/ nbproject/ +*.sublime-* # Vendors /vendor # Distribution /dist -/build +/build \ No newline at end of file diff --git a/src/Classes/I18nl10n.php b/src/Classes/I18nl10n.php index d04761e..7b5718e 100755 --- a/src/Classes/I18nl10n.php +++ b/src/Classes/I18nl10n.php @@ -14,6 +14,8 @@ namespace Verstaerker\I18nl10nBundle\Classes; +use Contao\Controller; + /** * Class I18nl10n * @@ -21,7 +23,7 @@ * * @package Verstaerker\I18nl10n\Classes */ -class I18nl10n extends \Controller +class I18nl10n extends Controller { /** * Known and unsupported Contao modules diff --git a/src/Hook/GenerateFrontendUrlHook.php b/src/Hook/GenerateFrontendUrlHook.php index cca7131..07d40b3 100644 --- a/src/Hook/GenerateFrontendUrlHook.php +++ b/src/Hook/GenerateFrontendUrlHook.php @@ -38,6 +38,14 @@ public function generateFrontendUrl($arrRow, $strParams, $strUrl) ? $GLOBALS['TL_LANGUAGE'] : $arrRow['language']; + // Do not look for a translation page if there is an alias given already existing in the language we want + if ($arrRow['alias']) { + $objAlias = \Database::getInstance() + ->prepare('SELECT alias FROM tl_page_i18nl10n WHERE alias = ? AND language = ?') + ->limit(1) + ->execute($arrRow['alias'], $language); + } + // Try to get l10n alias by language and pid if ($language !== $arrLanguages['default']) { $database = \Database::getInstance(); @@ -119,6 +127,11 @@ public function generateFrontendUrl($arrRow, $strParams, $strUrl) } } + // Catch "/" page aliases and do not add suffix to them (as they are considered as base request) + if ($strL10nUrl == $language."//".\Config::get('urlSuffix')) { + $strL10nUrl = $language."/"; + } + return $strL10nUrl; } } diff --git a/src/Hook/GetArticleHook.php b/src/Hook/GetArticleHook.php new file mode 100644 index 0000000..2ffd7ec --- /dev/null +++ b/src/Hook/GetArticleHook.php @@ -0,0 +1,36 @@ +id, "tl_article"); + + $blnDisplay = false; + if ($objElements && $objElements->count() > 0) { + while ($objElements->next()) { + if ($objElements->language == "" || $objElements->language == $GLOBALS['TL_LANGUAGE']) { + $blnDisplay = true; + break; + } + } + } + + if (!$blnDisplay) { + $objRow->customTpl = "mod_i18nl10n_article_empty"; + } + } +} diff --git a/src/Hook/GetPageIdFromUrlHook.php b/src/Hook/GetPageIdFromUrlHook.php index cf33bcc..626b8aa 100644 --- a/src/Hook/GetPageIdFromUrlHook.php +++ b/src/Hook/GetPageIdFromUrlHook.php @@ -103,6 +103,17 @@ public function getPageIdFromUrl(array $arrFragments) array_insert($arrMappedFragments, 1, array('auto_item')); } + // Restore the urlSuffix config if it has been removed in initializeSystem hook + if (\Config::has('tmpUrlSuffix')) { + \Config::set('urlSuffix', \Config::get('tmpUrlSuffix')); + \Config::set('tmpUrlSuffix', ''); + } + + // Consider that - as Contao native does - if we don't have a fragment, make it / to find homepage. + if ($arrMappedFragments[0] === "") { + $arrMappedFragments[0] = "/"; + } + return $arrMappedFragments; } @@ -147,8 +158,7 @@ private function mapUrlFragments($arrFragments) */ private function findAliasByLocalizedAliases($arrFragments, $strLanguage) { - $arrAlias = array - ( + $arrAlias = array( 'alias' => $arrFragments[0], 'l10nAlias' => '' ); diff --git a/src/Hook/InitializeSystemHook.php b/src/Hook/InitializeSystemHook.php new file mode 100644 index 0000000..bb91da8 --- /dev/null +++ b/src/Hook/InitializeSystemHook.php @@ -0,0 +1,42 @@ +getAvailableLanguages(); + $userLanguage = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); + + $languages = $arrLanguages[$_SERVER['HTTP_HOST']] ?: $arrLanguages['*']; + + if (in_array($userLanguage, $languages['languages'])) { + $strRedirect = $userLanguage."/"; + } else { + $strRedirect = $languages['default']."/"; + } + + Controller::redirect($strRedirect); + } + + // If we are on the homepage, remove the urlSuffix + $arrFragments = explode("/", \Environment::get('request')); + if ("" === $arrFragments[1] && "" != \Config::get('urlSuffix')) { + \Config::set('tmpUrlSuffix', \Config::get('urlSuffix')); + \Config::set('urlSuffix', ""); + } + } +} diff --git a/src/Hook/ReplaceInsertTagsHook.php b/src/Hook/ReplaceInsertTagsHook.php index 45bd77d..7b0e64c 100644 --- a/src/Hook/ReplaceInsertTagsHook.php +++ b/src/Hook/ReplaceInsertTagsHook.php @@ -25,51 +25,72 @@ public function replaceInsertTags($strTag) $arrArguments = explode('::', $strTag); - if ($arrArguments[0] === 'i18nl10n' && $arrArguments[1] === 'link') { - $objNextPage = I18nl10n::getInstance()->findL10nWithDetails($arrArguments[2], $GLOBALS['TL_LANGUAGE']); + if ($arrArguments[0] !== 'i18nl10n') { + return false; + } - if ($objNextPage === null) { - return false; - } + $objNextPage = I18nl10n::getInstance()->findL10nWithDetails($arrArguments[2], $GLOBALS['TL_LANGUAGE']); - switch ($objNextPage->type) { - case 'redirect': - $strUrl = \Controller::replaceInsertTags($objNextPage->url); + if ($objNextPage === null) { + return false; + } - if (strncasecmp($strUrl, 'mailto:', 7) === 0) { - $strUrl = \StringUtil::encodeEmail($strUrl); - } - break; + switch ($objNextPage->type) { + case 'redirect': + $strUrl = \Controller::replaceInsertTags($objNextPage->url); - case 'forward': - $intForwardId = $objNextPage->jumpTo ?: \PageModel::findFirstPublishedByPid($objNextPage->id) - ->current()->id; + if (strncasecmp($strUrl, 'mailto:', 7) === 0) { + $strUrl = \StringUtil::encodeEmail($strUrl); + } + break; - $objNext = \PageModel::findWithDetails($intForwardId); + case 'forward': + $intForwardId = $objNextPage->jumpTo ?: \PageModel::findFirstPublishedByPid($objNextPage->id) + ->current()->id; - if ($objNext !== null) { - $strUrl = I18nl10n::generateFrontendUrl($objNext->row(), null, ''); - break; - } + $objNext = \PageModel::findWithDetails($intForwardId); - // no break - default: - $strUrl = I18nl10n::generateFrontendUrl($objNextPage->row(), null, ''); + if ($objNext !== null) { + $strUrl = I18nl10n::generateFrontendUrl($objNext->row(), null, ''); break; - } - - $strName = $objNextPage->title; - $strTarget = $objNextPage->target ? - (($objPage->outputFormat == 'xhtml') ? LINK_NEW_WINDOW : ' target="_blank"') : ''; - $strTitle = $objNextPage->pageTitle ?: $objNextPage->title; - - return sprintf( - '%s', - $strUrl, - specialchars($strTitle), - $strTarget, - specialchars($strName) - ); + } + + // no break + default: + $strUrl = I18nl10n::generateFrontendUrl($objNextPage->row(), null, ''); + break; + } + + $strName = $objNextPage->title; + $strTarget = $objNextPage->target ? + (($objPage->outputFormat == 'xhtml') ? LINK_NEW_WINDOW : ' target="_blank"') : ''; + $strTitle = $objNextPage->pageTitle ?: $objNextPage->title; + + switch ($arrArguments[1]) { + case 'link': + return sprintf( + '%s', + $strUrl, + specialchars($strTitle), + $strTarget, + specialchars($strName) + ); + break; + + case 'link_url': + return $strUrl; + break; + + case 'link_title': + return $objNextPage->pageTitle ?: $objNextPage->title; + break; + + case 'link_name': + return $objNextPage->title; + break; + + default: + return false; } return false; diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index 13f7d43..f08431f 100755 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -34,10 +34,8 @@ array_insert( $GLOBALS['BE_MOD']['design'], array_search('page', array_keys($GLOBALS['BE_MOD']['design'])) + 1, - array - ( - 'i18nl10n' => array - ( + array( + 'i18nl10n' => array( 'tables' => array('tl_page_i18nl10n'), 'icon' => 'bundles/verstaerkeri18nl10n/img/i18nl10n.png' ) @@ -53,6 +51,7 @@ /** * HOOKS */ +$GLOBALS['TL_HOOKS']['initializeSystem'][] = array('Verstaerker\I18nl10nBundle\Hook\InitializeSystemHook', 'initializeSystem'); $GLOBALS['TL_HOOKS']['generateFrontendUrl'][] = array('Verstaerker\I18nl10nBundle\Hook\GenerateFrontendUrlHook', 'generateFrontendUrl'); $GLOBALS['TL_HOOKS']['getPageIdFromUrl'][] = array('Verstaerker\I18nl10nBundle\Hook\GetPageIdFromUrlHook', 'getPageIdFromUrl'); $GLOBALS['TL_HOOKS']['generateBreadcrumb'][] = array('Verstaerker\I18nl10nBundle\Hook\GenerateBreadcrumbHook', 'generateBreadcrumb'); @@ -60,6 +59,7 @@ $GLOBALS['TL_HOOKS']['isVisibleElement'][] = array('Verstaerker\I18nl10nBundle\Hook\IsVisibleElementHook', 'isVisibleElement'); $GLOBALS['TL_HOOKS']['replaceInsertTags'][] = array('Verstaerker\I18nl10nBundle\Hook\ReplaceInsertTagsHook', 'replaceInsertTags'); $GLOBALS['TL_HOOKS']['loadDataContainer'][] = array('Verstaerker\I18nl10nBundle\Hook\LoadDataContainerHook', 'setLanguages'); +$GLOBALS['TL_HOOKS']['getArticle'][] = array('Verstaerker\I18nl10nBundle\Hook\GetArticleHook', 'checkIfEmpty'); // Append language selection for tl_content $GLOBALS['TL_HOOKS']['loadDataContainer'][] = array('Verstaerker\I18nl10nBundle\Hook\LoadDataContainerHook', 'appendLanguageSelectCallback'); diff --git a/src/Resources/contao/dca/tl_article.php b/src/Resources/contao/dca/tl_article.php index a95fd9d..8834cef 100755 --- a/src/Resources/contao/dca/tl_article.php +++ b/src/Resources/contao/dca/tl_article.php @@ -68,7 +68,7 @@ public function addIcon($row, $label) { $count = $l10nItem['items']; $title = $GLOBALS['TL_LANG']['LNG'][$l10nItem['language']] . ": $count " . $GLOBALS['TL_LANG']['tl_article']['elements']; - $l10nItemIcon = 'system/modules/i18nl10n/assets/img/i18nl10n.png'; + $l10nItemIcon = 'bundles/verstaerkeri18nl10n/img/i18nl10n.png'; if ($l10nItem['language']) { diff --git a/src/Resources/contao/dca/tl_page.php b/src/Resources/contao/dca/tl_page.php index 65b4091..d7c792d 100755 --- a/src/Resources/contao/dca/tl_page.php +++ b/src/Resources/contao/dca/tl_page.php @@ -103,7 +103,7 @@ 'options_callback' => array('tl_page_l10n', 'languageOptions'), 'eval' => array ( - 'style' => 'width:250px', + 'style' => 'width:100%', 'chosen' => true, 'includeBlankOption' => true ) @@ -176,7 +176,7 @@ public function editL10n($row, $href, $label, $title, $icon) $strImgName = $row['i18nl10n_published'] ? 'i18nl10n.png' : 'i18nl10n_invisible.png'; return sprintf( - '', + '', $strButtonUrl, specialchars($strTitle), $strImgName @@ -509,8 +509,8 @@ public function setDnsMandatory() public function extendRootPalettes() { $GLOBALS['TL_DCA']['tl_page']['palettes']['root'] = str_replace( - 'language,fallback,staticFiles,staticPlugins;', - 'language,fallback,staticFiles,staticPlugins;{module_i18nl10n},i18nl10n_localizations;', + 'language,fallback;', + 'language,fallback;{module_i18nl10n},i18nl10n_localizations;', $GLOBALS['TL_DCA']['tl_page']['palettes']['root'] ); } diff --git a/src/Resources/contao/dca/tl_page_i18nl10n.php b/src/Resources/contao/dca/tl_page_i18nl10n.php index 79835f3..d32161a 100755 --- a/src/Resources/contao/dca/tl_page_i18nl10n.php +++ b/src/Resources/contao/dca/tl_page_i18nl10n.php @@ -41,27 +41,22 @@ /** * Table tl_page_i18nl10n */ -$GLOBALS['TL_DCA']['tl_page_i18nl10n'] = array -( +$GLOBALS['TL_DCA']['tl_page_i18nl10n'] = array( // Config - 'config' => array - ( + 'config' => array( 'dataContainer' => 'Table', 'ptable' => 'tl_page', 'enableVersioning' => true, 'closed' => !$enableCreate, - 'onload_callback' => array - ( + 'onload_callback' => array( array('tl_page', 'addBreadcrumb'), array('tl_page_i18nl10n', 'displayLanguageMessage'), array('tl_page_i18nl10n', 'localizeAllHandler'), array('tl_page_i18nl10n', 'checkPermission'), array('tl_page_i18nl10n', 'modifyPalettes'), ), - 'sql' => array - ( - 'keys' => array - ( + 'sql' => array( + 'keys' => array( 'id' => 'primary', 'pid' => 'index', 'alias' => 'index', @@ -69,29 +64,23 @@ ) ), // List - 'list' => array - ( - 'sorting' => array - ( + 'list' => array( + 'sorting' => array( 'mode' => 6, 'paste_button_callback' => array('tl_page_i18nl10n', 'pastePage') ), - 'label' => array - ( + 'label' => array( 'fields' => array('title', 'language'), 'label_callback' => array('tl_page_i18nl10n', 'labelCallback') ), // Global operations - 'global_operations' => array - ( - 'toggleNodes' => array - ( + 'global_operations' => array( + 'toggleNodes' => array( 'label' => &$GLOBALS['TL_LANG']['MSC']['toggleNodes'], 'href' => 'ptg=all', 'class' => 'header_toggle' ), - 'all' => array - ( + 'all' => array( 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', @@ -99,24 +88,20 @@ ), ), // Item operations - 'operations' => array - ( - 'edit' => array - ( + 'operations' => array( + 'edit' => array( 'label' => &$GLOBALS['TL_LANG']['tl_page_i18nl10n']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif', 'button_callback' => array('tl_page_i18nl10n', 'createEditButton') ), - 'copy' => array - ( + 'copy' => array( 'label' => &$GLOBALS['TL_LANG']['tl_page_i18nl10n']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif', 'button_callback' => array('tl_page_i18nl10n', 'createCopyButton') ), - 'delete' => array - ( + 'delete' => array( 'label' => &$GLOBALS['TL_LANG']['tl_page_i18nl10n']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', @@ -124,15 +109,13 @@ . '\')) return false; Backend.getScrollOffset();"', 'button_callback' => array('tl_page_i18nl10n', 'createDeleteButton') ), - 'toggle_l10n' => array - ( + 'toggle_l10n' => array( 'label' => &$GLOBALS['TL_LANG']['tl_page_i18nl10n']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return I18nl10n.toggleL10n(this,%s,\'tl_page_i18nl10n\')"', 'button_callback' => array('tl_page_i18nl10n', 'toggleIcon') ), - 'show' => array - ( + 'show' => array( 'label' => &$GLOBALS['TL_LANG']['tl_page_i18nl10n']['show'], 'href' => 'act=show', 'icon' => 'show.gif' @@ -140,8 +123,7 @@ ) ), // Palettes - 'palettes' => array - ( + 'palettes' => array( 'default' => '{i18nl10n_menuLegend},title,type,alias;' . '{i18nl10n_metaLegend},pageTitle,description;' . '{i18nl10n_expertLegend:hide},cssClass;' @@ -150,14 +132,11 @@ // Palettes are created by onload_callback ), // Fields - 'fields' => array - ( - 'id' => array - ( + 'fields' => array( + 'id' => array( 'sql' => "int(10) unsigned NOT NULL auto_increment" ), - 'pid' => array - ( + 'pid' => array( 'foreignKey' => 'tl_page.id', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array( @@ -184,22 +163,18 @@ ), 'sql' => "varchar(5) NOT NULL default ''" ), - 'type' => array - ( + 'type' => array( 'label' => &$GLOBALS['TL_LANG']['tl_page']['type'], 'inputType' => 'select', 'options' => array('regular', 'redirect', 'forward', 'root', 'error_403', 'error_404'), 'reference' => &$GLOBALS['TL_LANG']['PTY'], - 'save_callback' => array - ( + 'save_callback' => array( array('tl_page_i18nl10n', 'saveCallbackForType'), // Callback returns empty value to prevent save action ), - 'load_callback' => array - ( + 'load_callback' => array( array('tl_page_i18nl10n', 'getPageType') ), - 'eval' => array - ( + 'eval' => array( 'doNotSaveEmpty' => true, // Since save_callback returns an empty value, no db field is needed 'submitOnChange' => true, 'disabled' => true, @@ -226,8 +201,7 @@ // update fields $GLOBALS['TL_DCA']['tl_page_i18nl10n']['fields']['title']['eval']['tl_class'] = 'w50'; -$GLOBALS['TL_DCA']['tl_page_i18nl10n']['fields']['alias']['save_callback'] = array -( +$GLOBALS['TL_DCA']['tl_page_i18nl10n']['fields']['alias']['save_callback'] = array( array('tl_page_i18nl10n', 'generateAlias') ); $GLOBALS['TL_DCA']['tl_page_i18nl10n']['fields']['url']['eval']['mandatory'] = false; @@ -237,8 +211,7 @@ // Splice in localize all in case languages are available if ($enableCreate) { $additionalFunctions = array( - 'localize_all' => array - ( + 'localize_all' => array( 'label' => &$GLOBALS['TL_LANG']['tl_page_i18nl10n']['localize_all'], 'href' => 'localize_all=1', 'class' => 'header_l10n_localize_all', @@ -385,7 +358,6 @@ private function localizeAllAction() $arrLanguages = I18nl10n::getInstance()->getAvailableLanguages(true); foreach ($arrLanguages as $domain) { - // Get pages that will be localized based on user role and permissions if ($this->User->isAdmin) { $arrPageIds = $this->Database->getChildRecords(array($domain['rootId']), 'tl_page'); @@ -533,10 +505,8 @@ public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null) // Trigger the save_callback if (is_array($GLOBALS['TL_DCA']['tl_page_i18nl10n']['fields']['i18nl10n_published']['save_callback'])) { - foreach ( - $GLOBALS['TL_DCA']['tl_page_i18nl10n']['fields']['i18nl10n_published']['save_callback'] as - $callback - ) { + foreach ($GLOBALS['TL_DCA']['tl_page_i18nl10n']['fields']['i18nl10n_published']['save_callback'] as + $callback) { $this->import($callback[0]); $blnVisible = $this->$callback[0]->$callback[1]($blnVisible, $this); } @@ -726,7 +696,14 @@ public function generateAlias($varValue, DataContainer $dc) // Generate an alias if there is none if ($varValue === '') { $autoAlias = true; - $varValue = standardize( \StringUtil::restoreBasicEntities($dc->activeRecord->title)); + $slugOptions = array(); + + // Read the slug options from the associated page + if (($objPage = PageModel::findWithDetails($dc->activeRecord->pid)) !== null) { + $slugOptions = $objPage->getSlugOptions(); + } + + $varValue = System::getContainer()->get('contao.slug.generator')->generate(StringUtil::prepareSlug($dc->activeRecord->title), $slugOptions); // Generate folder URL aliases (see #4933) if (Config::get('folderUrl')) { @@ -937,12 +914,12 @@ public function pastePage(DataContainer $dc, $row, $table, $cr, $arrClipboard = '&id=' . $arrClipboard['id'] : '') ) . '" title="' . specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id'])) . '" onclick="Backend.getScrollOffset()">' . \Image::getHtml( - 'pasteinto.gif', - sprintf( - $GLOBALS['TL_LANG'][$table]['pasteinto'][1], - $row['id'] - ) - ) . ' ' + 'pasteinto.gif', + sprintf( + $GLOBALS['TL_LANG'][$table]['pasteinto'][1], + $row['id'] + ) + ) . ' ' : \Image::getHtml('pasteinto_.gif'); } @@ -973,9 +950,9 @@ private function userHasPermissionToEditPageType($arrRow, $strTable = 'tl_page_i { return $this->User->isAdmin || in_array( - ($strTable === 'tl_page_i18nl10n' ? \PageModel::findByIdOrAlias($arrRow['pid'])->type : $arrRow['type']), - (array) $this->User->alpty - ); + ($strTable === 'tl_page_i18nl10n' ? \PageModel::findByIdOrAlias($arrRow['pid'])->type : $arrRow['type']), + (array) $this->User->alpty + ); } /** @@ -991,9 +968,9 @@ private function userHasPermissionToEditPage($arrRow, $strTable = 'tl_page_i18nl return $this->User->isAdmin || ($this->userHasPermissionToEditLanguage($arrRow) && $this->userHasPermissionToEditPageType( - $arrRow, - $strTable - )); + $arrRow, + $strTable + )); } /** diff --git a/src/Resources/contao/languages/en/tl_page.php b/src/Resources/contao/languages/en/tl_page.php index a60fcf9..e6d8a3b 100755 --- a/src/Resources/contao/languages/en/tl_page.php +++ b/src/Resources/contao/languages/en/tl_page.php @@ -38,4 +38,4 @@ $GLOBALS['TL_LANG']['tl_page']['msg_missing_dns'] = 'When using more than one root page with i18nl10n, every root page needs a unique domain name! One or more roots are missing this value!'; $GLOBALS['TL_LANG']['tl_page']['msg_duplicated_dns'] = - 'Some root pages us the same domain value. When using the i18nl10n module only one root page is allowed for a domain.'; \ No newline at end of file + 'Some root pages use the same domain value. When using the i18nl10n module only one root page is allowed for a domain.'; \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/default.php b/src/Resources/contao/languages/fr/default.php new file mode 100644 index 0000000..0397c47 --- /dev/null +++ b/src/Resources/contao/languages/fr/default.php @@ -0,0 +1,27 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + + +/** + * Miscellaneous + */ +$GLOBALS['TL_LANG']['MSC']['i18nl10n_fields']['language']['label'] = array +( + 'Langue', + 'Veuillez sélectionner l\'une des langues disponibles.' +); + +$GLOBALS['TL_LANG']['MSC']['editL10n'] = 'Éditer les versions multilingues de la page %s'; +$GLOBALS['TL_LANG']['MSC']['language'] = 'langue'; + +$GLOBALS['TL_LANG']['LNG'][''] = 'Neutre'; + +$GLOBALS['TL_LANG']['ERR']['i18nl10n_aliasExists'] = 'L\'alias "%s" existe déjà pour la langue sélectionnée.'; \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/modules.php b/src/Resources/contao/languages/fr/modules.php new file mode 100644 index 0000000..9bafc4b --- /dev/null +++ b/src/Resources/contao/languages/fr/modules.php @@ -0,0 +1,29 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + +/** + * Back end modules + */ +$GLOBALS['TL_LANG']['MOD']['i18nl10n'] = array +( + 'Pages multilingues', + 'Créez une arborescence multilingue unique en ajoutant des langages aux pages et en localisant les éléments de contenu.' +); + + +/** + * Front end modules + */ +$GLOBALS['TL_LANG']['FMD']['i18nl10nLanguageSelection'] = array +( + 'Sélection de language', + 'Génère une liste de langues ou une liste déroulante des langues disponibles pour la page courante.' +); \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/tl_article.php b/src/Resources/contao/languages/fr/tl_article.php new file mode 100644 index 0000000..6b83ddc --- /dev/null +++ b/src/Resources/contao/languages/fr/tl_article.php @@ -0,0 +1,12 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + +$GLOBALS['TL_LANG']['tl_article']['elements'] = 'élément(s)'; \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/tl_content.php b/src/Resources/contao/languages/fr/tl_content.php new file mode 100644 index 0000000..67d7c4b --- /dev/null +++ b/src/Resources/contao/languages/fr/tl_content.php @@ -0,0 +1,22 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + + +/** + * Fields + */ +$GLOBALS['TL_LANG']['tl_content']['language'] = &$GLOBALS['TL_LANG']['MSC']['language']; +$GLOBALS['TL_LANG']['tl_content']['i18nl10n_blankOptionLabel'] = 'Tous'; + +/** + * References + */ +$GLOBALS['TL_LANG']['tl_content']['i18nl10n_legend'] = 'Paramètres L10N'; \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/tl_module.php b/src/Resources/contao/languages/fr/tl_module.php new file mode 100644 index 0000000..66be078 --- /dev/null +++ b/src/Resources/contao/languages/fr/tl_module.php @@ -0,0 +1,34 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + +$GLOBALS['TL_LANG']['tl_module']['i18nl10n_langTpl'] = array +( + 'Modèle', + 'Choisissez un modèle pour le menu des langues.' +); + +$GLOBALS['TL_LANG']['tl_module']['i18nl10n_langStyle'] = array +( + 'Utilisez un style', + 'Utilisez un des styles CSS existants.' +); + +$GLOBALS['TL_LANG']['tl_module']['i18nl10n_langStyleLabels']['full'] = 'Icône & Label'; +$GLOBALS['TL_LANG']['tl_module']['i18nl10n_langStyleLabels']['text'] = 'Label seul'; +$GLOBALS['TL_LANG']['tl_module']['i18nl10n_langStyleLabels']['image'] = 'Icône seule'; +$GLOBALS['TL_LANG']['tl_module']['i18nl10n_langStyleLabels']['iso'] = 'Code ISO'; +$GLOBALS['TL_LANG']['tl_module']['i18nl10n_langStyleLabels']['disable'] = 'Aucun style'; + +$GLOBALS['TL_LANG']['tl_module']['i18nl10n_langHide'] = array +( + 'Cacher le langage actif', + 'N\'affiche pas le langage courant dans les options.' +); \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/tl_page.php b/src/Resources/contao/languages/fr/tl_page.php new file mode 100644 index 0000000..a0e4c31 --- /dev/null +++ b/src/Resources/contao/languages/fr/tl_page.php @@ -0,0 +1,42 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + + +/** + * Fields + */ +$GLOBALS['TL_LANG']['tl_page']['module_i18nl10n'] = 'Paramètres i18nl10n'; + +$GLOBALS['TL_LANG']['tl_page']['i18nl10n_published'] = array +( + 'Publier L10N', + 'Publier cette traduction.' +); + +$GLOBALS['TL_LANG']['tl_page']['i18nl10n_localizations'] = array +( + 'Langues du site', + 'Langues/traductions additionnelles disponibles pour cette arborescence.' +); + +$GLOBALS['TL_LANG']['tl_page']['i18nl10n_language'] = 'Langue'; + +/** + * Messages + */ +$GLOBALS['TL_LANG']['tl_page']['msg_no_languages'] = + 'Aucune langue alternative n\'a été définie. Veuillez le faire sur les %s paramètres %s page.'; +$GLOBALS['TL_LANG']['tl_page']['msg_multiple_root'] = + 'i18nl10n a découvert plusieurs racines de site dans votre arborescence. Faites attention : ce module ne peut gérer plusieurs arborescences !'; +$GLOBALS['TL_LANG']['tl_page']['msg_missing_dns'] = + 'Quand on utilise plus d\'une racine de site avec i18nl10n, chaque racine de site nécessite un domaine unique ! Cette valeur est absente dans une ou plusieurs racines !'; +$GLOBALS['TL_LANG']['tl_page']['msg_duplicated_dns'] = + 'Certaines racines de site utilisent le même nom de domaine. Quand on utilise le module i18nl10n, seule une racine de site est autorisée pour un domaine.'; \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/tl_page_i18nl10n.php b/src/Resources/contao/languages/fr/tl_page_i18nl10n.php new file mode 100644 index 0000000..d0ec2db --- /dev/null +++ b/src/Resources/contao/languages/fr/tl_page_i18nl10n.php @@ -0,0 +1,96 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + + +/** + * Legends & Fields + */ +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['i18nl10n_legend'] = 'Paramètres L10N'; +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['redirect_legend'] = 'Redirection'; // For some unknown reason this is not taken form tl_page + +$GLOBALS['TL_LANG']['tl_page_i18nl10n'][''] = array +( + '', + '' +); + +/** + * References + */ +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['i18nl10n_menuLegend'] = 'Champs traduits pour les menus et l\'adresse'; +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['i18nl10n_metaLegend'] = 'Traduction des meta-données'; +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['i18nl10n_timeLegend'] = 'Paramètres de traduction pour la date et l\'heure'; +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['i18nl10n_expertLegend'] = &$GLOBALS['TL_LANG']['tl_page']['expert_legend']; +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['publish_legend'] = &$GLOBALS['TL_LANG']['tl_page']['publish_legend']; + +/** + * Buttons + */ +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['new'] = array +( + 'Nouvelle L10N', + 'Ajoutez une traduction pour la page' +); + +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['define_language'] = array +( + 'Langues', + 'Définissez les langues dans la page de configuration' +); + +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['edit'] = array +( + 'Éditer', + 'Éditer la traduction %s' +); + +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['copy'] = array +( + 'Dupliquer', + 'Dupliquer la traduction' +); + +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['delete'] = array +( + 'Supprimer', + 'Supprimer la traduction' +); + +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['toggle'] = array +( + 'Publier/Dépublier L10N', + 'Publier/Dépublier L10N ID %s' +); + +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['show'] = array +( + 'Afficher', + 'Afficher la traduction' +); + +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['localize_all'] = array +( + 'L10N pour tout', + 'Traduire toutes les pages ne comportant pas de traductions avec les langues disponibles' +); + +/** + * Messages + */ +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['msg_no_root'] = + 'Pas de racine de site définie. Veuillez le faire dans le menu "%s"'; +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['msg_no_languages'] = + 'Pas de langues alternatives configurées pour i18nl10n. Veuillez le faire dans les racines de site du menu "%s".'; +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['msg_some_languages'] = + 'Des racines de site n\'ont pas de langues alternatives.'; +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['msg_localize_all'] = + 'Je vais créer des traductions pour toutes les traductions manquantes basée sur la liste suivante (et sur les droits de l\'utilisateur). Êtes-vous sûr de vouloir continuer ?'; +$GLOBALS['TL_LANG']['tl_page_i18nl10n']['no_languages'] = 'Pas de langues'; \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/tl_settings.php b/src/Resources/contao/languages/fr/tl_settings.php new file mode 100644 index 0000000..345d492 --- /dev/null +++ b/src/Resources/contao/languages/fr/tl_settings.php @@ -0,0 +1,30 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + +/** + * Fields + */ +$GLOBALS['TL_LANG']['tl_settings']['i18nl10n_urlParam'][0] = 'Ajouter la langue à l\'URL'; +$GLOBALS['TL_LANG']['tl_settings']['i18nl10n_urlParam'][1] = + 'Définissez comment la langue apparaîtra dans l\'URL des sites.'; + +$GLOBALS['TL_LANG']['tl_settings']['i18nl10n_urlParamLabels']['parameter'] = 'Comme un paramètre (ex. ?language=en)'; +$GLOBALS['TL_LANG']['tl_settings']['i18nl10n_urlParamLabels']['alias'] = 'Comme une partie de l\'alias (ex. accueil.fr.html) [Ne fonctionne pas actuellement]'; +$GLOBALS['TL_LANG']['tl_settings']['i18nl10n_urlParamLabels']['url'] = 'Comme une partie de l\'URL (ex. mondomaine.com/fr/index.html)'; + +$GLOBALS['TL_LANG']['tl_settings']['i18nl10n_aliasSuffixError'] = + 'Il n\'est pas possible d\'utiliser "%s" et "%s" en même temps. Veuillez n\'en sélectionner qu\'un !'; + +$GLOBALS['TL_LANG']['tl_settings']['i18nl10n_contaoAddLanguageToUrlError'] = + 'I18nl10n ne supporte pas la fonctionnalité "%s" de Contao. Veuillez utiliser le module alternatif à la place.'; + +$GLOBALS['TL_LANG']['tl_settings']['i18nl10n_defLangMissingInfo'] = + 'La langue par défaut est absente des langues supporées pour votre page et a donc été ajoutée automatiquement.'; \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/tl_user.php b/src/Resources/contao/languages/fr/tl_user.php new file mode 100644 index 0000000..473b39a --- /dev/null +++ b/src/Resources/contao/languages/fr/tl_user.php @@ -0,0 +1,15 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + +$GLOBALS['TL_LANG']['tl_user']['i18nl10n_languages'] = array( + 'Langues éditables', + 'Indiquez les langues éditables pour les éléments de contenu et les pages.' +); \ No newline at end of file diff --git a/src/Resources/contao/languages/fr/tl_user_group.php b/src/Resources/contao/languages/fr/tl_user_group.php new file mode 100644 index 0000000..f89306a --- /dev/null +++ b/src/Resources/contao/languages/fr/tl_user_group.php @@ -0,0 +1,16 @@ + + * @author Web ex Machina (FR Translation) + * @package i18nl10n + * @license LGPLv3 http://www.gnu.org/licenses/lgpl-3.0.html + */ + +$GLOBALS['TL_LANG']['tl_user_group']['i18nl10n_legend'] = 'Langues'; +$GLOBALS['TL_LANG']['tl_user_group']['i18nl10n_languages'] = array( + 'Langues éditables', + 'Indiquez les langues éditables pour les éléments de contenu et les pages.' +); \ No newline at end of file diff --git a/src/Resources/contao/modules/ModuleI18nl10nLanguageSelection.php b/src/Resources/contao/modules/ModuleI18nl10nLanguageSelection.php index 47eeddf..14c9a1a 100755 --- a/src/Resources/contao/modules/ModuleI18nl10nLanguageSelection.php +++ b/src/Resources/contao/modules/ModuleI18nl10nLanguageSelection.php @@ -122,7 +122,7 @@ protected function compile() // only if page translation is found in database foreach ($arrLanguages['languages'] as $language) { // check if current language has not to be shown - if ($language === $GLOBALS['TL_LANGUAGE'] && $this->i18nl10n_langHide === 1) { + if ($language === $GLOBALS['TL_LANGUAGE'] && $this->i18nl10n_langHide) { continue; } diff --git a/src/Resources/contao/pages/PageI18nl10nRegular.php b/src/Resources/contao/pages/PageI18nl10nRegular.php index cb9c498..1ed7186 100755 --- a/src/Resources/contao/pages/PageI18nl10nRegular.php +++ b/src/Resources/contao/pages/PageI18nl10nRegular.php @@ -181,10 +181,10 @@ private function addAlternativeLanguageLinks($objPage) foreach ($arrPages as $page) { $page['forceRowLanguage'] = true; - $strUrl = \Controller::generateFrontendUrl($page); + $strUrl = \Environment::get('base').\Controller::generateFrontendUrl($page); $links[] = ""; } diff --git a/src/Resources/contao/templates/mod_i18nl10n_article_empty.html5 b/src/Resources/contao/templates/mod_i18nl10n_article_empty.html5 new file mode 100644 index 0000000..e69de29