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

Translation not working, no errors/log entries #28

Open
rschumachr opened this issue Apr 17, 2024 · 6 comments
Open

Translation not working, no errors/log entries #28

rschumachr opened this issue Apr 17, 2024 · 6 comments

Comments

@rschumachr
Copy link

I hope this can be considered an issue, I've consulted the slack channel but couldn't get any solutions there. The page content does not get translated at all, neither do news records. The issue to me is that there is no error/warning/info that would help me find the cause.

I've followed the documentation and double checked everything. Using TYPO3 12.4.11 and latest extension version, included the typoscript in the template, added the typoscript constants and the tsconfig (all are shown as active in the backend with the correct values). The deepl entry shows the correct apiKey and character limit usage. The buttons to translate are all there and can be used but they behave exactly like the standard translate buttons just adding the "[Translate to English:]" in front of titles and not translating anything. Same with news records.

In Slack it was suggested it might have to do with some faulty lines in the config.yaml (site configuration) but I've checked and all appears correct, the way I always set up the languages. Played around with some different values but without success.

It seems to me there should be some warning or error informing me why the content isn't being translated. Would also be helpful if the documentation included how the language settings in the site configuration need to look (which field is used to determine the target language, although I'm assuming it's the locale field).

@dmitryd
Copy link
Owner

dmitryd commented Apr 30, 2024

Here is my languages are set up:

languages:
  -
    title: Deutsch
    enabled: true
    languageId: 0
    base: /
    typo3Language: de
    locale: de_CH.UTF-8
    iso-639-1: de
    navigationTitle: De
    hreflang: ''
    direction: ''
    flag: de
    websiteTitle: ''
  -
    title: English
    enabled: true
    base: /en
    pageTitlePart: ''
    typo3Language: default
    locale: en_US.utf-8
    iso-639-1: en
    websiteTitle: ''
    navigationTitle: ''
    hreflang: ''
    direction: ''
    fallbackType: strict
    fallbacks: ''
    flag: en-us-gb
    languageId: 1

What languages do you use?

@stauer
Copy link

stauer commented May 29, 2024

Hello,

I had the same issue. In my case, the cause was the multi-domain setup.
In Dmitryd\DdDeepl\Configuration\Configuration the "BackendConfigurationManager" is instantiated to get the relevant TypoScript. In "BackendConfigurationManager", the “current Page-ID” is used to access the TS. However, this always has the value “1” - in a multi-domain setup, it is therefore likely that an incorrect TS will be returned here. Without the correct TS, there is also no API key, which means that no translation process starts at all (= no error / log entry, but nothing happens).

This is a general TYPO3 issue. See (for instance)

Short-term workaround: Use the “getenv:” override feature of dd_deepl. I.e. set the API key via .htaccess, for example.

RewriteCond %{HTTP_HOST} \.your\.host$
RewriteRule .? - [E=TYPO3_DEEPL_API_KEY:<YOUR_API_KEY>]

In the medium/long term, would it be an idea to let the extension read the API key from the SiteConfiguration? It has to be checked whether there is access to it in the DataHandler or the Configuration object.

@dmitryd
Copy link
Owner

dmitryd commented May 29, 2024

It needs TS unfortunately because there is also other config like glossaries. So I need to find out how to get proper TS for the current site...

@ralfhueskes
Copy link

Today I have updated to TYPO3 v12.4.16. Since then, the translation no longer works. Neither for pages nor for content elements. Before the update everything worked as expected. Furthermore, the API is correctly integrated and I don't get any errors in the logs. I also do not have a multi-level domain instance. Are there any indications of a connection with the version update?

@dmitryd
Copy link
Owner

dmitryd commented Jun 23, 2024

@ralfhueskes I just tried, can't confirm. I get translations fine. TYPO3 12.4.16 is a bug fix update, it should not affect any installation that does not do anything non-standard.

@twaurisch
Copy link

twaurisch commented Nov 7, 2024

It needs TS unfortunately because there is also other config like glossaries. So I need to find out how to get proper TS for the current site...

  • TYPO3 v12, EXT:dd_deepl v12.7.0

The localizeRecords AjaxRequest sets the pageId argument to define the current working page, but the BackendConfigurationManager::class requires an id argument. See BackendConfigurationManager->getCurrentPageIdFromRequest()

Without the id argument the current working page will be set to 0 and TYPO3 searches for the first 'sys_template' record to get the TypoScript configuration.

To make it work I updated the Localization.js with this code block.

 localizeRecords(e, a, t) {
        return new AjaxRequest(TYPO3.settings.ajaxUrls.records_localize).withQueryArguments({
            id: e,
            pageId: e,
            srcLanguageId: this.sourceLanguage,
            destLanguageId: a,
            action: "deepl" === this.localizationMode ? "localize" : this.localizationMode,
            uidList: t,
            deepl: "deepl" === this.localizationMode ? 1 : 0
        }).get()
    }

It is possible that the 'id' argument is missing in other requests too, but this fixes my problem with a multi site instance.

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

No branches or pull requests

5 participants