Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong url - Translation in Fallback Type: free #2526

Open
zkrechowiec opened this issue Sep 12, 2024 · 7 comments
Open

Wrong url - Translation in Fallback Type: free #2526

zkrechowiec opened this issue Sep 12, 2024 · 7 comments
Labels
Bug Core Core issue

Comments

@zkrechowiec
Copy link

Bug Report

Current Behavior
I have a site with multiple languages (EN as default, FR as secondary), when I translate a news item, the slug for my news item contains the path_segment EN ex:
EN: /newspress/detail-view/test-en
FR: /fr/actualites/vue-detaillee/test-en instead of /fr/actualites/vue-detaillee/test-fr

If I don't configure a fallback language (which is what I need on my site), I can't access the detailed view of my FR news (by going through the language menu from the EN detailed view or the FR list view) I get a 404.

If I add a fallback to the EN language still in free mode, then the detailed view works with the url /fr/actualites/vue-detaillee/test-en

My url rewriting is configured like this:
routeEnhancers:
News:
type: Extbase
limitToPages:
- 91
extension: News
plugin: Pi1
routes:
-
routePath: '/{news-title}'
_controller: 'News::detail'
_arguments:
news-title: news
defaultController: 'News::list'
defaults:
page: '0'
aspects:
news-title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment

And my language menu is generated by the LanguageMenuProcessor

Thanks in advance,
Zoïa

Environment

  • TYPO3 version(s): 12.4.20
  • news version: 11.4.2
  • Is your TYPO3 installation set up with Composer (Composer Mode): yes
@ulrike-cosmoblonde
Copy link

Hi,
I can confirm this behaviour.
In freemode, the generated URLs to news detail pages are always using the original path segment and never the translated path segment. This leads to a 404 (unless a fallback language is configured). It would be better to get the correct language-aware URLs.

@georgringer
Copy link
Owner

I am not sure if this is really a news issue but a core issue?

@georgringer georgringer added Bug Core Core issue labels Oct 31, 2024
@ulrike-cosmoblonde
Copy link

@georgringer I agree! It is a core behaviour concerning any data type and currently the only workaround I could find is to configure a fallback language even though the language mode is "free" and not "fallback"

@vitamys
Copy link

vitamys commented Jan 13, 2025

has this been reported as a core bug? are there any news on this?

@ursbraem
Copy link
Contributor

ursbraem commented Jan 15, 2025

We are experiencing this as well. So there's no core bug report yet? Maybe this has been discussed in TYPO3 slack?

@cepheiVV
Copy link
Contributor

cepheiVV commented Jan 16, 2025

  • Can anybody test if this is also a problem with TYPO3 v13?
  • Are we sure this is a core issue and not some misconfiguration?
  • Do we have a forge issue for this? (I can create a new one if there is none yet...)
  • @ursbraem was reporting (to me) that Links made within a ext.mask link field work fine and is pointing to the translated slugs. This is a typolink inside a Fluid Template: <f:link.typolink parameter="{data.header_link}" /> (this works) and also Text Links inside an RTE are working fine

@cepheiVV
Copy link
Contributor

cepheiVV commented Feb 2, 2025

In my List view I get this localized news item in French.
There's a German parent record in the default language

  • German UID: 3596
  • French UID: 3597

_localizedUid is shown as modified.

Image

In the List.html Partial we use the news link viewhelper

<n:link newsItem="{newsItem}" settings="{settings}">
   News List view Item
</n:link>

The French language (translation) is set to free mode with German set as the fallback language:

Image

When news list view is loaded in the frontend in French, all News slugs are rendered with the German slugs instead of the FR localized slugs.

Parameter for the Link used in the News: LinkViewHelper $url = $this->cObj->typoLink_URL($configuration);:

// $configuration:
parameter => 5
additionalParams => '&tx_news_pi1[news]=3596&tx_news_pi1[controller]=News&tx_news_pi1[action]=det
      ail'

If I pass the localized (French) UID back from method getNewsId, I will get the correct French slug:

    /**
     * @param News $newsItem
     * @return int
     */
    protected function getNewsId(News $newsItem): int
    {
        $uid = $newsItem->getUid();
        // If a user is logged in and not in live workspace
        if (isset($GLOBALS['BE_USER']) && $GLOBALS['BE_USER']->workspace > 0) {
            $record = BackendUtility::getLiveVersionOfRecord(
                'tx_news_domain_model_news',
                $newsItem->getUid()
            );
            if ($record['uid'] ?? false) {
                $uid = $record['uid'];
            }
        }

        return 3597;
        //return $uid;
    }

In method getNewsId I think we should make this adjustment:

If TYPO3 runs in free mode, we need to return the localized news record UID.
Only when the localized UID is not available, look up the language fallback chain and return the first available UID in the chain.

However, I am unsure if this change is "treating a symptom" that needs to be addressed in TYPO3 core or an actual bug in the news extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Core Core issue
Projects
None yet
Development

No branches or pull requests

6 participants