85447[BUGFIX] Allow non-english languages as xlf default language
Commit message
Review
-
Code review CR +2 Done
- Benjamin Franzke +2
- Georg Ringer +1
-
Verified V +2 Done
- Benjamin Franzke +2
- Georg Ringer +1
- core-ci +1 CI
Issues 1
Files 4
- typo3/sysext/core/Classes/Localization/LanguageService.php+1 −7
- typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/test_translate/Resources/Private/Language/en.locallang.xlfnew+11 −0
- typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/test_translate/Resources/Private/Language/locallang.xlf+6 −0
- typo3/sysext/fluid/Tests/Functional/ViewHelpers/TranslateViewHelperTest.php+8 −0
Review log 1622
-
Hannes Lau uploaded patch set 1 08/01/24, 20:13
-
core-ci voted on patch set 1 V +1 08/01/24, 20:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62640
-
Georg Ringer updated the commit message in patch set 2
V +108/01/24, 20:30 -
core-ci voted on patch set 2 V +1 08/01/24, 20:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/62648
-
Georg Ringer voted on patch set 2 CR +1 V +1 08/01/24, 21:05
-
Georg Ringer commented on patch set 2 CR -1 08/03/24, 04:49
please provide a proper in typo3/sysext/fluid/Tests/Functional/ViewHelpers/TranslateViewHelperTest so that we don't break it again. thanks -
Hannes Lau uploaded patch set 3
CR -1V +109/05/24, 21:19 -
core-ci voted on patch set 3 V +1 09/05/24, 21:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64894
-
Benni Mack commented on patch set 3 09/05/24, 21:25
not a feature, we can backport this to v12 -
Hannes Lau uploaded patch set 4
V +109/05/24, 21:55 -
core-ci voted on patch set 4 V -1 09/05/24, 22:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64896
-
Hannes Lau uploaded patch set 5
V -109/05/24, 22:02 -
core-ci voted on patch set 5 V +1 09/05/24, 22:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64897
-
Hannes Lau commented on patch set 5 09/05/24, 22:14
Reply
> please provide a proper in typo3/sysext/fluid/Tests/Functional/ViewHelpers/TranslateViewHelperTest so that we don't break it again. thanks That is a good idea! I added a en.locallang.xlf to the test extension and extended an existing test data provider to check for the new override. -
Benjamin Franzke updated the commit message in patch set 6
V +109/06/24, 07:14 -
core-ci voted on patch set 6 V +1 09/06/24, 07:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64913
-
Georg Ringer voted on patch set 6 CR +1 V +1 09/06/24, 08:39
-
Benjamin Franzke commented on patch set 6 CR +1 V -1 09/06/24, 09:47
The patch looks good and I tried to verify, but… …this doesn't work for me in backend nor frontend context… ### Frontend I copied `typo3/sysext/felogin/Resources/Private/Language/locallang.xlf` to `typo3/sysext/felogin/Resources/Private/Language/en.locallang.xlf`, removed files from `typo3conf/l10n/` and changed `typo3/sysext/felogin/Resources/Private/Language/locallang.xlf` to `source-language="de"` and changed some labels there. The "english" site is not overlayed by `en.locallang.xlf`. Tried this with ``` languages: - title: English enabled: true languageId: 0 base: / locale: en_US.UTF-8 navigationTitle: English flag: us typo3Language: default iso-639-1: en hreflang: en-us direction: ltr websiteTitle: '' - title: 'styleguide demo language german' enabled: true base: /de/ typo3Language: de locale: de_DE.UTF-8 iso-639-1: de websiteTitle: '' navigationTitle: '' hreflang: de-de direction: '' fallbackType: strict fallbacks: '' flag: de languageId: 40 ``` Also tried with `typo3Language: en` instead of `typo3Language: default` – doesn't work either… Also https://github.com/TYPO3/typo3/blob/b89aad13d4859fb90f0a8dac923cf43ef01f6f8c/typo3/sysext/core/Classes/Site/Entity/SiteLanguage.php#L228-L229 doesn't look good then, as it's defined to map `en` back to `default`. Should that be adapted as well? ### Backend Same approach as above, but adapting a module xlf file. Here I wonder how this works if there is only a `default` option in backend user-language settings, not "en". Note: I even added the user locale english as mentioned in the ticket: ``` $GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user'] = ['en' => 'English']; ``` -
Hannes Lau commented on patch set 6 09/07/24, 22:30
Reply
Hi Benjamin! Thank you for investing the time and testing this patch. I just tried again myself (now also with fe_login) and it worked for me. You wrote: > I copied > typo3/sysext/felogin/Resources/Private/Language/locallang.xlf to > typo3/sysext/felogin/Resources/Private/Language/en.locallang.xlf After copying, you have to make en.locallang.xlf a real translation file by setting source-language="de", target-language="en" and by creating source and target tags for the de->en translations. Here is the head of my en.locallang.xlf file: ```xml <?xml version="1.0" encoding="UTF-8"?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> <file source-language="de" target-language="en" datatype="plaintext" original="EXT:felogin/Resources/Private/Language/locallang.xlf" date="2011-10-17T20:22:32Z" product-name="felogin"> <header/> <body> <trans-unit id="welcome_message" resname="welcome_message"> <source>Enter your username and password here in order to log in on the website</source> <target>1 Override</target> </trans-unit> … ``` From your description it sounds like you just copied the file, which would not be enough. > Also https://github.com/TYPO3/typo3/blob/b89aad13d4859fb90f0a8dac923cf43ef01f6f8c/typo3/sysext/core/Classes/Site/Entity/SiteLanguage.php#L228-L229 doesn't look good then, as it's defined to map en back to default. Should that be adapted as well? So far I have not run into an issue with that line, probably because I still set typo3Lang explicitly. I do believe that it can be removed, because "en" would eventually fall back to "default" (locallang.xlf) anyways. I will try to remove those lines within this same PR. > Note: I even added the user locale english as mentioned in the ticket: I did not have to do this. So far I only tested frontend, not backend. -
Benjamin Franzke commented on patch set 6 CR +2 V +2 09/09/24, 13:01
Reply
Sorry and thanks, and changed `source-language` and `target-language`, but totally forgot to add `<target>` tags 🤦 Works now – also in backend. Thanks! -
Benjamin Franzke merged patch set 7 09/09/24, 13:09
-
Christian Kuhn commented on patch set 7 09/09/24, 15:37
post-merge +1. thx for bringing this in. we talked about this change during DevDays and i came to the conclusion this is a reasonable hack to satisfy some edge cases, but didn't find the time to vote on it.